- Blockchain By Example
- Bellaj Badr Richard Horrocks Xun (Brian) Wu
- 139字
- 2021-06-10 18:53:28
Transaction structure
At first sight, the previous resultant hexadecimal string seems ambiguous and meaningless. The following table breaks down and examines indepth our transaction, byte by byte:
As you can see, our transaction has one input (the only unspent transaction received from the faucet), with the 0791...252 transaction id, and two outputs:
- An OP_RETURN output with an OP_RETURN script
- An output sending one bitcoin to the specified address
The transaction structure can be visualized by decoding back the raw transaction using the deserialize command. If you run electrum --testnet deserialize <Raw transactions>, it will output a meaningful JSON representation of our constructed transaction:
To get the same result, you can decode the raw transaction using bitcoin-cli decoderawtransaction, or by using an online decoder such as the one at https://live.blockcypher.com/btc-testnet/decodetx/.