To understand the basics of Bitcoin blockchain and how it functions, we need to first understand how a decentralised online currency works.

What is Bitcoin?

Bitcoin is not just any online currency that represents a few dollars. But it is a decentralised, peer-to-peer network that allows one entity to send money (aka BTC) to another entity without any central authority involved.

There are 2 things here:

  1. An online cash system.
  2. A decentralised network.

An online cash system:

In order to initiate and keep the online cash system running in a way that the regular cash system functions, one needs to implement a set of protocols/rules through algorithms to take care of few things like:

  • Transaction authentication:
    The system should be able to verify a transaction between entities to avoid fraud and it should be able to confirm and validate a transaction as well. These protocols ensure that the right entity is making the right transactions over the internet.
  • The double spending problem:
    One should not be able to spend the same tokens/coins twice.
    For example, John owns 20 BTC and wants to buy a Mercedes(worth 20 BTC) with those coins. He signs and sends those coins over to Mercedes. Later, he sees a new electric vehicle which also costs 20 BTC. He should not be allowed to use those same coins he signed over to Mercedes to sign another transaction into buying a new electric vehicle.

A decentralised network:

The Bitcoin blockchain allows the transfer of values directly from one entity to another. This means that you as a person can send any amount of BTC(that you own) directly to the recipient without passing it through any central authority. A complete peer-to-peer network.

For a peer-to-peer online cash network to function properly and handle the transfer of values, there are few things that need to be taken care of.

How transactions are performed?
How to keep track of all the transactions?
How to know when a transaction is duplicated?
How to handle a user’s account on the network?
How are they validated without any central authority?

Among other things:

How does a blockchain enable all of this?
What roles do miners play?
How do they get paid?

Transactions:

The transactions from one entity to another is a combination of Digital signatures, Public and Private keys, Hashing, etc.

When one entity signs an amount, say 5 BTC to another, they add their digital signature at the bottom by signing the hash value of the previous entity and the public key of the next entity.

But the recipient is unable to know if the sender is double spending the coins. We can have a centralised system for this where each transaction gets stored to know whether double spending is occurring or not. But this also poses a threat since a central authority now owns and controls the transactions. Failing to which can lead to a huge vulnerability in the whole system of transactions including all the senders, receivers, and coins.

How does a decentralised system take care of double spending?

The best way of doing this is to make every transaction over the network public to all the full nodes, meaning each participating full node holds a copy of the blockchain with all the transactions ever occurred over the network. As long as there are honest working nodes in the network to capture any fraudulent broadcast, both the network and transactions remain untampered.

What keeps the honest nodes honest?

These nodes get incentivised for adding a new block on the blockchain, as per the consensus protocol. The potential profits of remaining honest are higher than fighting the whole network of other honest nodes all at the same time, which is computationally impossible as well.

Proof of Work:

As we all know, Bitcoin utilises blockchain technology to decentralize its model. Once a transaction is made, it needs to be broadcasted over the network. These transactions are recorded in an immutable ledger. A collection of such transactions is a block, which is supposed to be added to the blockchain. To decide which block to add and which to not, the concept of proof of work is implemented. This works by changing the nonce value(an attribute of block creation) until a specific hash value is achieved for the block. This requires compute power. The node which solves this problem gets to add the block to the network and is incentivised as per the compliance. Once a block gets added to the chain its data cannot be changed without redoing the nonce. And since a block is chained to its previous and next block, making changes to one block requires redoing the nonce of all the blocks further. This makes the data over blockchain secure and manageable.

The UTXO Model:

The accounting model used in the Bitcoin blockchain is the Unspent Transaction Output. The amount of BTC owned by a user is measured in such outputs. These outputs represent the BTC being assigned to any user, which they haven’t further assigned to another account.

Let us understand this via an example:
John currently has 0 BTC in his account. Caroline signs a transaction of 5 BTC to John. Now, the balance of John’s account represents an output of 5 BTC assigned to him. Collectively, John’s balance is made up of such amounts being assigned to him until he spends them further. If John is now assigned another 5 BTC from another user. His account reflects that two outputs of 5 BTC each are being assigned to John’s account’s address.

This model does not store or represent the entire balance of one’s account rather represents the outputs being assigned to the account. In order to merge all those outputs into one, a transaction needs to be executed to do so. The total collection of Bitcoins over the network is assigned to one entity or another via outputs. And the job of wallets is to make sure which account has the access to a particular output.

General facts:

This blockchain is built only around the concept of transferring value with its native currency as Bitcoin(aka BTC). The initiative is open-source as well. Ethereum blockchain is built upon this blockchain, with added features allowing it to run business logic along with the transfer of values, with its own native currency Ether(aka ETH). Ethereum Blockchain is open-source as well.

So far we’ve covered the basic aspects of Bitcoin and its blockchain including proof-of-work, transactions and its model. To learn in-depth about such aspects of this peer-to-peer online cash system, read the Bitcoin whitepaper.

Nascent Blockchain Developer (Ethereum)