1
The description states:
A script hash is the hash of the binary bytes of the locking script (ScriptPubKey), expressed as a hexadecimal string. The hash function to use is given by the “hash_function” member of server.features() (currently sha256() only). Like for block and transaction hashes, when converting the big-endian binary hash to a hexadecimal string the least-significant byte appears first, and the most-significant byte last.
For example, the legacy Bitcoin address from the genesis block:
1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa has P2PKH script:
76a91462e907b15cbf27d5425399ebf6f0fb50ebb88f1888ac with SHA256 hash:
6191c3b590bfcfa0475e877c302da1e323497acf3b42c08d8fa28e364edf018b which is sent to the server reversed as:
8b01df4e368ea28f8dc0423bcf7a4923e3a12d307c875e47a0cfbf90b5c39161 By subscribing to this hash you can find P2PKH payments to that address.
Can anybody explain what are these numbers:
6191c3b590bfcfa0475e877c302da1e323497acf3b42c08d8fa28e364edf018b
8b01df4e368ea28f8dc0423bcf7a4923e3a12d307c875e47a0cfbf90b5c39161
and how to get them?
1Thanks a lot!!! One more question: we derived this number :
by adding a prefix
76a914and suffix88ac. What are these prefix and suffix? Do they depend on currency or something else? – melaxon – 2019-10-30T20:52:45.757It's not derived from
62e9..but its making a locking script using that pubkey, then encoding it. So you're seeing the base16 encoding of the script language. For example,bx script-encode "[62e907b15cbf27d5425399ebf6f0fb50ebb88f18]"yields the hash1462e907b15cbf27d5425399ebf6f0fb50ebb88f18(14...) andbx script-encode "dup hash160 equalverify checksig"yields76a988ac. The pubkey is already base16, of course. So there are your numbers. – tgunnoe – 2019-10-31T12:40:29.673