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?

user13005
  • 71
  • 1
  • 2
  • I believe the OP_HASH160 975efcba1e058667594dc57146022ec46560a63c is the RIPEMD hash of the address. Check out step 3. http://bitcoin.stackexchange.com/questions/5021/how-do-you-get-the-op-hash160-value-from-a-bitcoin-address – John T Feb 02 '14 at 20:19
  • OP_HASH160 is sha256 and then ripemd applied to public key – Tyler Gillies Feb 03 '14 at 10:23

1 Answers1

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
Zergatul
  • 958
  • 4
  • 11