Bitcoin is the first application of the blockchain technology. In this post, I’ll explain in simple terms how bitcoin technically works and how a transaction takes place in the network.
As I mentioned before, blockchain is a data structure that stores data. In the case of Bitcoin, this data is a list of transactions. Each block contains a list of bitcoin transactions.
Bitcoin network is an ecosystem. Each party in the ecosystem is crucial to the network. The main goal is to transfer value from A to B securely, in a decentralized way and without a central authority. Let’s first define the components of the ecosystem.
The component of the bitcoin ecosystem
- Nodes: computers that are part of the network containing the whole copy of the blockchain. this copy contains all the history of the transactions. All the blocks are cryptographically linked together. the main role of the node is to verify transactions and make sure everything is right.
- Miners: computers responsible to add blocks to the blockchain using the proof of work algorithm. Miners are very important, their main role is to secure the network as I explained in the part about consensus algorithms. The miners are rewarded with the transaction fees and the block reward which currently at 12.5 bitcoins per block.
- SPVs: stands for simplified payment verification. Unlike nodes and miners, SPVs do not have the complete blockchain in their devices. they can validate their own transactions. In order to perform that properly, they are constantly connected to many nodes to update with relevant information and make sure the transactions are correct.
- Wallets: wallets hold the private keys used to sign transactions and send bitcoins. they have 3 roles. The first role is signing transactions. Second, they calculate the balance. Third, they calculate the transaction fees.
In the bitcoin network, there are no coins, only transactions. A transaction is a very important concept to understand.
In the bitcoin network, transactions have inputs and outputs. To make a transaction and send some bitcoins, you have to specify the address of the receiver and the number of bitcoins you want to send.
The wallet checks out your balance, which is the sum of the unspent outputs, to make sure you have sufficient funds. Once the check is done, these unspent transactions become inputs for the current transaction. The specified number of bitcoins is the spent output that goes to the specified address of the receiver. The rest goes to one or multiple addresses that you control with your private keys.
These become your unspent transactions outputs to be used in future transactions. The unspent transaction outputs are called UTXOs. At the end of the transaction, inputs are removed and outputs are created.
The transaction fee is the difference between the output amounts and the input amounts. At the beginning of the transaction, the sender must specify the transaction fee to be taken into account by the wallet. Transaction fees are market driven. They are the incentives that motivate miners to handle your transaction.
If the transaction fee is too low your block might never be chosen by a miner. and might stay in the Mempool for very long. A Mempool is where transactions are waiting to be picked up by a miner.
In this post, I have presented many concepts related to the bitcoin network. In the next post, I will talk about how mining works in details and put the cryptography knowledge to work.