<blockquote>
<p><strong>could anyone break down the meaning behind these other fields?</strong></p>
</blockquote>
<p>Many of them are not explicitly present in the data but are inventions of pybtc that present you with an interpretation of some aspect of the data.</p>
<p>For example <code>type:p2pkh</code> is not a data item in the transaction data but is a label created by examination of the form of the scriptPubKey. It is an additional categorisation that represents the results of an assessment, it is not data present explicitly.</p>
<p>Consequently, if you want to <em>fully</em> understand the meaning and scope of these invented items, you would have to consult the pybtc author or its source code.</p>
<p>Parsers that invent data in a confusing attempt to be helpful is why I wrote my own parser. I think a parser should be clear about what is original data and what is additional interpretation.</p>
<hr />
<p>The only &quot;real&quot; data items in that list are those labelled <code>value</code> and <code>scriptPubKey</code>, all the rest are inventions, commentary.</p>
<p><code>Value</code> is the amount of money, expressed in units of Satoshi (10<sup>-8</sup> Bitcoin), being sent to one &quot;recipient&quot;.</p>
<p><code>scriptPubKey</code> is the locking script that typically prevents anyone other than the intended recipient from subsequently spending this particular amount. It defines the spending conditions (if any). With scripts such as P2SH, I guess you could say it constrains rather than defines since the real conditions are not revealed until the amount is spent (if at all).</p>
<p>Additionally, Python's bytes literals are a particularly noisy and unhelpful way of presenting Bitcoin scripts. I think pybtc's author should have chosen to show them as hexadecimal. If I wanted to show readable text embedded in a script I would use something like canonical hexdump format or something close to the algorithm used by Unix <code>strings</code>.</p>
<hr />
<p>I can only guess at the inventions:</p>
<p><code>type</code> appears to be a categorisation of the pattern of <code>scriptPubKey</code></p>
<p><code>nType</code> is probably a numeric code for <code>type</code></p>
<p><code>addressHash</code> is the middle portion of <code>scriptPubKey</code></p>
<p><code>reqsigs</code> presumably attempts to guess the value of <code>n</code> in an <code>n of m</code> multisig output - or attempts to assign a sensible value in other circumstances.</p>

CC BY-SA 4.0
2023-03-09T11:32:27.407Z
Excellent answer!
Murch
CC BY-SA 4.0
2023-03-09T10:50:58.407Z
2023-03-09T16:51:50.650Z
2023-03-09T16:51:50.650Z
RedGrittyBrick
<p>Transactions may have many inputs and many outputs. I assume you extracted the output list from some transactions.</p>
<p>The “form1” dictionary has two entries with the keys 0 and 1. Entry 0 is a P2PKH output worth 472'100 satoshis, entry 1 is a P2WPKH output worth 72'978'592 satoshis (i.e. 0.729'785'92 ₿).</p>
<p>The “form2” dictionary has four entries, naturally with the keys 0–3. Entry 0 is a <code>null_data</code> output that burns 12'007 satoshis, outputs 1 and 2 are P2SH outputs worth 206'496 satoshis each and output 3 is a P2PKH output worth 68'346'341 satoshis.</p>
<p>As I wrote in my <a href="https://bitcoin.stackexchange.com/a/117519/5406">previous answer</a> to you, not <a href="https://bitcoin.stackexchange.com/a/112659/5406">all output types</a> have addresses. One of the types that does not have addresses are <code>null_data</code> outputs aka <code>OP_RETURN</code> outputs.</p>

CC BY-SA 4.0
2023-03-08T23:00:52.280Z
2023-03-08T23:07:34.407Z
2023-03-08T23:07:34.407Z
Murch
<blockquote>
<p>All this to ask, my question is what is the meaning of &quot;value&quot;?</p>
</blockquote>
<p>According to <a href="https://en.bitcoin.it/wiki/Transaction#General_format_.28inside_a_block.29_of_each_output_of_a_transaction_-_Txout" rel="nofollow noreferrer">https://en.bitcoin.it/wiki/Transaction#General_format_.28inside_a_block.29_of_each_output_of_a_transaction_-_Txout</a>
the &quot;value&quot; key indicates the amount of Satoshis in an output. Assuming your data is txouts this is the same &quot;value&quot; key representing Satoshi amount.</p>

CC BY-SA 4.0
2023-03-08T22:48:56.507Z
2023-03-08T22:48:56.507Z
Poseidon
<p>I am feeding network data to pybtc.Transactions. What I do is I take tx messages (which I understand to only contain a single transaction) and I feed them into pybtc.Transaction but only after removing the first 24 bytes.</p>
<p>This seems to work, however, I sometimes cannot parse the data. As far as I can tell the data comes in two forms:
form 1</p>
<pre><code>{
  0: {
    'value': 472100, 
    'scriptPubKey': b'v\xa9\x14K\xf1p;\xfc\x01\x1c\xd3\x91\xf9\n\xc9,\xde\xef\x13\x01\xcc\x13\xfa\x88\xac', 
    'nType': 0, 
    'type': 'P2PKH', 
    'addressHash': b'K\xf1p;\xfc\x01\x1c\xd3\x91\xf9\n\xc9,\xde\xef\x13\x01\xcc\x13\xfa', 
    'reqSigs': 1
    }, 
  1: {
    'value': 72978592, 
    'scriptPubKey': b'\x00\x14\xce}{W\xb1\xb4m\xbfH\xf7v?\xb7\x86\xdf\xf6\x9b{\xa0\xdd', 
    'nType': 5, 
    'type': 'P2WPKH', 
    'addressHash': b'\xce}{W\xb1\xb4m\xbfH\xf7v?\xb7\x86\xdf\xf6\x9b{\xa0\xdd', 
    'reqSigs': 1
    }
}
</code></pre>
<p>form 2</p>
<pre><code>{
  0: {
    'value': 12007, 
    'scriptPubKey': b'jLPX2[z\x1cm\xdb\xf0\x00\xc8\x0f\xe6\xa8\x1e^\xabE\xf0\xed\x17:\xacYA\xc2\x13~&gt;4\xb7\x8e\xf81~\t\xf6\x81 +S\r\xaeX\xb5\xcc\xde\n\xb1\xef\xf7\xd3\xce\xf8\xc6\xa6\xc0B\x85\x85.##w\x85\xcf`\xc8\x00\x0b\xdf\xa3\x00C\x00\x0b\xdd\x19\x00L*', 
    'nType': 3, 
    'type': 'NULL_DATA'
    }, 
  1: {
    'value': 206496, 
    'scriptPubKey': b'\xa9\x14\x031\xa9\xde\x93\x13\x9d\x14\x7f\x01\x00\xf3rwI\x9e\x8dn\x91\x81\x87', 
    'nType': 1, 
    'type': 'P2SH', 
    'addressHash': b'\x031\xa9\xde\x93\x13\x9d\x14\x7f\x01\x00\xf3rwI\x9e\x8dn\x91\x81', 
    'reqSigs': None
    }, 
  2: {
    'value': 206496, 
    'scriptPubKey': b'\xa9\x14\xf7\x17\x84{K\x9b2\xfe\x17\xc0`\xb1v\xee\x81\xf4\x05p6\xbe\x87', 
    'nType': 1, 
    'type': 'P2SH', 
    'addressHash': b'\xf7\x17\x84{K\x9b2\xfe\x17\xc0`\xb1v\xee\x81\xf4\x05p6\xbe', 
    'reqSigs': None
    }, 
  3: {
    'value': 68346341, 
    'scriptPubKey': b'v\xa9\x14\x99=\xdf\xac\x9bQ\xa0h\xb4\xeb\x98:Q/\x10\xd9\xd5\x04\x9a\xe9\x88\xac', 
    'nType': 0, 
    'type': 'P2PKH', 
    'addressHash': b'\x99=\xdf\xac\x9bQ\xa0h\xb4\xeb\x98:Q/\x10\xd9\xd5\x04\x9a\xe9', 
    'reqSigs': 1
    }
}
</code></pre>
<p>As far as I can tell, the only difference between them is the presence of <code>addressHash</code> but, for form 2 addressHash is actually present in dictionaries with keys greater than 0.</p>
<p>All this to ask, my question is what is the meaning of &quot;value&quot;? Is it the amount transacted? Additionally, if at all possible, could anyone break down the meaning behind these other fields?</p>

CC BY-SA 4.0
2023-03-08T22:41:24.553Z
Could you please add the original tx message you started with? Also please the txid of the transaction you are looking at, so we can take a look.
Murch
CC BY-SA 4.0
2023-03-09T00:51:59.570Z
Also, just looking at the transactions on a block explorer may be insightful
Murch
<output><op-return>
Can someone break down what is returned by pybtc?
bitcoinluvr6969
# Can someone break down what is returned by pybtc?

(Asked by: username_0 on 2023-03-08)

I am feeding network data to pybtc.Transactions. What I do is I take tx messages (which I understand to only contain a single transaction) and I feed them into pybtc.Transaction but only after removing the first 24 bytes.

This seems to work, however, I sometimes cannot parse the data. As far as I can tell the data comes in two forms:
form 1

```
{
  0: {
    'value': 472100, 
    'scriptPubKey': b'v\xa9\x14K\xf1p;\xfc\x01\x1c\xd3\x91\xf9\n\xc9,\xde\xef\x13\x01\xcc\x13\xfa\x88\xac', 
    'nType': 0, 
    'type': 'P2PKH', 
    'addressHash': b'K\xf1p;\xfc\x01\x1c\xd3\x91\xf9\n\xc9,\xde\xef\x13\x01\xcc\x13\xfa', 
    'reqSigs': 1
    }, 
  1: {
    'value': 72978592, 
    'scriptPubKey': b'\x00\x14\xce}{W\xb1\xb4m\xbfH\xf7v?\xb7\x86\xdf\xf6\x9b{\xa0\xdd', 
    'nType': 5, 
    'type': 'P2WPKH', 
    'addressHash': b'\xce}{W\xb1\xb4m\xbfH\xf7v?\xb7\x86\xdf\xf6\x9b{\xa0\xdd', 
    'reqSigs': 1
    }
}

```

form 2

```
{
  0: {
    'value': 12007, 
    'scriptPubKey': b'jLPX2[z\x1cm\xdb\xf0\x00\xc8\x0f\xe6\xa8\x1e^\xabE\xf0\xed\x17:\xacYA\xc2\x13~>4\xb7\x8e\xf81~\t\xf6\x81 +S\r\xaeX\xb5\xcc\xde\n\xb1\xef\xf7\xd3\xce\xf8\xc6\xa6\xc0B\x85\x85.##w\x85\xcf`\xc8\x00\x0b\xdf\xa3\x00C\x00\x0b\xdd\x19\x00L*', 
    'nType': 3, 
    'type': 'NULL_DATA'
    }, 
  1: {
    'value': 206496, 
    'scriptPubKey': b'\xa9\x14\x031\xa9\xde\x93\x13\x9d\x14\x7f\x01\x00\xf3rwI\x9e\x8dn\x91\x81\x87', 
    'nType': 1, 
    'type': 'P2SH', 
    'addressHash': b'\x031\xa9\xde\x93\x13\x9d\x14\x7f\x01\x00\xf3rwI\x9e\x8dn\x91\x81', 
    'reqSigs': None
    }, 
  2: {
    'value': 206496, 
    'scriptPubKey': b'\xa9\x14\xf7\x17\x84{K\x9b2\xfe\x17\xc0`\xb1v\xee\x81\xf4\x05p6\xbe\x87', 
    'nType': 1, 
    'type': 'P2SH', 
    'addressHash': b'\xf7\x17\x84{K\x9b2\xfe\x17\xc0`\xb1v\xee\x81\xf4\x05p6\xbe', 
    'reqSigs': None
    }, 
  3: {
    'value': 68346341, 
    'scriptPubKey': b'v\xa9\x14\x99=\xdf\xac\x9bQ\xa0h\xb4\xeb\x98:Q/\x10\xd9\xd5\x04\x9a\xe9\x88\xac', 
    'nType': 0, 
    'type': 'P2PKH', 
    'addressHash': b'\x99=\xdf\xac\x9bQ\xa0h\xb4\xeb\x98:Q/\x10\xd9\xd5\x04\x9a\xe9', 
    'reqSigs': 1
    }
}

```

As far as I can tell, the only difference between them is the presence of `addressHash` but, for form 2 addressHash is actually present in dictionaries with keys greater than 0.

All this to ask, my question is what is the meaning of "value"? Is it the amount transacted? Additionally, if at all possible, could anyone break down the meaning behind these other fields?

**Tags:** output, op-return

> **Comments:**
> **username_1**: Could you please add the original tx message you started with? Also please the txid of the transaction you are looking at, so we can take a look.  
> **username_1**: Also, just looking at the transactions on a block explorer may be insightful  

---

## 3 answers

### Answer by username_2 on 2023-03-09. Score: 3 | Accepted answer

> **could anyone break down the meaning behind these other fields?**

Many of them are not explicitly present in the data but are inventions of pybtc that present you with an interpretation of some aspect of the data.

For example `type:p2pkh` is not a data item in the transaction data but is a label created by examination of the form of the scriptPubKey. It is an additional categorisation that represents the results of an assessment, it is not data present explicitly.

Consequently, if you want to *fully* understand the meaning and scope of these invented items, you would have to consult the pybtc author or its source code.

Parsers that invent data in a confusing attempt to be helpful is why I wrote my own parser. I think a parser should be clear about what is original data and what is additional interpretation.

---

The only "real" data items in that list are those labelled `value` and `scriptPubKey`, all the rest are inventions, commentary.

`Value` is the amount of money, expressed in units of Satoshi (10-8 Bitcoin), being sent to one "recipient".

`scriptPubKey` is the locking script that typically prevents anyone other than the intended recipient from subsequently spending this particular amount. It defines the spending conditions (if any). With scripts such as P2SH, I guess you could say it constrains rather than defines since the real conditions are not revealed until the amount is spent (if at all).

Additionally, Python's bytes literals are a particularly noisy and unhelpful way of presenting Bitcoin scripts. I think pybtc's author should have chosen to show them as hexadecimal. If I wanted to show readable text embedded in a script I would use something like canonical hexdump format or something close to the algorithm used by Unix `strings`.

---

I can only guess at the inventions:

`type` appears to be a categorisation of the pattern of `scriptPubKey`

`nType` is probably a numeric code for `type`

`addressHash` is the middle portion of `scriptPubKey`

`reqsigs` presumably attempts to guess the value of `n` in an `n of m` multisig output - or attempts to assign a sensible value in other circumstances.

> **Comments:**
> **username_1**: Excellent answer!  

---

### Answer by username_1 on 2023-03-08. Score: 2

Transactions may have many inputs and many outputs. I assume you extracted the output list from some transactions.

The “form1” dictionary has two entries with the keys 0 and 1. Entry 0 is a P2PKH output worth 472'100 satoshis, entry 1 is a P2WPKH output worth 72'978'592 satoshis (i.e. 0.729'785'92 ₿).

The “form2” dictionary has four entries, naturally with the keys 0–3. Entry 0 is a `null_data` output that burns 12'007 satoshis, outputs 1 and 2 are P2SH outputs worth 206'496 satoshis each and output 3 is a P2PKH output worth 68'346'341 satoshis.

As I wrote in my [previous answer](https://bitcoin.stackexchange.com/a/117519/5406) to you, not [all output types](https://bitcoin.stackexchange.com/a/112659/5406) have addresses. One of the types that does not have addresses are `null_data` outputs aka `OP_RETURN` outputs.


---

### Answer by username_3 on 2023-03-08. Score: 0

> All this to ask, my question is what is the meaning of "value"?

According to <https://en.bitcoin.it/wiki/Transaction#General_format_.28inside_a_block.29_of_each_output_of_a_transaction_-_Txout>
the "value" key indicates the amount of Satoshis in an output. Assuming your data is txouts this is the same "value" key representing Satoshi amount.


---

