Bitcoin Transaction Life Cycle - Blockchain -006

Bitcoin Transaction Life Cycle - Blockchain -006

·

4 min read

What is Bitcoin Transaction Life Cycle? Let’s understand this with an example, suppose Jane wants to send 10 Bitcoins to Alice? Jane will use a wallet service provided by Codies Alert that can create Jane’s Transaction and Broadcast it to the Network for Confirmation.

What happens after Jane Clicks on the Send Button? Well, behind the scene, Wallet Provider will check Jane’s Total Balance in her Wallet. Question is, How does Service Provider check Jane’s Balance. Remember, all the transactions are recorded on Blockchain. Service Provider has a complete list of Transactions that Jane has ever sent or received from others.

image.png

How to Create Bitcoin Transactions?

Transactions received from others are called UTXO, which means these are unspent Transactions or the current Balance in Jane’s wallet. For Example, Jane has four UTXOs in her wallet. Since Jane is trying to send 10 Bitcoins to Alice, Wallet Provider will check the Balance on the first Transaction, if the Balance is Greater than 10 then this transaction will be used as input. If the balance is still below the amount Jane is trying to send then Wallet Provider will read the second transaction and check the combined balance of Transaction 1 and Transaction 2 and this process continues until the combined balance is greater than the amount Jane is trying to send.

image.png

Once transactions are identified that we need to use as input, the wallet provider will sign these two transactions with Jane’s Private Key and broadcast them to the network.

You might have noticed the second transaction in outputs where Jane is sending herself 0.90 Bitcoin. This transaction is called a change transaction where Jane is sending herself the change. Since we only need to send 10 Bitcoins to Alice, and our Input Total is 11 Bitcoins. So, we are sending a change of 0.90 Bitcoin back to Jane. You might ask if that is the case then jane should be sending herself 1 Bitcoin instead of 0.90. You are right, but Jane has to pay 0.10 Bitcoins to Miner in a fee to validate and include her transaction in a Block. 0.10 fee is not fixed, we have just used it as an example.

Since Miners are keeping Blockchain secure by contributing with their computational power, this fee is their incentive to keep the network up and running.

One Important Point to Note, if you do not create a Change transaction of 0.90 Bitcoins to Jane. Miner will get 1 Bitcoin in Fee. Miner collects fees based on total Input minus output. You don’t want to pay a Huge Fee to miners, so changing Transaction to yourself is very important. You might not be aware of the change transaction because most of the wallet providers are automatically taking care of it for you.

Now we have our unique transaction ID created for our transaction. The service provider will broadcast this transaction to the bitcoin network. Mining nodes are always listening for Transactions. The first receiving node will verify the transaction and pass it to its neighboring nodes. Other nodes will do the same thing and within a few seconds, all the nodes in the network will have Jane’s transaction.

How to Create Bitcoin Transaction?

image.png

Suppose out of 4 nodes 3 nodes have picked up jane’s transaction and started solving cryptographical puzzle proof-of-work. It’s not necessary that all nodes will include Jane’s transaction, each node has a different set of transactions. Nodes include high fee transactions first because it is profitable for them.

Suppose one of the nodes that have included Jane’s transaction has mined the block. He will notify the other nodes and send the block to other nodes. Other nodes will stop mining their block after receiving the block from the winning node. All the nodes in the network will independently verify the block and attach it to their chain if all is good.

Now Jane’s Transaction is confirmed and Alice will get the notification stating that she has received 10 Bitcoins from Jane.

image.png

All the nodes in the network will update Jane’s Balance in Blockchain and remove the first 2 used transactions from her wallet because those are spent now and will add 0.90 change transaction in Jane’s wallet. Now Jane’s total balance is 19.90 BTC.

I hope this article and video gave you some insights into Blockchain technology. If you have liked this article then do not forget to share it with your friends and connect with me on Twitter for quick updates on Blockchain and Web3 Technology.

FREE Blockchain Course with Certificate of completion

Course Page.png

If you have not checked my Beginners Blockchain Guide course, I recommend you to check it now. It is FREE and you will also get your certificate of completion. I am preparing an advanced Blockchain course which will be out soon. I wish you all the best in your Blockchain Journey.