A transfer of Bitcoins from one Bitcoin user to another. Containing an embedded script, a Bitcoin transaction is created in a crypto wallet, residing in the user's computer, smartphone or tablet or in a cryptocurrency exchange. The transaction is published on the Bitcoin network where it is validated and added to the blockchain by a Bitcoin "miner." See Bitcoin wallet
and Bitcoin mining
UTXOs (Unspent Transaction Outputs)
A person's spendable Bitcoins are stored in data records known as "unspent transaction outputs" (UTXOs), and a single UTXO can contain any amount of Bitcoin. Unlike a bank account balance, which is a single amount, a user's Bitcoin balance is like having cash in different drawers throughout the house. The sum of all the money in the drawers is the spendable balance. In the case of Bitcoin, the sum of all UTXOs for a given user is that person's coin balance. The UTXO database resides in a full Bitcoin node on the blockchain.
Either a wallet or a third-party service maintains a database of UTXOs identified by the user's private key. To spend Bitcoin means looking for available UTXOs and selecting denominations that make up the required amount to send to the recipient. Just like paper money, each UTXO is indivisible. Therefore, if UTXO inputs are larger than the amount to be paid, change is made in the form of a new UTXO, the same as buying something for $6 with a $10 bill and getting $4 in change.
The UTXO Database Contains All the Bitcoins
Known as the UTXO set or UTXO database, all the UTXOs on the blockchain represent the total number of Bitcoins in existence. The UTXOs are constantly changing as coins are sent from one user to another.
Transactions Have Inputs and Outputs
Transaction inputs are the UTXOs being used, and transaction outputs are the UTXO payment to the recipient plus any change (see illustration below). The difference between inputs and outputs is the fee, which miners collect for doing the work (see Bitcoin mining
and coinbase transaction
Unlocking and Locking Scripts
A script in the Bitcoin transaction unlocks the input UTXOs by verifying their digital signatures. A locking script sets the conditions for how the output UTXOs can be spent; for example, they may have to wait for 30 days. See digital signature
, Bitcoin node
Alice Sends Bob Five Bitcoins
Alice has four UTXOs totalling 23 Bitcoins (23 BTC). Her wallet generates a transaction with inputs worth 6 BTC and outputs 5 BTC to Bob along with .99 BTC back to Alice. The .01 difference is the transaction fee. Short numbers are used in this example to simplify the concept. Real transactions use Bitcoin fractions (see Satoshi
Following are the different ways Bitcoin transactions are formatted.
Bech32 for Segregated Witness
In 2017, Bitcoin adopted the SegWit protocol, which enabled faster validation, among other enhancements. The SegWit native transaction is Bech32, and crypto wallets that support SegWit generally incur lower fees. The Bech32 name was derived from BCH encoding and 32 characters (see BCH code
). See SegWit
and Bitcoin hard fork
P2PK - Pay to Public Key
The first type of Bitcoin transaction paid to a public key. Subsequent transaction types obscured the public key by hashing it so that future quantum computers cannot generate the private key from the public key (see quantum secure
). See HASH160
P2PKH - Pay to a Public Key Hash
P2PKH is the common format that pays to a hashed Bitcoin address. P2WPKH is the SegWit version.
P2SH - Pay to Script Hash
P2SH supports advanced features such as when multiple signatures are required to authorize a payment. P2WSH is the SegWit version.
P2SH (P2WPKH) - Pay to SegWit Public Key Hash
Native SegWit wrapped in a P2SH transaction.
P2TR - Pay to Taproot
In late 2021, Bitcoin adopted the Taproot protocol for more privacy and efficiency. See Taproot
Touted as the most secure crypto wallet, Mycellium supports three address formats. When first started, it defaults to P2SH (top), which is "SegWit compatible." After tapping the QR code for Bech32, "SegWit native" is selected and finally P2PKH.