How bitcoin transaction works

Blockchain technology created the backbone of a new type of internet.Each block typically contains cryptographic hash of previous block. Bitcoin is an implementation of the Blockchain. The way a bitcoin transaction works is different from normal banking transaction.  We shall keep aside the complexities of hiding sender and receiver details, mining, blockchain etc and focus on how transaction works. As usual in the simplest possible way.

A transaction is transfer of values between bitcoin wallets and include it in blockchain. Let’s assume:

 

These transactions will remain until I utilize the transactions into some other transaction. The amount linked with these transactions is called UTXOs or Unspent Transaction Output. This is the difference between a banking transaction and bitcoin transaction. In a banking transaction, after a successful  transaction, accounts of sender and receiver are updated accordingly. But in bitcoin, transaction will remain until the UTXOs are utilized in some other transaction. Let’s see how it is:

Now I want to buy a laptop which costs 0.6 BTC. I need to make a transaction to buy the laptop using the above UTXOs. For that the input and output can be :

Here is a problem. I have total 0.9 BTC in input and bike cost  0.6 BTC in output. There is no concept of change in BTC transaction as we do in normal currency transaction. All the input should go to the output (ignoring the commission concept). But we can send BTC to multiple participants. So we can arrange the output as:

Now 0.6 BTC will become UTXOs for the Laptop Store. My UTXOs will be :

So the transaction is created and once the miner add the transaction into the blockchain, the transaction will be confirmed.

But there is still a concern and it is highly possible that the transaction will never be added into the blockchain and I shall not get my Laptop. Why???

Because there is no commission for the miner. In bitcoin transaction, paying commission is not mandatory, but miner can add only limited number of transactions in a block and prefers to add transactions which offer higher commission. So to increase the probability of my transaction to be added in the blockchain, I can change my transaction output as :

The remaining amount i.e 0.025 BTC will be the commission of the miner. The commission will not be mentioned in the output as we never know who will be the miner. The positive difference between the (total input – total output) will be considered as miner’s commission. This is how a bitcoin transaction works.

In real transaction the sender and receiver has been encrypted using public and private key. We shall discuss it along with blockchain, how miner works, how a wallet   deals with UTXOs and  shows us total available bitcoin etc in upcoming posts.

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.