Blockchain Operations

In this article, we learn about the operations that take place in a blockchain such as Bitcoin.

Table of contents.

  1. Introduction.
  2. Operations on the Bitcoin Blockchain.
  3. Operations on the Ethereum Blockchain.
  4. Summary.
  5. References.

Prerequisite

Introduction to the Blockchain

Introduction.

In this section, we look at the basic operations that take place in any blockchain. Peer nodes in the blockchain network are responsible for all operations on the network. Peer nodes could be computers such as servers, laptops, desktops, mobile phones, etc.

Operations on a blockchain include:

  • Validation of transactions - validators make sure that the transaction is valid based on a list of criteria e.g, the amount transacted should be less than the account balance, the transaction amount is enough to cover the fees, the transaction does not reference the same UTXOs(double spending) among others.
  • Gathering transactions of a block - a block is a collection of transactions. Blocks have a maximum limit. Transactions in a block are stored in a Merkle tree. If any transaction in the block is invalid, so is the block itself.
  • Broadcasting all validated transactions and blocks - At each moment a transaction or block is validated, it is broadcasted for anyone to see. This ensures the blockchain remains transparent.
  • Reach a consensus during the creation of a new block - For a block to be accepted by all miners and added to the blockchain, a consensus must be reached. Consensus mechanisms include PoS(Proof of Stake), PoW(Proof of Work), and Proof of Elapsed Time(PoET) among others. After blocks are added to the chain, miners are rewarded for their efforts.
  • Chaining blocks together(immutability) - This involves adding the mined block to the existing chain. After all this, we cannot change a transition without getting noticed.

Operations on the Bitcoin Blockchain.

On bitcoin we have two participants, the first is a user who initiates a transaction(transfer of value) on the blockchain and miners who are responsible for verifying the transaction.
Miners apart from verifying a transaction on the blockchain, are responsible for;

  • Broadcasting transactions. This creates transparency in the network. We can view transactions as they get broadcasted here.
  • Block creation - this involves aggregating all transactions into a single block.
  • Reaching a consensus during block creation and validation - in Bitcoin, it is referred to as the PoW(Proof of Work) mechanism. The block is valid if the PoW(nonce) is valid.
  • Broadcast new block - Blocks are also broadcasted once mined. We can view all broadcasted blocks here
  • Confirming already executed transactions - once a transaction is created, it is validated by a single miner who confirms it and propagates it to the entire network for the same confirmation. Each and every miner in the network must confirm a transaction, if a transaction fails validation, it is dropped and not propagated anymore. In day-to-day Bitcoin transactions, vendors usually set a minimum number of transaction confirmations for goods or services to be released.

Now, why would miners take on additional responsibilities to manage the blockchain?
This is because they are incentivized in Bitcoins. As we have learned in the prerequisite article. All miners carry out the validation of transactions as seen here.
The process of validating a transaction covers over 20 criteria some of which are, making sure that referenced input/output UTXOs are valid, referenced output UTXOs are valid, and matching input and output amounts.

Invalid transactions are immediately rejected and not broadcasted. Valid transactions are added to a pool of transactions.
Miners then choose a set of transactions to create a block.
To manage the inconsistency of blocks, miners have to compete to solve a cryptographic puzzle that takes up a lot of computational resources, this determines who gets to create a new block in the blockchain.

Once solved, the block with transactions and the miner are broadcasted to the network and other blockchain participants are responsible for verifying the new block using the nonce found by the winner. They arrive at a consensus that decides if the new block will be added to the chain.

This means that new transactions from the new block are added to the blockchain and confirmed by all blocks in the chain. A consensus algorithm referred to as proof of work is used to reach a consensus.

In later articles, we will discuss bitcoin halving, in summary, halving involves the reward for bitcoin miners getting cut in half after every four years since genesis. Bitcoin last halved on May 11th, 2020 at 3 pm EST. This means that a block is rewarded 6.25BTC. This is also how new coin(bitcoins) is created.
Compared to fiat currency that can be printed, bitcoin halving cuts bitcoin's inflation rate, meaning it is resistant to inflation.

Operations on the Ethereum Blockchain.

Unlike Bitcoin where a wallet serves as the interface to the Ethereum blockchain, Ethereum has user accounts that send, receive, and hold Ether that is transacted between parties.

Every Ethereum transaction initiates two transfers, the first is to send the funds to the recipient and the second is to send the fees to the miner who validates this transaction.

An Ethereum full node stores the full copy of the Ethereum blockchain. For this, it is required that the node administrator download the full Ethereum client, also, he/she will need to keep his/her node updated as new transactions and blocks are propagated.
Hosting an Ethereum full node is a responsibility in that the owners need to validate newly mined blocks, execute smart contract code, distribute data to other nodes, for example, new full nodes or light nodes, create new blocks, validate transactions, and run the Ethereum Virtual Machine(EVM).

Ethereum uses smart contracts which are just programs that run on the Ethereum when predetermined conditions are met. This code is written in Solidity programming language. Transactions on the Ethereum blockchain can do two things, either as a means to exchange value or to trigger smart contract execution. When a smart contract is executed, it is stored as a receipt just like a transaction with any institution that generates receipts.

Gas is a measure of work on the Ethereum blockchain. Each transaction has a fee. Operations that require more computation are costly compared to those that require little.

The Proof of Work Consensus Mechanism.

This involves the use of computational power to solve a complex puzzle specified by a blockchain protocol for a reward.
A coinbase transaction is the first transaction in a block. It is unique in that it has no input UTXO. It is created by a miner and it is used by a miner to collect block rewards for computational power used to manage the network.
Blocks in blockchains are tamper-proof as demonstrated here. Each block will usually have more than a single transaction, the first transaction is the coinbase transaction(miner's fee).

Proof of work is used for both Ethereum and Bitcoin although, at the writing of this article, Ethereum is slowly shifting to a Proof of Stake consensus mechanism whereby participants are given the chance to mine a block depending on the stake they hold.

Summary

Operations in a blockchain involve transaction validation, block creation with consensus from blockchain participants, and broadcasting and confirming blocks and transactions.
Proof of work is a consensus algorithm used in the bitcoin blockchain. The name is because it involves work in this case computational power to solve a puzzle specified by the blockchain so as to claim the right to form the next block.
Miners are responsible for verifying, broadcasting, competing for block creation rights, and reaching a consensus for validating a newly created block.
The first transaction, transaction 0 is referred to as the coinbase transaction, it is unique in that it does not have an input UTXO. It is used in paying miners their fees for work done by their computers.

References.

Blockchain DEMO