<p><code>addressHash</code> is the data output by pybtc. The data is a hash of the public key or script. It is contained in the address. And also parts of scriptPubkey(locking script).</p>
<ul>
<li>For P2PKH and P2WPKH, it is <code>Hash160(public key)</code></li>
<li>For P2SH, it is <code>Hash160(script)</code></li>
<li>For P2WSH, it is <code>SHA256(script)</code></li>
</ul>

CC BY-SA 4.0
2021-09-29T08:12:49.040Z
2021-09-29T08:12:49.040Z
Shigeyuki Azuchi
<p>I'm listening to a ZMQ socket; it's sending out messages every time my node receives a transaction. The message is the binary value of the transaction itself. When I decode the binary (using a tool in a python library, pybtc.Transaction), I get the string representing the entire transaction. The following is a snippet, the &quot;vOut&quot; or output section of the transaction.</p>
<pre><code>'vOut': {0: {'address': '1EczJfLziUwBs1ry8Mz7KrTioP6tN8hZXi',
          'addressHash': '9568077c57227466e52e61ae12686acaadfff861',
          'nType': 0,
          'reqSigs': 1,
          'scriptPubKey': '76a9149568077c57227466e52e61ae12686acaadfff86188ac',
          'scriptPubKeyAsm': 'OP_DUP OP_HASH160 OP_PUSHBYTES[20] '
                             '9568077c57227466e52e61ae12686acaadfff861 '
                             'OP_EQUALVERIFY OP_CHECKSIG',
          'scriptPubKeyOpcodes': 'OP_DUP OP_HASH160 [20] OP_EQUALVERIFY '
                                 'OP_CHECKSIG',
          'type': 'P2PKH',
          'value': 500000},
</code></pre>
<p>You'll see the first two fields of the index-0 output are 'address' and 'addressHash'. My (loose, highlevel) understanding of an address is that it is, literally, the hash of the unlocking script. (The unlocking script? Is that what we see in the 'scriptPubKeyASM' field?). What then, is the addressHash?</p>

<transactions><bitcoind><protocol><transaction-verification>
What's the difference between an 'address' and an 'addressHash' in a transaction on a bitcoind node?
PhlipPhlops
# What's the difference between an 'address' and an 'addressHash' in a transaction on a bitcoind node?

(Asked by: username_0 on 2021-09-29)

I'm listening to a ZMQ socket; it's sending out messages every time my node receives a transaction. The message is the binary value of the transaction itself. When I decode the binary (using a tool in a python library, pybtc.Transaction), I get the string representing the entire transaction. The following is a snippet, the "vOut" or output section of the transaction.

```
'vOut': {0: {'address': '1EczJfLziUwBs1ry8Mz7KrTioP6tN8hZXi',
          'addressHash': '9568077c57227466e52e61ae12686acaadfff861',
          'nType': 0,
          'reqSigs': 1,
          'scriptPubKey': '76a9149568077c57227466e52e61ae12686acaadfff86188ac',
          'scriptPubKeyAsm': 'OP_DUP OP_HASH160 OP_PUSHBYTES[20] '
                             '9568077c57227466e52e61ae12686acaadfff861 '
                             'OP_EQUALVERIFY OP_CHECKSIG',
          'scriptPubKeyOpcodes': 'OP_DUP OP_HASH160 [20] OP_EQUALVERIFY '
                                 'OP_CHECKSIG',
          'type': 'P2PKH',
          'value': 500000},

```

You'll see the first two fields of the index-0 output are 'address' and 'addressHash'. My (loose, highlevel) understanding of an address is that it is, literally, the hash of the unlocking script. (The unlocking script? Is that what we see in the 'scriptPubKeyASM' field?). What then, is the addressHash?

**Tags:** transactions, bitcoind, protocol, transaction-verification


---

## 1 answers

### Answer by username_1 on 2021-09-29. Score: 2

`addressHash` is the data output by pybtc. The data is a hash of the public key or script. It is contained in the address. And also parts of scriptPubkey(locking script).

* For P2PKH and P2WPKH, it is `Hash160(public key)`
* For P2SH, it is `Hash160(script)`
* For P2WSH, it is `SHA256(script)`


---

