jl2012



Offline



Activity: 1792

Merit: 1010







LegendaryActivity: 1792Merit: 1010

Re: OP_XXX: How to take current block height? November 06, 2015, 04:02:49 AM #9 Quote from: pianist on November 04, 2015, 11:46:00 AM



Code: 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?

I want to make conditional output script, something like this: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:



Code: OP_IF 2 <pubkey1> <pubkey2> <pubkey3> 3 OP_CHECKMULTISIG OP_ELSE 399999 OP_CLTV OP_DROP <pubkey4> OP_CHECKSIG OP_ENDIF , which means:



Code: 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



Code: 0 <sig1> <sig2> 1

When block height is >= 400000, by setting the nLockTime >= 399999, it could be spent with this scriptSig



Code: <sig4> 0 You example is not possible even with OP_CLTV. The nearest thing is:, which means:At, it could be spent with this scriptSigWhen block height is >= 400000, by setting the nLockTime >= 399999, it could be spent with this scriptSig