Post
Topic
Board Development & Technical Discussion
Re: invalid transactions
by
DeathAndTaxes
on 28/05/2014, 00:16:34 UTC
Oh, ok, maybe this was a false assumption I made. I thought the transaction output included the destination address too, but maybe that is not the case, it is only the script that decides who can spend it. Which would make more sense, and reading the bitcoin protocol specification seems to confirm this. https://en.bitcoin.it/wiki/Protocol_specification

How do websites, such as webbtc, display the output address? I am guessing they must parse the script and find the hash value. Does that even make sense? e.g. is it possible to take the hash from output script, say 024a0102c5952538e6aab7cddb9e2659bd47e206, and turn that into a bitcoin address of 1D71GZ463FU4accU2GAdz9DT1XoLGqPWK?

Yes.  An address is a PubKeyHash* with version and checksum encoded in Base58 format.  You can convert between hashes and addresses in either direction.  There are no addresses anywhere in the blockchain or txs.  Anytime you see an address it is a hash which has been encoded into a format that is easier to humans.   When you enter an address into a client to "send coins" the address is first validated (good checksum, version, and pubkeyhash length) and then the PubKeyHash extracted to be used in the tx being created.


* or ScriptHash in the case of P2SH.