<p><code>coinbase, scriptPubKey, scriptSig</code> - they are all scripts. You can read in wiki about how to decode script <a href="https://en.bitcoin.it/wiki/Script" rel="nofollow">https://en.bitcoin.it/wiki/Script</a>.</p>

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

<pre><code>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
</code></pre>

CC BY-SA 3.0
2014-02-04T09:58:08.217Z
2014-02-04T09:58:08.217Z
Zergatul
<p>After reading this <a href="https://bitcoin.stackexchange.com/questions/20721/what-is-the-format-of-coinbase-transaction">What is the format of the coinbase transaction?</a> I was wondering about a few things.</p>

<p>decoderawtransaction of a random Litecoin coinbase transaction:</p>

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

<p>Is the <em>asm</em> field the outgoing address? If yes how is it encoded and what is the hex field for? Same question goes for <em>scriptSig asm</em> 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 <em>vins</em> from the same address and I don't see the same public key in the <em>asm</em> field.</p>

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

CC BY-SA 3.0
2014-02-02T20:19:34.433Z
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
CC BY-SA 3.0
2014-02-03T10:23:32.583Z
OP_HASH160 is sha256 and then ripemd applied to public key
Tyler Gillies
<transactions><script><coinbase-transaction>
How to fully decode a coinbase transaction?
user13005
# How to fully decode a coinbase transaction?

(Asked by: username_0 on 2014-02-02)

After reading this [What is the format of the coinbase transaction?](https://bitcoin.stackexchange.com/questions/20721/what-is-the-format-of-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?

**Tags:** transactions, script, coinbase-transaction

> **Comments:**
> **username_1**: 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  
> **username_2**: OP_HASH160 is sha256 and then ripemd applied to public key  

---

## 1 answers

### Answer by username_3 on 2014-02-04. Score: 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

```


---

