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 '
          '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?

1 Answer 1


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)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.