Finding wallet address on peer 2 peer network

0

does anyone here knows how to find the addresses from a tx object from the bitcoin protocol documentation on the peer to peer network??

in the document it says that tx message is only consist of version, flag, tx_incount, tx_in, tx_out count , tx_out, tx_witnesses, lock_time. so i am starting to doubt if there is a way to do it only through p2p network.

if so how do website such as blockchain.info knows the subject of a transaction?

thanks in advance

nicholas___

Posted 2019-07-04T11:28:25.750

Reputation: 61

Answers

1

An address is a human construct, and is meaningless to the p2p protocol - The p2p protocol is only concerned with Bitcoin Scripts.

If you have a raw tx object, you can attempt to find the address for an output by checking if the locking script (scriptPubKey) field matches the format for a known p2sh, p2pkh, p2wpkh, or p2pk address.

If it does, you can follow the respective base58 or bech32 encoding methods to convert it to an address. If it does not, then you have a non-standard output that does not correspond to an address.

Raghav Sood

Posted 2019-07-04T11:28:25.750

Reputation: 15 741