Bitcoin Transactions: A Comprehensive Guide to On-Chain Transfers

·

Understanding Bitcoin Transactions

A transaction represents the transfer of Bitcoin value across the network, eventually recorded in blocks. These transactions reference previous outputs as inputs, allocating Bitcoin values to new outputs. Unlike encrypted data, Bitcoin transactions are transparent—anyone can examine them once they're included in a block. After sufficient confirmations, transactions become irreversible.

Key Features of Bitcoin Transactions

👉 Explore Bitcoin transactions in depth

Structure of a Bitcoin Transaction

Below is the standard format of a Bitcoin transaction within a block:

FieldDescriptionSize
Version noTypically 1 (2 for OP_CHECKSEQUENCEVERIFY timelocks)4 bytes
FlagIndicates Segregated Witness data (0001 if present)Optional 2 bytes
In-counterNumber of inputs (VarInt)1–9 bytes
List of inputsReferences to previous transaction outputsVariable
Out-counterNumber of outputs (VarInt)1–9 bytes
List of outputsNew Bitcoin allocation instructionsVariable
WitnessesSegWit validation data (if applicable)Variable
Lock_timeBlock height/timestamp for finalization4 bytes

Note: Version 0 transactions are undefined, while versions >2 are reserved for future use.

Transaction Inputs and Outputs

Example: Single-Input Transaction

Input:
  Previous tx: f5d8...b9a6 (50 BTC source)
  Index: 0
  scriptSig: [Signature + Public Key]

Output:
  Value: 5000000000 satoshis (50 BTC)
  scriptPubKey: [Recipient's address conditions]

Verification Process

  1. The input's scriptSig executes, leaving data on the stack.
  2. The referenced output's scriptPubKey uses this data to validate the transaction.
  3. If scriptPubKey returns true, the input is authorized.

Types of Bitcoin Transactions

1. Pay-to-PubkeyHash (P2PKH)

2. Pay-to-Script-Hash (P2SH)

👉 Learn advanced Bitcoin scripting

Mining and Generation Transactions

Transaction Components in Detail

Input Format (Txin)

FieldDescriptionSize
Previous TX HashHash of the referenced transaction32 bytes
Previous Txout-indexOutput index in the referenced TX4 bytes
ScriptSigUnlocking scriptVariable
Sequence_noUsed for lock_time transactions4 bytes

Output Format (Txout)

FieldDescriptionSize
ValueSatoshis to transfer8 bytes
ScriptPubKeyLocking script conditionsVariable

FAQs About Bitcoin Transactions

How long does a Bitcoin transaction take?

Can I cancel a Bitcoin transaction?

What are transaction fees?

What is Segregated Witness (SegWit)?

Conclusion

Bitcoin transactions form the backbone of the network's operation, enabling secure, transparent value transfer. Understanding their structure—from inputs/outputs to scripting—empowers users to interact confidently with the blockchain. Whether you're sending P2PKH payments or multisig transactions, the principles remain grounded in cryptographic verification and decentralized consensus.

For further reading, explore Bitcoin scripting or raw transaction formatting.