<p><code>asm</code> refers to the de-serialised form of the script, with well-known tokens parsed as script tokens. </p>

<p><code>hex</code> is just the serialised form of the script in hex encoding.</p>

<p>If you compare them carefully, they are essentially equivalent.</p>

<p>For example:</p>

<p><code>OP_DUP OP_HASH160 f9d49c5cf3e120ad1be60b67d868603a8fc945d2 OP_EQUALVERIFY OP_CHECKSIG</code></p>

<p><code>76 a9 14 f9d49c5cf3e120ad1be60b67d868603a8fc945d2 88 ac</code></p>

<p><code>76</code> is <code>OP_DUP</code></p>

<p><code>14</code> is the number of bytes to be pushed onto the stack.</p>

<p>and etc...</p>

CC BY-SA 4.0
2021-03-11T17:52:58.507Z
What is "asm" stand for? Is it an acronym?
JDOaktown
CC BY-SA 4.0
2021-03-12T07:53:47.093Z
i think its an abbreviation for assembly.
rny
CC BY-SA 3.0
2017-02-12T20:47:00.200Z
2017-02-12T20:47:00.200Z
rny
<p>I used the command line <code>bitcoin-cli decoderawtransaction &lt;hex-value&gt;</code> and got back a JSON output (see below). However, I noticed there are <code>hex</code> and <code>asm</code> fields that are themselves hex values (at times). I am thinking these are metadata that can further be decoded. Is that right?</p>

<p>Is there any more documentation on the structure and meaning of the JSON passed back for these 2 fields (or more)? </p>

<p>I read this <a href="https://bitcoin.stackexchange.com/questions/10680/bitcoin-rawtransaction-json-what-do-all-the-variables-mean">SO post</a> which referred to this <a href="http://www.michaelnielsen.org/ddi/how-the-bitcoin-protocol-actually-works/" rel="noreferrer">out-dated article</a>. </p>

<p>Also, I checked the transaction on <a href="https://blockchain.info/tx/7f758cfafde965c350b97a237ee95a7d393d9ba9cce41dcbf6acd9c01f99f0fc" rel="noreferrer">bitcoin block explorer</a>. They seem to have a few metadata that I don't see in the JSON (e.g. received time, confirmations, relayed ip, etc...). Where are these values coming from?</p>

<pre><code>{
  "txid": "2514161c059ac18bf2eff1e05c4628e322d846e930fd6dd4b24805ea59dc4913",
  "hash": "2514161c059ac18bf2eff1e05c4628e322d846e930fd6dd4b24805ea59dc4913",
  "size": 259,
  "vsize": 259,
  "version": 1,
  "locktime": 0,
  "vin": [
    {
      "txid": "4f40655c4ab1a029bc41bc547f79556a0dc48d22df7202778fad592791c77fcd",
      "vout": 0,
      "scriptSig": {
        "asm": "3046022100cd6795ebcd1b6b87833a4ad812733d3804065d34bafee24da181a770892272b902210088cd2484952ad2572f9bfb2874643dbb4b3c492b749e79d8177a14eb4a3bc61a[ALL] 04bbf2b84900b6f898548687aefba86cc06da6f4656a71e45fa55128b501455b5486cb09705cfa23c1899fe46d4355c9058bb2de4f1a7f1a01ff27e00b306f7356",
        "hex": "493046022100cd6795ebcd1b6b87833a4ad812733d3804065d34bafee24da181a770892272b902210088cd2484952ad2572f9bfb2874643dbb4b3c492b749e79d8177a14eb4a3bc61a014104bbf2b84900b6f898548687aefba86cc06da6f4656a71e45fa55128b501455b5486cb09705cfa23c1899fe46d4355c9058bb2de4f1a7f1a01ff27e00b306f7356"
      },
      "sequence": 4294967295
    }
  ],
  "vout": [
    {
      "value": 889.94500000,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 f9d49c5cf3e120ad1be60b67d868603a8fc945d2 OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a914f9d49c5cf3e120ad1be60b67d868603a8fc945d288ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "1PmyxDv5VvGoSAKMr1DQcWB6sHPx1ZbgWe"
        ]
      }
    }, 
    {
      "value": 10.00000000,
      "n": 1,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 088465c1f0c8b3b3da06f7073a921d6b95b22f49 OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a914088465c1f0c8b3b3da06f7073a921d6b95b22f4988ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "1n31g4rKiEeXnZEZR6VZwm3LggLicEqEC"
        ]
      }
    }
  ]
}
</code></pre>

<p>Furthermore, I decoded the raw transaction using <a href="https://blockchain.info/decode-tx" rel="noreferrer">https://blockchain.info/decode-tx</a> and got something different.</p>

<pre><code>{
   "lock_time":0,
   "size":259,
   "inputs":[
      {
         "prev_out":{
            "index":0,
            "hash":"4f40655c4ab1a029bc41bc547f79556a0dc48d22df7202778fad592791c77fcd"
         },
         "script":"493046022100cd6795ebcd1b6b87833a4ad812733d3804065d34bafee24da181a770892272b902210088cd2484952ad2572f9bfb2874643dbb4b3c492b749e79d8177a14eb4a3bc61a014104bbf2b84900b6f898548687aefba86cc06da6f4656a71e45fa55128b501455b5486cb09705cfa23c1899fe46d4355c9058bb2de4f1a7f1a01ff27e00b306f7356"
      }
   ],
   "version":1,
   "vin_sz":1,
   "hash":"2514161c059ac18bf2eff1e05c4628e322d846e930fd6dd4b24805ea59dc4913",
   "vout_sz":2,
   "out":[
      {
         "script_string":"OP_DUP OP_HASH160 f9d49c5cf3e120ad1be60b67d868603a8fc945d2 OP_EQUALVERIFY OP_CHECKSIG",
         "address":"1PmyxDv5VvGoSAKMr1DQcWB6sHPx1ZbgWe",
         "value":88994500000,
         "script":"76a914f9d49c5cf3e120ad1be60b67d868603a8fc945d288ac"
      },
      {
         "script_string":"OP_DUP OP_HASH160 088465c1f0c8b3b3da06f7073a921d6b95b22f49 OP_EQUALVERIFY OP_CHECKSIG",
         "address":"1n31g4rKiEeXnZEZR6VZwm3LggLicEqEC",
         "value":1000000000,
         "script":"76a914088465c1f0c8b3b3da06f7073a921d6b95b22f4988ac"
      }
   ]
}
</code></pre>

<bitcoind><raw-transaction><bitcoin-cli>
What are the hex and asm field values in the JSON decoded from a raw transactions?
Jane Wayne
# What are the hex and asm field values in the JSON decoded from a raw transactions?

(Asked by: username_0 on 2017-02-12)

I used the command line `bitcoin-cli decoderawtransaction <hex-value>` and got back a JSON output (see below). However, I noticed there are `hex` and `asm` fields that are themselves hex values (at times). I am thinking these are metadata that can further be decoded. Is that right?

Is there any more documentation on the structure and meaning of the JSON passed back for these 2 fields (or more)?

I read this [SO post](https://bitcoin.stackexchange.com/questions/10680/bitcoin-rawtransaction-json-what-do-all-the-variables-mean) which referred to this [out-dated article](http://www.michaelnielsen.org/ddi/how-the-bitcoin-protocol-actually-works/).

Also, I checked the transaction on [bitcoin block explorer](https://blockchain.info/tx/7f758cfafde965c350b97a237ee95a7d393d9ba9cce41dcbf6acd9c01f99f0fc). They seem to have a few metadata that I don't see in the JSON (e.g. received time, confirmations, relayed ip, etc...). Where are these values coming from?

```
{
  "txid": "2514161c059ac18bf2eff1e05c4628e322d846e930fd6dd4b24805ea59dc4913",
  "hash": "2514161c059ac18bf2eff1e05c4628e322d846e930fd6dd4b24805ea59dc4913",
  "size": 259,
  "vsize": 259,
  "version": 1,
  "locktime": 0,
  "vin": [
    {
      "txid": "4f40655c4ab1a029bc41bc547f79556a0dc48d22df7202778fad592791c77fcd",
      "vout": 0,
      "scriptSig": {
        "asm": "3046022100cd6795ebcd1b6b87833a4ad812733d3804065d34bafee24da181a770892272b902210088cd2484952ad2572f9bfb2874643dbb4b3c492b749e79d8177a14eb4a3bc61a[ALL] 04bbf2b84900b6f898548687aefba86cc06da6f4656a71e45fa55128b501455b5486cb09705cfa23c1899fe46d4355c9058bb2de4f1a7f1a01ff27e00b306f7356",
        "hex": "493046022100cd6795ebcd1b6b87833a4ad812733d3804065d34bafee24da181a770892272b902210088cd2484952ad2572f9bfb2874643dbb4b3c492b749e79d8177a14eb4a3bc61a014104bbf2b84900b6f898548687aefba86cc06da6f4656a71e45fa55128b501455b5486cb09705cfa23c1899fe46d4355c9058bb2de4f1a7f1a01ff27e00b306f7356"
      },
      "sequence": 4294967295
    }
  ],
  "vout": [
    {
      "value": 889.94500000,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 f9d49c5cf3e120ad1be60b67d868603a8fc945d2 OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a914f9d49c5cf3e120ad1be60b67d868603a8fc945d288ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "1PmyxDv5VvGoSAKMr1DQcWB6sHPx1ZbgWe"
        ]
      }
    }, 
    {
      "value": 10.00000000,
      "n": 1,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 088465c1f0c8b3b3da06f7073a921d6b95b22f49 OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a914088465c1f0c8b3b3da06f7073a921d6b95b22f4988ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "1n31g4rKiEeXnZEZR6VZwm3LggLicEqEC"
        ]
      }
    }
  ]
}

```

Furthermore, I decoded the raw transaction using <https://blockchain.info/decode-tx> and got something different.

```
{
   "lock_time":0,
   "size":259,
   "inputs":[
      {
         "prev_out":{
            "index":0,
            "hash":"4f40655c4ab1a029bc41bc547f79556a0dc48d22df7202778fad592791c77fcd"
         },
         "script":"493046022100cd6795ebcd1b6b87833a4ad812733d3804065d34bafee24da181a770892272b902210088cd2484952ad2572f9bfb2874643dbb4b3c492b749e79d8177a14eb4a3bc61a014104bbf2b84900b6f898548687aefba86cc06da6f4656a71e45fa55128b501455b5486cb09705cfa23c1899fe46d4355c9058bb2de4f1a7f1a01ff27e00b306f7356"
      }
   ],
   "version":1,
   "vin_sz":1,
   "hash":"2514161c059ac18bf2eff1e05c4628e322d846e930fd6dd4b24805ea59dc4913",
   "vout_sz":2,
   "out":[
      {
         "script_string":"OP_DUP OP_HASH160 f9d49c5cf3e120ad1be60b67d868603a8fc945d2 OP_EQUALVERIFY OP_CHECKSIG",
         "address":"1PmyxDv5VvGoSAKMr1DQcWB6sHPx1ZbgWe",
         "value":88994500000,
         "script":"76a914f9d49c5cf3e120ad1be60b67d868603a8fc945d288ac"
      },
      {
         "script_string":"OP_DUP OP_HASH160 088465c1f0c8b3b3da06f7073a921d6b95b22f49 OP_EQUALVERIFY OP_CHECKSIG",
         "address":"1n31g4rKiEeXnZEZR6VZwm3LggLicEqEC",
         "value":1000000000,
         "script":"76a914088465c1f0c8b3b3da06f7073a921d6b95b22f4988ac"
      }
   ]
}

```

**Tags:** bitcoind, raw-transaction, bitcoin-cli


---

## 1 answers

### Answer by username_1 on 2017-02-12. Score: 8 | Accepted answer

`asm` refers to the de-serialised form of the script, with well-known tokens parsed as script tokens.

`hex` is just the serialised form of the script in hex encoding.

If you compare them carefully, they are essentially equivalent.

For example:

`OP_DUP OP_HASH160 f9d49c5cf3e120ad1be60b67d868603a8fc945d2 OP_EQUALVERIFY OP_CHECKSIG`

`76 a9 14 f9d49c5cf3e120ad1be60b67d868603a8fc945d2 88 ac`

`76` is `OP_DUP`

`14` is the number of bytes to be pushed onto the stack.

and etc...

> **Comments:**
> **username_2**: What is "asm" stand for? Is it an acronym?  
> **username_1**: i think its an abbreviation for assembly.  

---

