Author

Topic: OP_XXX: How to take current block height? (Read 1149 times)

legendary
Activity: 1792
Merit: 1111
November 05, 2015, 11:02:49 PM
#9
I want to make conditional output script, something like this:

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? Smiley

You example is not possible even with OP_CLTV. The nearest thing is:

Code:
OP_IF 2 3 OP_CHECKMULTISIG OP_ELSE 399999 OP_CLTV OP_DROP 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 1

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

Code:
0
legendary
Activity: 1792
Merit: 1111
November 05, 2015, 10:42:24 PM
#8
Will 0.11.2 have these OPs? Or they are only planned in future like sidechains OP?
Yes and yes.

It's a soft fork, like sidechains support. Its activation will begin shortly, with the releases of 0.11.2 and 0.10.4.


Can't wait any longer. This is the first new function added to Bitcoin since its creation (P2SH did not introduce new function)
staff
Activity: 4284
Merit: 8808
November 05, 2015, 01:40:11 PM
#7
Will 0.11.2 have these OPs? Or they are only planned in future like sidechains OP?
Yes and yes.

It's a soft fork, like sidechains support. Its activation will begin shortly, with the releases of 0.11.2 and 0.10.4.
legendary
Activity: 954
Merit: 1003
November 05, 2015, 01:13:37 PM
#6
There will be 0.11.2 and 0.10. releases out with this in the next week or so.

Will 0.11.2 have these OPs? Or they are only planned in future like sidechains OP?
staff
Activity: 4284
Merit: 8808
November 04, 2015, 09:45:52 PM
#5
I guess that will be once 0.12 is released.
Soft-forks shouldn't be and aren't tied to Bitcoin core major versions.  There will be 0.11.2 and 0.10. releases out with this in the next week or so.
legendary
Activity: 1135
Merit: 1166
November 04, 2015, 12:53:27 PM
#4
wait for OP_CHECKLOCKTIMEVERIFY

Are there any plans to implement this OP in near future?

I justed greped sources and there is no such string in sources... Sad


It is already in the current development sources, and it will "activate" on the live network as soon as 75%/95% of hashing power have upgraded.  I guess that will be once 0.12 is released.
legendary
Activity: 954
Merit: 1003
November 04, 2015, 12:45:31 PM
#3
wait for OP_CHECKLOCKTIMEVERIFY

Are there any plans to implement this OP in near future?

I justed greped sources and there is no such string in sources... Sad
sr. member
Activity: 261
Merit: 523
November 04, 2015, 10:16:44 AM
#2
You need to wait for OP_CHECKLOCKTIMEVERIFY

https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki#escrow
legendary
Activity: 954
Merit: 1003
November 04, 2015, 06:46:00 AM
#1
I want to make conditional output script, something like this:

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? Smiley
Jump to: