1
Is there a "standard" Bitcoin transaction format?
The context is that I am putting together a tech talk to explain the blockchain concept to complete newbies, and I wanted to show the general structure of a transaction. However, I see different JSON document structures (different field names and content structure) returned by different sources, for the same transaction. For example, compare the output of the following 3 sources for Tx ID 90b18aa54288ec610d83ff1abe90f10d8ca87fb6411a72b2e56a169fdc9b0219
- https://blockexplorer.com/api/tx/90b18aa54288ec610d83ff1abe90f10d8ca87fb6411a72b2e56a169fdc9b0219
- https://blockchain.info/tx/90b18aa54288ec610d83ff1abe90f10d8ca87fb6411a72b2e56a169fdc9b0219?format=json
- https://cdn4.cryptocoinsnews.com/wp-content/uploads/2014/07/Bitcoin_tx_example.png
I know the image (#3) is showing only a subset but it has in and out arrays, and an input has a prev_out object with a hash string field. However, #1 (BlockExplorer) has vin and vout arrays, and the input does not have a prev_out object. It directly contains a string txid field with the hash of previous output transaction. There is yet another JSON structure in #2 (blockchain.info).
Is there an "official" or "standard" JSON structure of a transaction? If so, I would like to show that in my talk. Or what would be the recommended way to show a newbie what a Bitcoin transaction looks like?
1Note that
gettransactionis a wallet RPC, which shows the effects of a transaction on your own balance/wallet. This depends on which addresses are considered yours, labels/accounts, and other transactions. If you want a pure "decode" of the actual transaction data, use decoderawtransaction on the hex field. – Pieter Wuille – 2017-04-08T04:53:27.713