Bitcoin Forum
April 27, 2024, 02:52:16 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Bitcoin tx hash keys and hash160  (Read 140 times)
Btcdanny (OP)
Newbie
*
Offline Offline

Activity: 1
Merit: 0


View Profile
July 26, 2022, 10: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?
If you want to be a moderator, report many posts with accuracy. You will be noticed.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714186336
Hero Member
*
Offline Offline

Posts: 1714186336

View Profile Personal Message (Offline)

Ignore
1714186336
Reply with quote  #2

1714186336
Report to moderator
BitMaxz
Legendary
*
Offline Offline

Activity: 3234
Merit: 2943


Block halving is coming.


View Profile WWW
July 26, 2022, 11: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

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
pooya87
Legendary
*
Offline Offline

Activity: 3430
Merit: 10504



View Profile
July 27, 2022, 03:21:39 AM
Merited by o_e_l_e_o (4), ABCbits (3)
 #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.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
NotATether
Legendary
*
Offline Offline

Activity: 1582
Merit: 6688


bitcoincleanup.com / bitmixlist.org


View Profile WWW
July 27, 2022, 04:20:04 AM
Last edit: July 27, 2022, 04:33:54 AM by NotATether
 #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.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
pooya87
Legendary
*
Offline Offline

Activity: 3430
Merit: 10504



View Profile
July 27, 2022, 04: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.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
o_e_l_e_o
In memoriam
Legendary
*
Offline Offline

Activity: 2268
Merit: 18507


View Profile
July 27, 2022, 09: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).
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!