I want to open a discussion on a new op code that retrieves current block height from the global state.
We do have CheckLockTimeVerify and CheckSequenceVerify. Both need block height or block timestamp to operate. And I know these two op codes have a certain characteristic. Once they will become valid in the chain. Their validity does not need verification on the next block.
Now the question is. Does bitcoin’s current implementation takes advantage of this behavior to operate, Meaning once the transaction becomes valid it will no longer check for validity on the next block. If so the implementation of the new opcode will become a big hassle.
At the moment AnyHedge contracts cannot get settled at every block until the contract time is over. With the help of an opcode that retrieves current block height this will be possible to do.
For example lets say we are at block height 501 and the data from OP_CHECKDATASIG shows the price of the hedged asset at block 500. Then we construct a script that will only be valid in that particular block height.
I’ve studied bitcoin code a few years ago. I’m not clueless. But I’d be happy to get educated on this concept.
Please let me know what you think. Is this something bitcoin engine can handle?