A transaction is a small packet of data
A transaction has four parts:
- Version — which rules to read it by.
- Inputs — the UTXOs being spent. Each gives the previous transaction’s ID and output index, plus the signature and public key that unlock it.
- Outputs — the new UTXOs. Each holds an amount and a locking script stating how it can be spent.
- Locktime — “do not include before this height (or time).” Usually 0.
The fee is not written anywhere: inputs minus outputs is the fee.
Unfold one that just landed
Below is a real transaction from a recent Mobick block — not a block reward, but a payment between people. Tap inputs and outputs.
Inputs — UTXOs spent
Outputs — new UTXOs
Tap an input or output to see its script explained.
Locks and keys
An output’s locking script is a tiny program. The common 1… address (P2PKH) reads:
OP_DUP OP_HASH160 <20-byte public-key hash> OP_EQUALVERIFY OP_CHECKSIG
“Show a public key. Its hash must equal these 20 bytes. Then check the signature with it.” The next transaction’s input supplies the signature and key; nodes run them through the script. If it passes, the UTXO is spent; if anything fails, the whole transaction is refused.
Motion explainer How nodes check a spend
Right public key, copied signature: This transaction…
Explainer How nodes check a spend
1 / 4 · The lock
An output is locked to the receiver’s public-key hash — “Bring the public key that hashes to this, and a signature made with it.”
89ab…3f locked
2 / 4 · The key
The spending transaction shows a signature and the public key — and nodes check two things, in order
Both pass — the coin is spent — If either fails, the whole transaction is refused
89ab…3f spent
Does the public key hash to 89ab…3f?
✓
Checked with that key, does the signature fit this transaction?
✓
3 / 4 · Predict
Someone shows the right public key, but a signature copied from an older, different transaction.
Think first, then show the answer
Answer: it is refused.
Check ① passes, but — the signature is bound to the original transaction, so ② fails
The whole transaction is refused — The coin stays locked
89ab…3f still locked
Does the public key hash to 89ab…3f?
✓
Checked with that key, does the signature fit this transaction?
✗
4 / 4 · So
Without the private key, nobody can spend this coin — Every node checks every transaction this way
89ab…3f still locked
Does the public key hash to 89ab…3f?
✓
Checked with that key, does the signature fit this transaction?
✗
Read the script — full text
- The lock. An output is locked to the receiver's public-key hash. The lock says: bring the public key that hashes to this, and a signature made with it.
- The key. When a transaction wants to spend this coin, it shows a signature and the public key. Nodes then check two things, in order. First, does the public key hash to the locked value? Second, checked with that key, does the signature fit this transaction? Both pass, so the coin is spent. If either check fails, the whole transaction is refused.
- Predict. Your turn to predict. Someone shows the right public key, but a signature copied from an older, different transaction. What happens? Answer: it is refused. The first check passes, but the signature is bound to the original transaction, so the second check fails. So the whole transaction is refused, and the coin stays locked.
- So. Without the private key, nobody can spend this coin. Every node checks every transaction this way.
The narration is synthesized speech.
bc1q… addresses (P2WPKH) do the same but carry the signature and key in the input’s separate witness. Witness data is weighted less, so the same transaction has a smaller virtual size (vB) and pays less — why the transaction box shows both bytes and vB.
Summary
- Transaction = version + inputs (UTXOs spent, with signatures) + outputs (amounts with locking scripts) + locktime.
- A locking script is a small program saying “only the owner of this key hash may spend.”
- Fee = inputs − outputs; miners choose by fee rate (sat/vB).
Check yourself
Get them right to add a block to your chain
-
Q1What does a transaction input contain?
An input says which UTXO is spent and proves ownership. Recipients and amounts live in outputs.
-
Q2What does a P2PKH locking script require?
OP_DUP OP_HASH160 <20 bytes> OP_EQUALVERIFY OP_CHECKSIG — only the holder of that address’s private key can open it.
Sources
Found a mistake or a policy that changed? Tell us by email →