Bitcoin Transaction Basics
Each transaction contains the following information:
- Sources (from the address) of the coins to be transferred from
- The number of coins to be transferred
- Destinations (send-to address) where coins should be transferred to
What is an address? (Also read Private Key, Public Key and Addresses in bitcoin)
Both source and destination addresses are 64-character hashes. Here is an example:
Bank Account Number versus Bitcoin Address
An address is like a customer’s bank account number. However, there are fundamental differences between them. For example, a bank has a centralized place for saving metadata on an account, for example, the customer name, account open date, and account type, and so on. Also, the balance of an account is calculated and saved. A bitcoin address does not have metadata and maintains no balance. Addresses are referred to only in bitcoin transactions. When an address does not contain any unused coins, a new request for transferring a coin from the address will fail a transaction validation due to an insufficient fund error.
A bitcoin coin does not associate with a physical object such as a file or a physical coin.
Only transactions and addresses support its existence. For example, if you want to know the total number of coins that have been minted so far, you have to go through all addresses with unused coins and add them up.
Address Balance Calculation (Transaction Sum Up)
When a user enters a transaction request at a node, bitcoin software installed at the node broadcasts the transaction to all nodes. Nodes on the network will validate the transaction by retrieving all historical transactions containing the input addresses and ensuring that coins that are transferred out from these addresses are legitimate and sufficient. After that, the mining nodes start to construct a block by collecting the validated transactions.
What exactly goes into validating a transaction?
A transaction has a sender’s wallet address and a recipient’s wallet address (and of course, the amount in btc). The BALANCE (unspent balance) of BTC in the sender’s wallet has to be validated (otherwise, you could simply double, triple spend).
One has to traverse the entire length of the chain and visit EVERY SINGLE transaction associated with that wallet address.
THIS IS THE ONLY WAY TO ENSURE THAT DOUBLE SPENDING DOES NOT OCCUR (this combined with grouping transactions into a block..see example below). Unless you verify every single transaction that involved the sender’s address, there is no way the transaction ‘passes’ even a single node’s ‘available balance check’.
Think of the simplest double spend example – the sender, in rapid succession sends two identical transactions to two different wallets, with the same BTC amount. The first transaction would be approved via the confirmation mechanism and then verified into the CURRENT block.
However, the second transaction would be recognized as invalid by the confirmation process and would fail validation, because traversing every transaction of the address would reveal the previous spend.
Who gets to add the block to the chain?
Normally, one block contains between 1,500 and 2,000 transactions. If a miner wins a race for resolving a difficult factoring puzzle, the miner gets the role for adding the new block to the blockchain. Bitcoin takes approximately every 10 minutes to add a new block.
Need a blockchain consultant?
Set up a 1 on 1 appointment with Anuj Varma to assist with your blockchain journey
Leave a Reply