Bitcoin Forum
May 04, 2024, 02:47:22 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: script  (Read 1346 times)
FabioCarpi (OP)
Sr. Member
****
Offline Offline

Activity: 375
Merit: 254



View Profile
January 12, 2015, 02:41:59 PM
 #1

im making a script execution routine in my program
for the multisig sig (ex: https://blockchain.info/pt/tx-index/70071473), have a OP_FALSE in the beginning
in the manual (https://en.bitcoin.it/wiki/Script), says the OP_FALSE put a blank value in the stack...
in my test, i got this
Code:
array (size=5)
  0 => string '' (length=0)
  1 => string '3045022015bd388f4be0da8fec78920d4651dc9da4a38efc97c2c956e1e5ccacec9d8d5d022100d69519f5362dedf2c7175693f001b1d253255a91068ce6561c57b366eb9e8adf01' (length=144)
  2 => string '304502207f0fdb0c5ff38c1237e31c9f96fd89461280cc9d3cc01eb954c8e7d8600a0926022100e55357b75648867503ae7d7a19e3a28adea46ba7f0f6b222db2fa01b8618c2c201' (length=144)
  3 => string '522102138eb535f6ea4aaf6898cacb7ddca70d82d85cc84e0a69ae08158f0fc066b0d92102d1e6d254e0a396c9f25e3bc2a4a98f68e7911a938e4b1608d53232e67ca7e4bd52ae' (length=142)
  4 => boolean true

Its correct? And this op_false is for what?
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714790842
Hero Member
*
Offline Offline

Posts: 1714790842

View Profile Personal Message (Offline)

Ignore
1714790842
Reply with quote  #2

1714790842
Report to moderator
1714790842
Hero Member
*
Offline Offline

Posts: 1714790842

View Profile Personal Message (Offline)

Ignore
1714790842
Reply with quote  #2

1714790842
Report to moderator
amaclin
Legendary
*
Offline Offline

Activity: 1260
Merit: 1019


View Profile
January 12, 2015, 08:37:13 PM
 #2

Look here:
http://webbtc.com/tx/01ca013ca48b3dde57227086fbb884933cc24054578cb68bc7caeb4fb082638f

This is the same transaction.
But webbtc service has a feature "Debug --> Run Script" (at the right side)

Follow to http://webbtc.com/script/01ca013ca48b3dde57227086fbb884933cc24054578cb68bc7caeb4fb082638f:0
and look to "Execution Trace" : what operations are executed and what is the stack state
FabioCarpi (OP)
Sr. Member
****
Offline Offline

Activity: 375
Merit: 254



View Profile
January 12, 2015, 10:41:19 PM
 #3

great site
thanks a lot
doof
Hero Member
*****
Offline Offline

Activity: 765
Merit: 503


View Profile WWW
January 12, 2015, 11:03:08 PM
 #4

great site
thanks a lot
Agreed.  Will book mark this one.
Saitteld
Newbie
*
Offline Offline

Activity: 36
Merit: 0


View Profile
January 13, 2015, 08:00:34 AM
 #5

OP_FALSE is needed due to a bug in OP_CHECKMULTISIG. See https://en.bitcoin.it/wiki/Script#Crypto "Due to a bug, one extra unused value is removed from the stack." No, this bug should not be fixed Smiley

Another visualization of script execution: https://curiosity-driven.org/bitcoin-contracts See: Escrow - Executing script.
readerbtc
Jr. Member
*
Offline Offline

Activity: 54
Merit: 1


View Profile
January 13, 2015, 07:24:12 PM
 #6

No, this bug should not be fixed Smiley
Why not? Sure, it would be a hard fork, but couldn't clients consider block height when executing opcodes and behave accordingly?
amaclin
Legendary
*
Offline Offline

Activity: 1260
Merit: 1019


View Profile
January 13, 2015, 07:47:50 PM
 #7

Quote
Why not? Sure, it would be a hard fork, but couldn't clients consider block height when executing opcodes and behave accordingly?
Do you want to upgrade all clients in the world? Grin
Tell me how to do it  Grin
readerbtc
Jr. Member
*
Offline Offline

Activity: 54
Merit: 1


View Profile
January 14, 2015, 01:36:35 AM
 #8

Won't they be upgraded, soon or later? I mean, hard forks will happen.
Saitteld
Newbie
*
Offline Offline

Activity: 36
Merit: 0


View Profile
January 14, 2015, 12:03:38 PM
 #9

Either way Bitcoin is an interesting piece of software that needs to not only be backwards-compatible but forwards-compatible too.

Hard fork problem stems from old, not upgraded clients, they'd use the old logic and we can't ignore them. Just like amaclin said it's not upgrading most of the clients, it's upgrading all of them. And yes, in ideal world everyone would update and the bug would be fixed. But Bitcoin client does not have a spec so basically the Bitcoin Core code is the spec. Looking from this perspective maybe we shouldn't call this a "bug"? Wink

By the way there are more interesting ... issues like that, see SIGHASH_SINGLE behavior when the number of inputs != number of outputs ( https://en.bitcoin.it/wiki/OP_CHECKSIG#Procedure_for_Hashtype_SIGHASH_SINGLE ).
amaclin
Legendary
*
Offline Offline

Activity: 1260
Merit: 1019


View Profile
January 14, 2015, 12:38:10 PM
 #10

Quote
Looking from this perspective maybe we shouldn't call this a "bug"? Wink

This is bug. Definitely a bug. The insect that we did not want to be here.
But this is a bug in a consensus code.
So, this is a bug in an amber
https://upload.wikimedia.org/wikipedia/commons/b/b6/Amber2.jpg

readerbtc
Jr. Member
*
Offline Offline

Activity: 54
Merit: 1


View Profile
January 15, 2015, 12:39:05 AM
 #11

Quote
Looking from this perspective maybe we shouldn't call this a "bug"? Wink

This is bug. Definitely a bug. The insect that we did not want to be here.
But this is a bug in a consensus code.
So, this is a bug in an amber
https://upload.wikimedia.org/wikipedia/commons/b/b6/Amber2.jpg


#liked
gmaxwell
Moderator
Legendary
*
expert
Offline Offline

Activity: 4158
Merit: 8382



View Profile WWW
January 15, 2015, 04:12:23 AM
 #12

That checkmultisig reads an extra element could be used in the future to make batch validation faster (as it needs some additional side information), or for other extensions.  It's commonly assumed to be a bug that it reads an extra item but might have just as well been another forward compatibility mechanism, or a left over behavior from an earlier approach.
readerbtc
Jr. Member
*
Offline Offline

Activity: 54
Merit: 1


View Profile
January 15, 2015, 04:56:06 PM
Merited by pebwindkraft (1)
 #13

That checkmultisig reads an extra element could be used in the future to make batch validation faster (as it needs some additional side information), or for other extensions.  It's commonly assumed to be a bug that it reads an extra item but might have just as well been another forward compatibility mechanism, or a left over behavior from an earlier approach.
I like bitcoin because it screws my notions of what is software.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!