I want to make conditional output script, something like this:
IF (current_block_height < 400000)
{
check_multisig(2,3);
}
ELSE
{
usual OP_CHECKSIG condition;
}
There are many OP_XXX instructions, but there is no way to get current height of blockchain, or height of block where output script is stored.
May be there is easy way to get such data?
You example is not possible even with OP_CLTV. The nearest thing is:
OP_IF 2 <pubkey1> <pubkey2> <pubkey3> 3 OP_CHECKMULTISIG OP_ELSE 399999 OP_CLTV OP_DROP <pubkey4> OP_CHECKSIG OP_ENDIF
, which means:
IF (current_block_height < 400000)
{
check_multisig(2,3);
}
ELSE
{
(usual OP_CHECKSIG condition) OR (check_multisig(2,3));
}
At
anytime, it could be spent with this scriptSig
When block height is >= 400000, by setting the nLockTime >= 399999, it could be spent with this scriptSig