Information Security Consultant @ Blit-Tech
Software Developer @ Shelter Insurance
Email: nabil@blit.tech
A Bitcoin Transaction is a record assigning the outputs of a previous transaction to new outputs based on the Transaction Script
Size | Name | Type | Description |
---|---|---|---|
4 | version | uint32 | Version Number |
0 or 2 | flags | uint8[2] | Optional and always 0001 |
1 to 9 | tx_in count | var_int | Number of Input Transactions |
Varies | tx_in | Input Transactions | Specifies prev. output and signature script |
1 to 9 | tx_out count | var_int | Number of Outputs |
Varies | tx_out | Output Transaction | The Output Transactions |
4 | lock_time | uint32 | Currently always 0. |
Size | Name | Type | Description |
---|---|---|---|
36 | prev_output | outpoint | 32 byte ID of the previous transaction + 4 byte index of specific output |
1 to 9 | script length | var_int | The length of the Signature Script |
Varies | signature script | uchar[] | Script that confirms the specified output's script |
4 | sequence | uint32 | Currently not used |
Size | Name | Type | Description |
---|---|---|---|
8 | value | int64 | The output's value |
1 to 9 | script length | var_int | The length of the pk_script |
Varies | pk_script | uchar[] | Script setting up the conditions that allow the coin to spent |
<Sig> <PubKey>
OP_DUP OP_HASH160 <PubkeyHash> OP_EQUALVERIFY OP_CHECKSIG
<Sig> <PubKey> OP_DUP OP_HASH160 <PubkeyHash> OP_EQUALVERIFY OP_CHECKSIG
<Sig> <PubKey> <PubKey> OP_HASH160 <PubkeyHash> OP_EQUALVERIFY OP_CHECKSIG
<Sig> <PubKey> <PubkeyHash> <PubkeyHash> OP_EQUALVERIFY OP_CHECKSIG
<Sig> <PubKey> OP_CHECKSIG
TRUE
<sig> <redeemScript>
OP_HASH160 <Hash160(redeemScript)> OP_EQAL
Any standard script can be used as the redeemScript
OP_0 <sig A> [sig B] [sig C...]
<m> <A pk> [B pk] [C pk..] <n> OP_CHECKMULTISIG
<sig>
<pubkey> OP_CHECKSIG
No Signature Script since the transaction is not spendable
OP_RETURN <0 to 40 bytes of data>
A wallet's Bitcoins are just the UTxO in the block chain that the wallet is allowed to spend