Understanding Bitcoin Transactions

  1. A transaction output is an indivisible unit, meaning you cannot divide an output into parts and spend one of the parts
  2. When a UTXO is spent, it cannot be spent again.
Example transaction from Mastering Bitcoin 2nd Edition
  • vout contains the list of outputs. Each output is a UTXO containing a value and a locking script: scriptPubKey. A locking script is a spending condition that must be satisfied in order to spend the UTXO. This prevents anyone random from trying to spend the UTXO. One would need another script called the unlocking script to “solve” or satisfy, this UTXO — more on this topic below.
  • vin contains the list of inputs. An input is a reference (pointer) to another transaction. Each transaction has a unique identifier, txid which is calculated by taking the hash of the transaction object. vout specifies the specific output of that transaction. So with txid and vout, the desired UTXO is then known. An additional lookup by the wallet is needed to retrieve the UTXO from the txid. scriptSig is the unlocking script that is needed to spend the referenced UTXO.
<Alice’s Digital Signature> <Alice’s Public Key>
  1. It prevents the current transaction from being modified. If the transaction gets modified, the value in the scriptSig won’t match.
  2. The signature proves that the owner of the private key, is in fact the owner of the UTXO that they are willing to spend.
<Alice's Digital Signature> <Alice's Public Key> OP_DUP OP_HASH160
  • Higher degree of privacy: If a user uses a new address for each transaction that they receive then it can be difficult to link wallets to each other.
  • Need to save more data: A transaction can produce multiple UTXO, all of which need to be saved as separate entities rather than simply storing a debit and credit.
  • Not simple: This model isn’t as easy to code and understand, especially once more complex scripts become involved. In fact, Ethereum implements the account model, to simplify writing smart contracts.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Market Update: COMP Special


Why our token sale has a $30M hard cap

A brief introduction to TRA Token Platform

Why ‘digital gold’ could be the new flight to safety in market shocks

Markets taking a u-turn, Bitcoin falls amongst the global selloff!

Become a blockchain developer on Ethereum

March Monthly Digest

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Tony Lu

Tony Lu

More from Medium

The Proof of Capacity Consensus Mechanism

Decoding the Bitcoin paper Part 2— Introduction, Transactions, and Timestamp server

Top 5 benefits of using Dithereum vs other blockchains

Oracles | Decentralized Data Warehouse and Empowering your Blockchain Beyond the Chain — by Kylin…