7

After reading this What is the format of the coinbase transaction? I was wondering about a few things.

decoderawtransaction of a random Litecoin coinbase transaction:

"coinbase" : "038abd07062f503253482f048725ee5208083865a409000000092f7374726174756d2f",
...
    "scriptPubKey" : {
    "asm" : "OP_DUP OP_HASH160 975efcba1e058667594dc57146022ec46560a63c OP_EQUALVERIFY OP_CHECKSIG",
    "hex" : "76a914975efcba1e058667594dc57146022ec46560a63c88ac",
..
    "addresses" : [
    "LZ2L61M8rCoZmK7SemTBqfxuFZv5Uj4peR"

Is the asm field the outgoing address? If yes how is it encoded and what is the hex field for? Same question goes for scriptSig asm field in a normal transaction. It contains the public key and the signature but how is it structured/encoded. Because I have a Tx with to vins from the same address and I don't see the same public key in the asm field.

How do I read the coinbase? Hex2asic gives me "?????/P2SH/??%?R??8e??????/stratum/". Is that all I can do if I don't know how the pool operator has structured the coinbase?

2
  • I believe the OP_HASH160 975efcba1e058667594dc57146022ec46560a63c is the RIPEMD hash of the address. Check out step 3. bitcoin.stackexchange.com/questions/5021/…
    – John T
    Commented Feb 2, 2014 at 20:19
  • OP_HASH160 is sha256 and then ripemd applied to public key Commented Feb 3, 2014 at 10:23

1 Answer 1

3

coinbase, scriptPubKey, scriptSig - they are all scripts. You can read in wiki about how to decode script https://en.bitcoin.it/wiki/Script.

Coinbase can contain any data, even invalid script. But typically, it contains valid scripts. Examples of decoding:

coinbase: 038abd07062f503253482f048725ee5208083865a409000000092f7374726174756d2f
03 - length opcode
8abd07 - data with length 03
06 - length opcode
2f503253482f - data with length 06
04 - length opcode
8725ee52 - data with length 04
08 - length opcode
083865a409000000 - data with length 08
09 - length opcode
2f7374726174756d2f - data with length 09

scriptPubKey: 76a914975efcba1e058667594dc57146022ec46560a63c88ac
76 - OP_DUP opcode
a9 - HASH160 opcode
14 - length opcode
975efcba1e058667594dc57146022ec46560a63c - data with length 14 (20 in dec)
88 - OP_EQUALVERIFY opcode
ac - OP_CHECKSIG opcode

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.