Lifecycle of Transactions
Learn the lifecycle of transactions in Bitcoin in this lesson.
We'll cover the following
Storing the transactions in the blockchain
Since an adversary who maintains enough computational power may try to modify the history of previous transactions, Bitcoin’s transaction verification process by itself cannot ensure the security of transactions. In order to prevent any adversary from modifying the history of transactions that have been executed, Bitcoin secures the transaction through the blockchain, which is based on the computationally expensive Proof-of-Work mechanism.
Once a transaction is included in a block, it’s hard to modify, and if any adversary intends to modify a transaction in the system, not only does he have to redo all the computational effort to recompute the block in which the transaction was included, but he also has to recompute all the subsequent blocks to the head of the blockchain. Thus, the older a transaction is, the deeper it is buried under subsequent blocks in the blockchain, and hence the harder it becomes to revert the transaction. Actually, Bitcoin recommends waiting until a transaction is confirmed by six consecutive blocks before the transaction is considered safe.
Transaction lifecycle in Bitcoin
In Bitcoin, a transaction life cycle consists of the following steps (
- A user sends a transaction by signing the transaction using their private key, addressing the public key, or the address of the recipient.
- The transaction is broadcast to the network using a flooding algorithm.
- Mining nodes validate the transaction independently, adding them to the unconfirmed transactions’ memory pool (Mempool), which is basically the nodes’ database for pending transactions, in order to include this transaction in their candidate block which is next to be mined.
- When a miner solved the Proof-of-Work problem, they broadcast the newly mined block to the network.
- The nodes verify the block and propagate it further.
- Finally, the block is added to the blockchain and the transaction is considered to be confirmed.
- With each successive block, the transaction is reconfirmed.
- When a transaction is confirmed by six consecutive blocks, it is considered safe.
It’s important to note that a recipient immediately possesses a UXTO as soon as his node validates the transaction. Such transactions are called zero-confirmation transactions, which are insecure, as shown in this section.
Get hands-on with 1200+ tech skills courses.