Back
How do Bitcoin Transactions Work?
General Wallet Use
•
15 min
To fully make use of their Bitcoin wallet, users must first understand how Bitcoin transactions work. While it's widely known that Bitcoin transactions enable the sending and receiving of bitcoins, there are many intricate mechanisms at play beyond this basic function. So, how exactly do Bitcoin transactions work?
This Learn Center Piece explores what exactly a Bitcoin transaction is, the Bitcoin transaction lifecycle, and what to watch out for during a Bitcoin transaction.
What is a Bitcoin Transaction?
A Bitcoin transaction is the transfer of bitcoin on the blockchain, where a user sends a specified amount of bitcoin to another user. Bitcoin wallets generate two crucial components that make transactions possible: a public key and a private key. The public key, also known as a Bitcoin address, allows individuals to receive bitcoin. The private key acts as a password that signs Bitcoin transactions, authorizing the spending of bitcoin.
There are five different yet important components make up a Bitcoin transaction:
Inputs
Inputs reference previous transactions' outputs. This means that the amount of bitcoin spent in a new transaction comes from the outputs of previous transactions that the sender owns and wishes to spend.
Outputs
Outputs serve as destinations and reference points for sending bitcoin in a transaction. They function as Bitcoin addresses (public keys) and specify how much bitcoin a user sends in a transaction.
TXIDs
Transaction IDs (TXIDs) are unique identifiers used to track, reference, and verify specific transactions on a blockchain. TXIDs are generated by hashing transaction data and consist of alphanumeric characters that represent important information like the amount of bitcoin sent and the time the transaction was made.
Values
Values represent the amount of bitcoin transferred in each input and output. Input values show how much bitcoin is sent to a specific Bitcoin address, while output values show how much bitcoin is spent from a previous transaction.
Transaction Fees
Transaction fees are payments miners receive for including a Bitcoin transaction in a block and adding it to the blockchain. The exact amount that users must pay in transaction fees is dependent on factors such as supply and demand and the “size” of the transaction itself. The more inputs that a transaction has, the more block space it’ll take up, which naturally causes the transaction fee to increase. The higher the transaction fee, the faster the Bitcoin transaction is processed and confirmed. The reason why that’s the case is because of how the blockchain is set up.
Considering that the amount of room within a block is limited, only a certain number of Bitcoin transactions can be included in a single block. Since miners are paid transaction fees, as well as a block subsidy, in exchange for including Bitcoin transactions in blocks, they are incentivized to prioritize the ones that have the highest transaction fees. Because of this incentive, transactions with the highest fees are the most likely to be placed in a block, ensuring that they get confirmed quickly.
What Happens in a Bitcoin Transaction?
There are three key stages in a Bitcoin transaction’s lifecycle:
Creating a transaction
A person creates a transaction by using their Bitcoin wallet. When developing a transaction, the sender must include not only required information such as the amount of bitcoin and the recipient’s Bitcoin address, but also optional information such as what type of coins to send and the transaction fee. Additionally, the Bitcoin wallet also uses the sender’s private key to sign off on the transaction, ensuring that it is not only authentic but also secure.
Broadcasting a transaction
Once the user creates and signs the transaction, the Bitcoin wallet broadcasts it to the network by sending it to a nearby node. When the node receives the transaction, it then relays it to other nodes within the network. The nodes then verify if the transaction is valid, which is done by checking if it has been signed by the sender’s private key. Once the nodes determine that the transaction is valid, it is then transferred to the mempool (memory pool), which ultimately serves as a waiting room for not-yet-confirmed transactions to remain until they are mined.
Transaction Confirmation
Once a miner is ready, they select transactions from the mempool (typically prioritizing ones with high transaction fees) and assemble them into a block while also ensuring that the transactions in the block are valid. Once the miner finishes building the block, they engage in Bitcoin’s consensus mechanism (known Proof-of-Work) where they compete against other miners in completing a cryptographic puzzle and including only valid transactions in their blocks. The first miner to complete the puzzle and submit a valid block (invalid ones get rejected by the Bitcoin network) not only receives all the fees from the transactions within that block but also a block reward.
The miner broadcasts the valid block to the Bitcoin network by sending it to nearby nodes, which verify the block and the transactions within it. If the nodes validate the block, they add it to the blockchain, confirming the transactions within it. These transactions receive additional confirmations when either the blockchain reorganizes or a new block is added to the blockchain, but generally, they are considered secure once they hit 6 confirmations. After 6 confirmations, these transactions become final, are recorded onto the blockchain, and cannot be reversed.
Common Bitcoin Transaction Problems
When people use their Bitcoin wallets to conduct transactions, they may come across some common transaction issues. The three most common ones that Bitcoin users should particularly look out for are:
Unconfirmed transactions
These transactions remain unconfirmed in the mempool for a significant period before a miner includes it in the next available block. Considering that miners prioritize transactions with high fees, individuals that pay small transaction fees are often forced to wait hours, or even days before their transactions get confirmed. This is especially true when traffic on the Bitcoin network is high.
Luckily, there are some methods that people can use to combat unconfirmed transactions. One common method is to use a Bitcoin wallet that supports Replace-By-Fee (RBF), which gives people the ability to swap out unconfirmed transactions with ones with high associated transaction fees. This incentivizes miners to prioritize these transactions and quickly include them in the block.
Mistyped addresses
As the name implies, mistyped addresses are incorrect Bitcoin addresses filled with errors created either by the user manually inputting the wrong series of characters (prone to mistakes) or by copying and pasting an address filled with incorrect letters and numbers. The reason why mistyped addresses are huge transaction issues is because they result in the user losing their bitcoin with no way of getting it back. For example, if a person inputs a mistyped address that happens to be valid, then their bitcoin will be transferred to the wrong address and they can never get it back as the transaction is irreversible.
Luckily, most Bitcoin wallets have built-in codes that validate addresses before a transaction is made, thereby generally preventing users from accidentally sending bitcoin to mistyped addresses. Alternatively, people can also use QR codes to scan addresses instead of manually inputting them, thereby reducing the chance of putting incorrect characters. At the end of the day though, users should always double-check the addresses themselves before making Bitcoin transactions.
Transaction fees
Transaction fees can become huge issues depending on how much the individual is paying to confirm a transaction. As explained earlier, a transaction fee set too low often results in the transaction becoming unconfirmed, particularly when Bitcoin network traffic is high, as it remains stuck in the mempool for a long time. However, a transaction fee set too high will lead to a user unnecessarily overpaying for their transaction to be processed. Deciding the appropriate transaction fee is often difficult as fee rates can often fluctuate depending on the demand within the Bitcoin network.
Luckily, many wallets have built-in estimation tools and functions that provide people with recommended fees based on the current conditions of the Bitcoin network. Adjustment options like RBFs can also modify fees after a transaction has been made if needed. Additionally, users can also simply observe the conditions of the Bitcoin network themselves and set the appropriate fees themselves. Bitcoin users have a wide range of tools at their disposal, and so it is ultimately up to them to decide what the right transaction fee is.
Conclusion
The first step to using your Bitcoin wallet is understanding how Bitcoin transactions work. Bitcoin transactions are when a user sends a certain amount of bitcoin to another user, and they are only possible if both parties have wallets, specifically public (Bitcoin address) and private keys (a password that signs Bitcoin transactions).
There are five important components of a Bitcoin transaction: inputs, outputs, TXIDs, values, and transaction fees. A Bitcoin transaction typically involves three key stages: creating a transaction, broadcasting a transaction, and transaction confirmation. Some common transaction issues that might occur when people are using their Bitcoin wallets are unconfirmed transactions, mistyped addresses, and fees. Fortunately, each common transaction has a series of solutions that users can take advantage of to ensure that the bitcoin they send gets into the correct hands.
Connect to web3 applications built on Bitcoin with the Leather browser extension. Install Leather – the only wallet you need to tap into the multilayered Bitcoin economy – today.