Raw Bitcoin Transaction
Below is a sample raw Bitcoin transaction:
0100000002b9a2c28ea00905a5d24a172598b9574fbd973fc085df49901208a358d29a233b000000001716001415ff0337937ecadd10ce56ffdfd4674817613223f0ffffff8415e7099fba6d81474912d22eb5113bcdcfe45a4a1ae0c2701549a46326384f010000001716001415ff0337937ecadd10ce56ffdfd4674817613223f0ffffff02007daf01000000001976a91471a3d2f54b0917dc9d2c877b2861ac52967dec7f88ac2073f6010000000017a914423877331b30a905240c7e1f2adee4ebaa47c5f68700000000
When split into individual fields looks like this:
{
“version”: “01000000”,
“inputcount”: “02”,
“inputs”: [
{
“txid”: “b9a2c28ea00905a5d24a172598b9574fbd973fc085df49901208a358d29a233b”,
“vout”: “00000000”,
“scriptsigsize”: “17”,
“scriptsig”: “16001415ff0337937ecadd10ce56ffdfd4674817613223”,
“sequence”: “f0ffffff”
},
{
“txid”: “8415e7099fba6d81474912d22eb5113bcdcfe45a4a1ae0c2701549a46326384f”,
“vout”: “01000000”,
“scriptsigsize”: “17”,
“scriptsig”: “16001415ff0337937ecadd10ce56ffdfd4674817613223”,
“sequence”: “f0ffffff”
}
],
“outputcount”: “02”,
“outputs”: [
{
“amount”: “007daf0100000000”,
“scriptpubkeysize”: “19”,
“scriptpubkey”: “76a91471a3d2f54b0917dc9d2c877b2861ac52967dec7f88ac”
},
{
“amount”: “2073f60100000000”,
“scriptpubkeysize”: “17”,
“scriptpubkey”: “a914423877331b30a905240c7e1f2adee4ebaa47c5f687”
}
],
“locktime”: “00000000”
}
How to Decode Input Data from a Transaction?
When transactions are transmitted over the network or exchanged between applications, they are serialized. Serialization is most commonly used for encoding data structures for transmission over a network or for storage in a file. The serialization format of a transaction output is shown in Transaction output serialization. This article focuses on discussing steps to decode input data from a transaction.
Table of Content
- What is Serialization?
- Raw Bitcoin Transaction
- Format of Various Fields in Serialized Transaction
- Decoding the Transaction
- Detailed Explanation
- Verification
- Conclusion