Skip to content

Instantly share code, notes, and snippets.

@itoonx
Created August 8, 2017 03:29
Show Gist options
  • Save itoonx/3fe99d51bc78bb38d1e2e4a97be13102 to your computer and use it in GitHub Desktop.
Save itoonx/3fe99d51bc78bb38d1e2e4a97be13102 to your computer and use it in GitHub Desktop.
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
@itoonx
Copy link
Author

itoonx commented Mar 3, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment