Author

Topic: Bitcoin tx hash keys and hash160 (Read 139 times)

legendary
Activity: 2268
Merit: 18503
July 27, 2022, 05:24:50 AM
#6
Hash160 for a transaction == RIPEMD160(SHA256(publickey)).
There is no HASH160 of a transaction. RIPEMD160(SHA256(publickey)) gives a pubkeyhash, which is then used to encode a P2PKH address.

But note before before applying this hash functions you should have generated your private key using elliptic curve multiplication
Your private key is not generated using elliptic curve multiplication. Your private key is simply a random number, generated using a good source of entropy or derived from your seed phrase (which is in turn generated using a good source of entropy).
legendary
Activity: 3402
Merit: 10424
July 27, 2022, 12:27:25 AM
#5
In case you meant "How to find the hash160 of a public key", you have to add a version byte at the beginning of it (0x80, or mainnet), then hash it with SHA256, and hash it again with RIPEMD160.
HASH160 of a public key is RIPEMD160 of SHA256 of public key itself without anything added to it.

When we are trying to get the base58 address of that hash (in this case P2PKH address) we prepend the version byte to the hash before encoding it.
legendary
Activity: 1568
Merit: 6660
bitcoincleanup.com / bitmixlist.org
July 27, 2022, 12:20:04 AM
#4
In case you meant "How to find the hash160 of a public key", you have to add a version byte at the beginning of it (0x80, or mainnet) (this is actually done last before encoding, [thanks @pooya87]), then hash it with SHA256, and hash it again with RIPEMD160.
legendary
Activity: 3402
Merit: 10424
July 26, 2022, 11:21:39 PM
#3
Hi I’m having trouble finding the hash keys and hash160 for a tx. Can anyone explain how to find hash keys and hash160 for a given tx?
For starters transactions don't have anything called "hash keys" or "hash160".

Each transaction has a hash that is used as the "transaction ID" which is the result of computing SHA256d of the stripped transaction (removed witnesses). And a "witness transaction ID" that is computed by finding SHA256d of the whole transaction.

Each transaction has at least one output that contains a script and in that script we may or may not have a hash which may or may not be using HASH160 of the public key or a redeem script. It may instead contain the public key itself, tweaked public key, SHA256 hash of redeem script, etc.
legendary
Activity: 3206
Merit: 2904
Block halving is coming.
July 26, 2022, 07:38:07 PM
#2
I don't know exactly what you are trying to achieve here but there are some Bitcoin tools that you can use to convert them to hash keys and hash160.
Not for TX(transaction) but for Bitcoin address/public key to convert them into hash160.

Here are the tools that I'm talking about below.

- https://bitcoin.fo/tools.php
newbie
Activity: 1
Merit: 0
July 26, 2022, 06:43:07 PM
#1
Hi I’m having trouble finding the hash keys and hash160 for a tx. Can anyone explain how to find hash keys and hash160 for a given tx?
Jump to: