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

1 Answer 1

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.

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.