DEV Community

James Miller
James Miller

Posted on • Originally published at jamesmiller.blog on

What is Blockchain and how does it work

Header Image

Blockchain is another buzzword that keeps coming up, some people say it is amazing and others think it is pretty unnecessary.

I think it has a very exciting role to play in the future of the internet, but as with all technologies it isn’t the answer to everything.

In this blog post, I hope to provide an oversimplified answer to a question I often get asked: ‘what is Blockchain?’ and how does it work?.

As a note:

  • I’ll be using the Ethereum implementation of Blockchain as the basis for a lot of what I'll be referring to - but the core concepts of what I talk about will hold true for the technology as a whole.
  • I’ll be oversimplifying these concepts, to hopefully give you a base understanding of the technology - that you can then choose to grow on and learn the underlying technical nuances - based on your interests.

TL;DR

  • A Blockchain is a database that is decentralised over a large peer-to-peer network of computers.
  • The computers on the network run a consensus algorithm, which is the process that enables the blockchain to validate and store data.
  • The Blockchain issues tokens (also known as crypto-currencies), that are used to reward & incentivise the owners of the computers.
  • These crypto currencies can be exchanged for traditional currencies (e.g £/$).
  • Users interact with Blockchain apps with a ‘Crypto Wallet’, that identifies them on the network and allows them to make transactions using the crypto currencies as payment.
  • Transactions between users are co-ordinated through Smart Contracts, the ‘Back End’ code which is readable for anyone on the network to see and understand exactly how data and payments are managed.
  • The usefulness of Blockchain is highly debated, a core argument for the technology, is that it can enforce organisations, companies and governments to act with integrity through financial incentive.
  • Some benefits to the users who interact with the Blockchain is that the technology enables them to: 1. own their data, 2. make money and earn royalties from content they produce and 3. trust the data that is on web platforms understand the manner of how the application uses/manages that data

Summarising Blockchain

‘Blockchain’ can be a pretty confusing concept to understand, so lets break it down bit-by-bit.

I’ve emboldened the key parts ;)

What actually is a Blockchain?

A Blockchain is a decentralised database that runs on peer-to-peer network of computers, which validate and store transactions between addresses in a ledger.

So its a database, what makes it special?

Traditional databases require a centralised authority to validate the data and manage permissions of who can write to/read from the database, examples of these centralised authorities are the big companies/brands we use every day.

Blockchain does not require a centralised authority to validate data or manage permissions, this responsibility is distributed amongst a network of computers that work together to achieve consensus.

What is the value of consensus?

Historically, people have outsourced trust to institutions, organisations, companies and governments, that achieve consensus and make decisions on their behalf.

The processes that enable these decisions often happen behind closed doors and results can often be controversial, examples of this are scandals related to banking/government/big tech companies.

Consensus is at the heart of the mechanics that enable Blockchain technologies, it presents an alternative that enables people to interact directly with each other in a manner that they can trust.

Can I trust it?

Transactions of data in the Blockchain are enabled by Smart Contracts, which are essentially custom developed backend software that is readable to anyone on the network.

This means that you could check for yourself what the actual logic is for the code that enables a transaction between you and another person (e.g on Ethereum you can read smart contracts via Etherscan).

In the world we currently live in, centralised authorities (e.g governments) can say one thing to you and do something else in practice behind the scenes.

In comparison, the network of computers that enable the blockchain, are incentivised by the rewards of the consensus algorithm, to correctly validate that these contracts are acted upon as they are programmed.

With Blockchain, you can validate what processes a smart contract will do — by reading what is in the code that executes the transactions. You can trust that the consensus algorithm will enforce what is written.

Is it secure, how hackable is it?

To write data to the Blockchain, you need consensus from the computers on the network to validate that your transaction is valid.

The work that is put into achieving consensus between the nodes and writing the data is rewarded with tokens (e.g the transaction fees and new block creation reward).

This means that hacking one computer in the network to try and validate a fabricated/fraudulent transaction wouldn’t work, as this would not achieve consensus with the other computers in the network.

This self regulation rewards nodes for correctly validating transactions and prevents invalid transactions being recorded.

There are nuances to this process that these diagrams don’t fully explain, I think I’ll do another post detailing consensus algorithms in the future 😀.

Once data is written to the Blockchain, it is immutable — which means it cannot be deleted. This is because data is written into blocks, which go through a process of cryptographic hashing, that gets written into the data of the following block that gets hashed. This means that rewriting/deleting data, would essentially break the chain and the reason would be readily identified.

In comparison to a traditional database, a single computer can be hacked and data can be modified / deleted with relative ease.

There are two instances where Blockchain could be compromised:

  1. if a hacker can gain control of 51% of the computers on the network — then a hacker would essentially be able to bypass the need for consensus and rewrite data on the chain
  2. if a smart contract has been written in a manner that exposes a users assets through a vulnerability, then a hacker could exploit this

What does the data look like?

A Blockchain stores data as a ledger of transactions between addresses, that are cryptographically stored as blocks.

A block contains:

  • The block’s number in the chain (e.g the first, second, or third block in the chain) and timestamp of when the block was created
  • Information on the owner of the computer who complied with the consensus algorithm to create the block of data (the miner)
  • Information on the reward to the miner for creating the block, the amount of data stored and the difficulty of the consensus algorithm
  • Gas Used (the number of tokens paid by accounts who make transactions)
  • Data related to the hash of the block (made up of the transactions data, nonce and hash of the previous block)
  • Transactions (the list of transactions that are stored in the block)

A transaction contains:

  • A hash that is made up of the transaction data, the status of the transaction, the block it is contained within and the timestamp it was generated
  • The value of the tokens that were exchanged between addresses and the fees that were paid in order to reward the miners
  • Data that is being stored/sent
  • The addresses of the tokens were sent to and from

An address can either be a smart contract or a crypto wallet, either will have:

  • Information of their balance of tokens/assets
  • A list of transactions they’ve made, who the transactions were to/from, the value traded and the block it is stored in

A Token can be any of the following (there are also others but lets keep it simple):

  • A fungible token such as ERC-20 which is used for trading (contains a price, total supply and number of holders)
  • A non-fungible token such as ERC-721 is used to declare a unique asset with value (contains an owner, address, creator, content url, id and list of transactions).

What are crypto currencies and NFTs?

The concept of value in a Blockchain network is described in assets known as tokens, two you should understand are ERC-20 and ERC-721

ERC-20 tokens are also known as fungible tokens are often referred to as crypto currencies and can be traded at crypto exchanges for fiat currencies (such as $/£/$), the value of these crypto currencies vary based on supply and demand.

The consensus algorithm of a Blockchain network enables the owners of the computers of the network to be rewarded with fungible tokens (this is what is often referred to as ‘mining’).

ERC-721 are also tokens known as non-fungible tokens (NFTs), that are unique and are used as ways to declare the creator and owner of an asset.

There are also other types of tokens to learn about, but this is a good place to start 🙂

How do I practically interact with a Blockchain?

To interact with the blockchain you need to create a crypto wallet, purchase tokens via a crypto exchange and find an address to send tokens to.

Coinbase and Ethereum Logos

One way of doing this could be to use coinbase, to create a crypto wallet and purchase tokens from a Blockchain (e.g Ethereum) — then all you need to do is find a friend’s wallet address to send crypto to.

If you wanted to purchase an NFT, then you could visit opensea and use your tokens to purchase an NFT.

Seems like a lot of effort, is this actually useful?

🙂

There is never a golden bullet for all problems, Blockchain is a useful technology for a specific problem.

Even though blockchain is a database, the arguement isn’t “ Blockchain vs traditional databases”, it is decentralised consensus vs centralised decision making.

The problem (places where Blockchain can help):

  • We live in a world which is dominated by centralisation (banks/governments/corporations/companies/institutions), we are so reliant on them and it can be really difficult to influence what they do and actually hold them accountable for their actions.
  • Consensus is achieved behind closed doors, how do you trust it is fair?
  • What is said (or written) and what is actually done in the real world is not always the same, who holds this to account and do we trust this authority to do it?
  • You don’t own your data or content, it could be used in ways that you cannot track and monetised without your knowledge/consent.
  • It is difficult to hold organisations/individuals to account for actions that have been taken, how can you track what has been done/who owns what?
  • Processes that connect these organisations/individuals together are often filled with time wasting bureaucracy and difficulty in sharing/communicating information.

The solution (ways Blockchain can help):

  • Decentralise and automate parts of organisations in an appropriate manner so that they are trackable on blockchain.
  • Implement a consensus algorithm that can be trusted amongst the users of a network to incentivise correct validation.
  • Create Smart Contracts that reward value to individuals/organisations who practically deliver on expectations.
  • Empower people to own/share/monetise their data and content, on terms they are happy with via NTFs.
  • See specific transactions of data/assets/value that organisations have made and have faith this is valid.
  • Incentivise speedy co-operation between organisations with smart contracts that share context relevant information and financially rewarding fast action.

Conclusion

This might seem pretty full on and deep stuff, but this is the core argument for what Blockchain can do.

There really is a lot more to cover when it comes to this topic, I hope this post gave you enough of an understanding of the core details — so you have a base to grow on.

It really isn’t the solution to everything, personally I see Blockchain as a big shift in thinking, which is really hard to imagine how a world that embraces it fully — would look like.

I think this technology will likely grow in momentum over the years — proving value in more and more areas until it becomes less of a buzz word and more of an understood and useful tool.

… or maybe I’m wrong and this a fad that will die out in a couple of years — lets see!! xDD

Top comments (6)

Collapse
 
metapunk profile image
MetaPunk 🦙

I was eating grass when I came across this, I approve of this post, very informative, enjoyed the read, life can be very boring when your a Llama trying to run your own web 3 community.

Collapse
 
jamesmillerblog profile image
James Miller

Hay MetaPunk!!!

I'm glad you strawed through my post and found it so peachy!

Web3 really is the apple of my eye, I will be cele(ry)brating that it was fruitful for you :D

Collapse
 
metapunk profile image
MetaPunk 🦙

I like celery, keep talking 🦙🥬

Thread Thread
 
jamesmillerblog profile image
James Miller

Lets go all oat and drive them all bananas!!

Thread Thread
 
metapunk profile image
MetaPunk 🦙

🦙🦙🦙🦙🦙🦙🦙🦙

Thread Thread
 
jamesmillerblog profile image
James Miller

:D