Closed wardlem closed 5 years ago
These are good questions. It depends on the platform. I think we should match how Bitcoin Core prints the assembly when you get a raw block or transaction.
For the example above, it would look like this:
OP_DUP OP_HASH160 ab68025513c3dbd2f7b92a94e0581f5d50f654e7 OP_EQUALVERIFY OP_CHECKSIG
And a 0
can be either an OP_0
or a literal 0
, but in order to push literal values to the stack, you first need a PUSH_DATA
byte like 0x01
for 1 byte.
Example:
"asm": "0 30450221008d5ec57d362ff6ef6602e4e756ef1bdeee12bd5c5c72697ef1455b379c90531002202ef3ea04dfbeda043395e5bc701e4878c15baab9c6ba5808eb3d04c91f641a0c[ALL] 522103310188e911026cf18c3ce274e0ebb5f95b007f230d8cb7d09879d96dbeab1aff210243930746e6ed6552e03359db521b088134652905bd2d1541fa9124303a41e95621029e03a901b85534ff1e92c43c74431f7ce72046060fcf7a95c37e148f78c7725553ae",
"hex": "004830450221008d5ec57d362ff6ef6602e4e756ef1bdeee12bd5c5c72697ef1455b379c90531002202ef3ea04dfbeda043395e5bc701e4878c15baab9c6ba5808eb3d04c91f641a0c014c69522103310188e911026cf18c3ce274e0ebb5f95b007f230d8cb7d09879d96dbeab1aff210243930746e6ed6552e03359db521b088134652905bd2d1541fa9124303a41e95621029e03a901b85534ff1e92c43c74431f7ce72046060fcf7a95c37e148f78c7725553ae"
Is there a standard for how bitcoin script asm is supposed to be written? I have seen several different formats including:
Additionally, does a literal
0
represent anOP_0
(empty array of bytes) or a literal0
.