Transaction
A Bitcoin transaction records the movement of bitcoin from one user to another. Each transaction is documented on the blockchain, within data groups called blocks. To send or receive bitcoin, most people use wallets—these handle the complex technical details, letting users simply enter a recipient's address and an amount to send.
Once a transaction is created, it gets broadcast to the Bitcoin network. Network nodes collect new, unconfirmed transactions into a temporary pool known as the mempool. Miners then select transactions from the mempool to include in a new block. When a transaction makes it into a block, it’s considered confirmed. For high-value transfers, waiting for six or more block confirmations is generally seen as secure.
A transaction has three main parts: inputs, outputs, and digital signatures. Inputs represent the bitcoin being spent; these are known as UTXOs (Unspent Transaction Outputs). Outputs direct specific amounts of bitcoin to other addresses, creating new UTXOs for the recipients. A transaction can have multiple inputs and outputs, and to be valid, must include a digital signature proving that the sender owns the bitcoin being spent. This signature is generated with the sender’s private key.
Let’s look at an example. Alice controls a UTXO worth 1 BTC and wants to send Bob 0.4 BTC. She uses her 1 BTC UTXO as the input, and creates two outputs: 0.4 BTC to Bob, and 0.59 BTC back to herself. The difference—0.01 BTC—serves as the transaction fee and goes to the miner who includes the transaction in a block. Note, the fee isn’t explicitly listed as an output—the network infers it by subtracting the total outputs from the total inputs.
Finally, Alice signs the transaction using her private key. After the transaction is confirmed in a block, the original 1 BTC UTXO is destroyed and replaced by two new UTXOs: one for Bob with 0.4 BTC, and one for Alice with 0.59 BTC.
