Why not use tackle in uncooked transaction as a substitute of public key bytes


In uncooked transaction, bitcoin utilizing bytes of the general public key, like:

Technically the uncooked transaction accommodates the Script, which often is written with Bitcoin script that may be a stack-based language. It could possibly comprise the PubKey within the previous scripts, like P2PK however the group is making a giant effort to maneuver the bitcoin customers to make use of the script that accommodates the hash of the general public key. The script like Pay-to-Public-Key-Hash (P2PKH) or pay-to-witness-public-key-hash (P2WPKH).

from the script, it’s attainable to calculate the tackle however not vice versa.

In conclusion, all of the addresses have a conversion like:

  • P2PK, P2PKH: Begin with 1.
  • P2SH: begin with 3.
  • P2WSH, P2WPKH: Begin with bc or with 3.

At this level, the reply ought to comprise a resume of all of the varieties of script and the way the script is constructed, and likewise an introduction to the not commonplace script that’s used extensively from the lightning community protocol.

However I believe an excellent abstract is inside these two chapters of the Bitcoin e book ‘Transactions’ and ‘Superior Transactions and Scripting’, I am unable to do higher


I am not a fan of principle, possibly you should use additionally this code instance to know how the script is transformed on a Bitcoin tackle.
Decompiler Bitcoin Script.

it’s only an instance of the conversion that might be performed.

The utilization of the instance code is described contained in the bash script run-decompiler.sh

An instance with the following block is the next ./Decompiler 76a914536ffa992491508dca0354e52f32a3a7a679a53a88ac

With the next end result

----------------------------------------| Outcomes |-----------------------------------
                               ###  Script PAY TO PUBLIC KEY HASH  ###                            
  Uncooked Script PubKey: 76a914536ffa992491508dca0354e52f32a3a7a679a53a88ac

OP_DUP OP_HASH160 536ffa992491508dca0354e52f32a3a7a679a53a OP_EQUALVERIFY OP_CHECKSIG
 The tackle: 18cBEMRxXHqzWWCxZNtU91F5sbUNKhL5PX
 The Hash160 pubkey: 536ffa992491508dca0354e52f32a3a7a679a53a
 The P2PSH tackle: 39JC9tvQ5CANbfuPgUZ4Zdc227m5uQnMRB


See the end result right here https://blockstream.information/tackle/18cBEMRxXHqzWWCxZNtU91F5sbUNKhL5PX

Please contemplate this instance for instance of code, I developed this to know how de script works. Can accommodates error. I’ll work to combine this in my mission and I’ll preserve this put up replace.

To reply at your remark that’s

Thanks. I take advantage of you the code linked, the the end result tackle codepad.org/nRJhvMC3 doesn’t match the anticipated tackle blockchain.com/btc/block/1 So what is the utilization of this Decompiler?

The decompiler takes the hex of the script and attempt to calculate the corresponding tackle if it’s a commonplace script.

Supply hyperlink

Leave a reply