A Bitcoin transaction is a message your wallet sends to the network when you want to pay someone or move bitcoin between your own wallets. It specifies which previously received amounts to use and the conditions for spending the new ones. The network checks that you are authorized to make the transfer and are not sending more than is available. Pressing Send alone does not mean a payment has been confirmed.
You have one unspent amount of 100,000 sat and want to send 60,000 sat. A sat is bitcoin's smallest unit: 1 BTC contains 100,000,000 sat. Your wallet can prepare a transaction allocating 60,000 sat to the recipient, returning 39,000 sat to you, and leaving 1,000 sat as the miner's fee. It resembles paying with a larger banknote and receiving change. All of the original 100,000 sat is used, and two new amounts are created. The change usually goes to a new address in your wallet; it is not another payment to a stranger. The fee is the difference between the total amounts used and created, not a separate output. Omitting the change could unintentionally make the fee much too high. [2]
Bitcoin keeps track of unspent outputs of earlier transactions, or UTXOs. Think of them as individual amounts your wallet can use. An input of a new transaction points to one of these earlier outputs; a new output specifies an amount and the conditions for spending it next. Your wallet can combine several or split a payment among multiple recipients. An input therefore does not just say which address is sending: it contains the earlier transaction's identifier, txid, and that output's index number. This pair is called an outpoint. The referenced output must exist and be available to spend. It cannot be spent twice or counted through two inputs in the same transaction. [1] [2]
For a normal payment, the wallet creates a digital signature using a private key. The signature proves authority to make the transfer and can be checked without revealing the key. Spending conditions can also require several signatures or waiting until a certain time. Technically, the transaction supplies the necessary data in scriptSig and, where applicable, a separate witness section; nodes use this data to check the conditions of the output being spent. The SIGHASH setting determines which parts of the transaction the signature protects against changes. Even a valid signature cannot spend nonexistent funds, create a larger total amount, or bypass a time lock whose condition has not yet been met. [2]
After signing, the wallet broadcasts the transaction. Nodes check it and may place it in their mempool, a waiting area for unconfirmed transactions. Admission there is not yet inclusion in a block. The first confirmation comes when a valid block includes the transaction; each block built after it adds another. Rules for relaying and keeping pending transactions can vary between nodes and differ from the rules determining block validity. Another transaction spending the same funds may replace a pending one. Even a confirmation can disappear in a reorganization, when the network accepts a different valid branch of history. Check receipt in your own wallet on the correct network, including the amount, destination, and confirmations, rather than trusting someone else's screenshot. [4]
A wallet usually shows the txid, an identifier used to look up the transaction. Technically it is produced by applying SHA-256 twice to the transaction's encoding without witness data. A second identifier, wtxid, includes the witness; for a transaction with no witness, the two are equal. These values identify the record, but do not by themselves prove that a payment is confirmed. The fee mainly depends on the transaction's data size and the chosen rate, not the fiat value of the bitcoin sent. Fee rates use virtual size, vsize: the transaction's so-called weight divided by four and rounded up. Combining many small inputs can therefore cost more than transferring one larger amount. [3]
Inputs minus outputs equals the fee
If a normal transaction uses a total of 250,000 sat and allocates 248,200 sat to its recipients, including change, the remaining 1,800 sat is the miner's fee. It is not sent separately to a fee address.
For the clearest picture, read this entry together with UTXO, Private Key, Mempool, Transaction Fees, SegWit. The reverse links also lead from Bitcoin Whitepaper, Timechain / Blockchain, Full Node, UTXO.
01Can a confirmed Bitcoin transaction be reversed?+
Bitcoin has no Cancel button or administrator who can undo a confirmed transfer on request. To get the money back, the recipient usually needs to send a new transaction. That differs from a chain reorganization, in which a payment can temporarily lose confirmations. Each additional block increases the miners' work, or Proof of Work, needed to replace the history. More confirmations therefore increase confidence, but do not create an absolute guarantee.