A Bitcoin transaction moves value by consuming UTXOs and creating new ones. Wallets, Lightning channels, and exchanges eventually serialize to this structure.
Complete Step 1 // Required reading in the study plan above, then continue here.
Step 2 — Core idea: fields, fees, sighash
If you cannot read a raw transaction, debugging stuck payments, wrong fees, or bad scripts becomes guesswork.
Analogy: A signed instruction — “Take these coins (inputs) and lock them under these new conditions (outputs).” Miners include it in a block; nodes verify signatures and rules.
Core fields:
- version
- inputs: previous txid + vout, scriptSig/witness, sequence
- outputs: value + scriptPubKey
- locktime
SegWit moves signatures into the witness, changing fee measurement to weight/vbytes.
Loading diagram…
A signature commits to a sighash — a digest of (parts of) the transaction. Finalize amounts and outputs before signing; PSBT exists for multi-party construction. Most wallets commit to all inputs and outputs so the signed tx cannot be altered meaningfully.
const feeSats = Math.ceil(feeRateSatPerVb * vsize);
// Fee = sum(inputs) − sum(outputs)SegWit txs are priced by weight / vbytes, not legacy serialized size alone.
Done when: You can label vin, vout, and fee on a decoded tx and explain why post-sign edits break signatures.
Step 3 — Try it: decode + send (lab)
Walk the Decoding Bitcoin lifecycle and decoder modules. Then on regtest:
bitcoin-cli -regtest generatetoaddress 101 "$(bitcoin-cli -regtest getnewaddress)"
TXID=$(bitcoin-cli -regtest sendtoaddress "$(bitcoin-cli -regtest getnewaddress)" 0.5)
bitcoin-cli -regtest getrawtransaction "$TXID" trueIdentify vin/vout, fees, and scripts. Trace which UTXOs were consumed and which new locks were created. Optional drills: transaction exercises.
Common mistakes
- Changing outputs after signing (invalidates signatures)
- Mixing mainnet txids into regtest experiments
- Forgetting change outputs
Done when: Lab evidence (decoder notes + getrawtransaction JSON + observation sentence) is complete.
Next lesson
Bitcoin Script — the language that defines how outputs can be unlocked.