Bitcoin Forum
December 16, 2017, 03:05:12 PM *
News: Latest stable version of Bitcoin Core: 0.15.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: OP_XXX: How to take current block height?  (Read 1030 times)
pianist
Legendary
*
Offline Offline

Activity: 995


View Profile
November 04, 2015, 11: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

    ▄▄██████▄▄
  ▄████████████▄
 ██▀   ▀██▀   ▀██       █████   ████████████▄▄       ▄███████▄▄
██▀             ██      █████   █████▀▀▀▀▀█████▄   ▄████▀   ▀█▀
██              ██      █████   █████      ▀█████▄ █████▄
███▄          ▄███      █████   █████       ██████ ▀███████▄▄
█████▄      ▄█████      ▀▀███   █████       ██████   ▀████▀▀ ▄▄
 ██████▄  ▄██████       ██▄▄▄   ▄ ▀▀▀       ▀▀▀▀▀▀       ▄██████
  ██████████████        █████   █████      ▄█████▀   ▄    ▀█████
   ████████████     ▄▄▄█████▀   █████▄▄▄▄▄█████▀   ▀███▄  ▄████▀
    ▀████████▀      ██████▀     ███████████▀▀        ▀███████▀
      ▀████▀
        ▀▀
▄▄▄▄▄▄▄▄
▄▄▄▄▄

▄▄▄▄▄
▄▄▄▄▄▄▄▄
.A Platform That Connects People.
♥ ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ ♥   MEET NEW PEOPLE!
▄▄▄▄▄▄▄▄
▄▄▄▄▄

▄▄▄▄▄
▄▄▄▄▄▄▄▄
▄▄▄▄▄▄▄▄
▄▄▄▄▄

▄▄▄▄▄
▄▄▄▄▄▄▄▄


Telegram
Youtube
slack
▄▄▄▄▄▄▄▄
▄▄▄▄▄

▄▄▄▄▄
▄▄▄▄▄▄▄▄
▄▄▄▄▄▄▄▄
▄▄▄▄▄

▄▄▄▄▄
▄▄▄▄▄▄▄▄
1513436712
Hero Member
*
Offline Offline

Posts: 1513436712

View Profile Personal Message (Offline)

Ignore
1513436712
Reply with quote  #2

1513436712
Report to moderator
1513436712
Hero Member
*
Offline Offline

Posts: 1513436712

View Profile Personal Message (Offline)

Ignore
1513436712
Reply with quote  #2

1513436712
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1513436712
Hero Member
*
Offline Offline

Posts: 1513436712

View Profile Personal Message (Offline)

Ignore
1513436712
Reply with quote  #2

1513436712
Report to moderator
1513436712
Hero Member
*
Offline Offline

Posts: 1513436712

View Profile Personal Message (Offline)

Ignore
1513436712
Reply with quote  #2

1513436712
Report to moderator
belcher
Sr. Member
****
Offline Offline

Activity: 245


View Profile
November 04, 2015, 03:16:44 PM
 #2

You need to wait for OP_CHECKLOCKTIMEVERIFY

https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki#escrow

1HZBd22eQLgbwxjwbCtSjhoPFWxQg8rBd9
JoinMarket - CoinJoin that people will actually use.
PGP fingerprint: 0A8B 038F 5E10 CC27 89BF CFFF EF73 4EA6 77F3 1129
pianist
Legendary
*
Offline Offline

Activity: 995


View Profile
November 04, 2015, 05: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

    ▄▄██████▄▄
  ▄████████████▄
 ██▀   ▀██▀   ▀██       █████   ████████████▄▄       ▄███████▄▄
██▀             ██      █████   █████▀▀▀▀▀█████▄   ▄████▀   ▀█▀
██              ██      █████   █████      ▀█████▄ █████▄
███▄          ▄███      █████   █████       ██████ ▀███████▄▄
█████▄      ▄█████      ▀▀███   █████       ██████   ▀████▀▀ ▄▄
 ██████▄  ▄██████       ██▄▄▄   ▄ ▀▀▀       ▀▀▀▀▀▀       ▄██████
  ██████████████        █████   █████      ▄█████▀   ▄    ▀█████
   ████████████     ▄▄▄█████▀   █████▄▄▄▄▄█████▀   ▀███▄  ▄████▀
    ▀████████▀      ██████▀     ███████████▀▀        ▀███████▀
      ▀████▀
        ▀▀
▄▄▄▄▄▄▄▄
▄▄▄▄▄

▄▄▄▄▄
▄▄▄▄▄▄▄▄
.A Platform That Connects People.
♥ ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ ♥   MEET NEW PEOPLE!
▄▄▄▄▄▄▄▄
▄▄▄▄▄

▄▄▄▄▄
▄▄▄▄▄▄▄▄
▄▄▄▄▄▄▄▄
▄▄▄▄▄

▄▄▄▄▄
▄▄▄▄▄▄▄▄


Telegram
Youtube
slack
▄▄▄▄▄▄▄▄
▄▄▄▄▄

▄▄▄▄▄
▄▄▄▄▄▄▄▄
▄▄▄▄▄▄▄▄
▄▄▄▄▄

▄▄▄▄▄
▄▄▄▄▄▄▄▄
domob
Legendary
*
Offline Offline

Activity: 983


View Profile WWW
November 04, 2015, 05: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.

Use your Namecoin identity as OpenID: https://nameid.org/
Donations: 1domobKsPZ5cWk2kXssD8p8ES1qffGUCm | NMC: NCdomobcmcmVdxC5yxMitojQ4tvAtv99pY
BM-GtQnWM3vcdorfqpKXsmfHQ4rVYPG5pKS | GPG 0xA7330737
gmaxwell
Moderator
Legendary
*
qt
Offline Offline

Activity: 2366



View Profile
November 05, 2015, 02:45:52 AM
 #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.

Bitcoin will not be compromised
pianist
Legendary
*
Offline Offline

Activity: 995


View Profile
November 05, 2015, 06: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?

    ▄▄██████▄▄
  ▄████████████▄
 ██▀   ▀██▀   ▀██       █████   ████████████▄▄       ▄███████▄▄
██▀             ██      █████   █████▀▀▀▀▀█████▄   ▄████▀   ▀█▀
██              ██      █████   █████      ▀█████▄ █████▄
███▄          ▄███      █████   █████       ██████ ▀███████▄▄
█████▄      ▄█████      ▀▀███   █████       ██████   ▀████▀▀ ▄▄
 ██████▄  ▄██████       ██▄▄▄   ▄ ▀▀▀       ▀▀▀▀▀▀       ▄██████
  ██████████████        █████   █████      ▄█████▀   ▄    ▀█████
   ████████████     ▄▄▄█████▀   █████▄▄▄▄▄█████▀   ▀███▄  ▄████▀
    ▀████████▀      ██████▀     ███████████▀▀        ▀███████▀
      ▀████▀
        ▀▀
▄▄▄▄▄▄▄▄
▄▄▄▄▄

▄▄▄▄▄
▄▄▄▄▄▄▄▄
.A Platform That Connects People.
♥ ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ ♥   MEET NEW PEOPLE!
▄▄▄▄▄▄▄▄
▄▄▄▄▄

▄▄▄▄▄
▄▄▄▄▄▄▄▄
▄▄▄▄▄▄▄▄
▄▄▄▄▄

▄▄▄▄▄
▄▄▄▄▄▄▄▄


Telegram
Youtube
slack
▄▄▄▄▄▄▄▄
▄▄▄▄▄

▄▄▄▄▄
▄▄▄▄▄▄▄▄
▄▄▄▄▄▄▄▄
▄▄▄▄▄

▄▄▄▄▄
▄▄▄▄▄▄▄▄
gmaxwell
Moderator
Legendary
*
qt
Offline Offline

Activity: 2366



View Profile
November 05, 2015, 06: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.

Bitcoin will not be compromised
jl2012
Legendary
*
Offline Offline

Activity: 1750


View Profile
November 06, 2015, 03:42:24 AM
 #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)

Donation address: 374iXxS4BuqFHsEwwxUuH3nvJ69Y7Hqur3 (Bitcoin ONLY)
LRDGENPLYrcTRssGoZrsCT1hngaH3BVkM4 (LTC)
PGP: D3CC 1772 8600 5BB8 FF67 3294 C524 2A1A B393 6517
jl2012
Legendary
*
Offline Offline

Activity: 1750


View Profile
November 06, 2015, 04:02:49 AM
 #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 <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

Donation address: 374iXxS4BuqFHsEwwxUuH3nvJ69Y7Hqur3 (Bitcoin ONLY)
LRDGENPLYrcTRssGoZrsCT1hngaH3BVkM4 (LTC)
PGP: D3CC 1772 8600 5BB8 FF67 3294 C524 2A1A B393 6517
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!