MSTR Cat

Blockchain/Level II · Mechanics/2.2 Transactions/Lesson 2

Inputs and outputs

The anatomy of a transaction: outpoints, scripts, and the implicit fee

MaterialsA block explorer such as mempool.space or blockchain.comA calculator for summing satoshi values

Wonder

  1. How does a transaction prove it has the right to spend value that another transaction created?
  2. If there is no explicit field for fees, how do miners know exactly what they are being paid?
  3. Why is the first transaction in every block structurally unusual?

Explore

  1. A Bitcoin transaction is a data structure with a version number and an nLockTime, but its core consists of inputs and outputs. An input does not contain value; it points to one. Each input references a specific previous output using an outpoint: the 32-byte txid of the source transaction plus a 4-byte index identifying which output in that transaction is being spent. This reference links transactions into a chain.
  2. Every input also carries unlocking data and an nSequence field. The nSequence governs time-locks and replace-by-fee signals. The unlocking data, stored in scriptSig for legacy transactions or the witness section for SegWit, provides the cryptographic proof required to satisfy the conditions of the referenced output. This is where the private key’s signature lives.
  3. Outputs are where value resides. Each output specifies an amount in satoshis using an 8-byte integer and a locking script (scriptPubKey) that defines who can spend it later. A single transaction can have multiple inputs and outputs, but the sum of the inputs must be at least the sum of the outputs.
  4. The fee is not stored anywhere. It is derived: the difference between the total value consumed by the inputs and the total value created by the outputs. This remainder goes to the miner who includes the transaction in a block. If the sums were equal, the fee would be zero; if outputs exceeded inputs, the transaction would be invalid.
  5. The coinbase transaction is the exception that proves the rule. It has one special input with no previous outpoint, effectively creating new value from nothing. Its outputs carry the block subsidy (currently 3.125 BTC) plus all fees collected from other transactions in that block. The txid of any transaction is the double SHA-256 hash of its serialized data, excluding witness information.
  6. Open a block explorer and look up block 170, mined on 12 January 2009. Besides its coinbase, it holds one transaction: Satoshi Nakamoto sending 10 BTC to Hal Finney. Its single input spends the 50 BTC coinbase output of block 9. It has two outputs: 10 BTC to Finney and 40 BTC back to Satoshi. Inputs and outputs both total 50 BTC, so the fee is zero; early transactions often paid nothing, because blocks had ample room.

Key facts

  • An input references a previous output via an outpoint consisting of a txid and an output index.
  • The transaction fee is the difference between the sum of input values and the sum of output values.
  • Outputs contain an 8-byte value in satoshis and a locking script (scriptPubKey).
  • Inputs contain unlocking data (signature) and an nSequence field for time-locks or RBF signaling.
  • The coinbase transaction creates new bitcoins via a special input with no previous outpoint.
  • The txid is the double SHA-256 hash of the serialized transaction, excluding witness data.

Exercise nine, six, three, one

9CollectExamine 9 recent transactions on a block explorer. For each, record the number of inputs, the number of outputs, and the fee in satoshis.
6ClusterGroup the 9 into 6 by structure: one-in-one-out, one-in-two-out, many-in-one-out (consolidation), one-in-many-out (batch payment), many-in-many-out, or other.
3DistillReduce the 6 to 3 reasons a transaction has several inputs or several outputs.
1CrystallizeWrite 1 sentence on why Bitcoin can leave the fee implicit instead of stating it.

Fact check

Dates, figures and claims checked against the published sources listed below.

Open in the interactive academy →

PT ES ZH JA KO RU DE FR MS