What is a Blockchain?

In its simplest definition, a blockchain is a decentralized and distributed global (public) ledger which is used to record transactions across many (public) computers so that the record cannot be altered retroactively … that’s it in a nutshell.

OK, kidding aside, let’s break that sentence down a little to make it more comprehensible:

Blockchain Out Of A Nutshell

Decentralised

I.e. not controlled by a single entity.

If you look at a traditional ledger, it is owned, managed and maintained by the company that owns it (which may or may not be the creator of the ledger/database). This implies that with traditional ledgers you need to trust the owner of the ledger to safeguard your data and to manage it properly.

Distributed

I.e. not residing in a single location.

The blockchain data is distributed to as many participants on its network as possible, often as a whole to the master nodes / trusted nodes and partial to all of the nodes. It is publicly accessible at any time, from anywhere. Traditional ledger databases are either maintained in private servers, server farms, on the cloud or any combination thereof and access is usually limited to specific users/software.

Global

Kind of speaks for itself, and really not that different from databases which can also have global accessibility and distribution.

Public

I put this in brackets because you can have either public, consortium or private blockchains, so here it doesn’t differ from a database depending on the implementation.

Ledger

Or simply speaking, a book in which things are regularly recorded, especially business activities and money received or paid; which applies to both a blockchain and a database.

Taking those into consideration, a blockchain is a structured ledger that is not controlled by a single entity and that is as widely distributed to the network participants as possible, anywhere in the world.

That’s it, read on if you want to learn the finer details, but that’s a blockchain in a nutshell.

 

What does the blockchain look like behind the scenes?

Most people are familiar with or have heard of cryptocurrencies (such as Bitcoin, Ethereum, Ripple, Litecoin, etc.). These are Protocols that operate on top of the blockchain technology. So blockchain is not cryptocurrency but a cryptocurrency, Bitcoin, was the first implementation of blockchain technology.

On top of this, you can then have tokens which operate on top of certain cryptocurrency protocols in the form of a smart contract (however smart contracts and tokens are topics for a later paper).

In simple form it looks something like this:

The blockchain

The Layers of Blockchain Systems

As you can see, there are different types of blockchain technologies that are supporting different kinds of implementations and protocols. I’ll talk about those differences in more specific papers as they can be substantial depending on the blockchain you are looking at (such as Hashgraph, the Tangle or the Block Lattice).

 

So why use a blockchain ledger over an existing ledger?

One of the largest benefits, of blockchain technology is around trust, or rather about the need not to trust the parties you are dealing with. In any transaction there is a need to trust the other party to live up to his/her terms of the transaction, whether this is to purchase goods or services. Blockchain removes that need from a transaction and it removes the need for trust of data in general.

Instead of using CRUD (Create, Read, Update, Delete) used by traditional databases when managing data, blockchain uses RW (Read and Write) to capture data, it then stores this data in a “transaction” and adds this transaction or multiple transactions into a “block”.

Once it has been added and validated, the block gets distributed to the network and added to the chain (to form the block-chain) the transaction and the data it contains can never be changed (due to Read and Write) and as such can be trusted as being true at that point in time.

blocks in the chain.png

Blocks In A Chain

As you can see, there is more going on than that, there is a transaction hash and a block hash, a genesis block, etc.; so …

 

What else is needed for the Blockchain?

Next to the technology layer, in order to run a blockchain, you need to have:

  • Trust (or the lack of needing to trust in participants),
  • Security of transactions, this is commonly achieved through cryptography, as well as public and private keys,
  • A network of users/participants, and
  • A way to achieve consensus across all the network participants.

The latter is addressed in the below sections but first let’s talk about the transactions themselves.

Public and private keys

We’re almost there, prior to explaining transactions, you need to understand that as a user of a blockchain you receive/generate a private and a public key.

These keys are your identify on the blockchain, with the public key (25 characters long) being a hash of your private key.
You use the public key to identify yourself on the network and you use the private key to validate that it is really you, which generates your electronic signature.

What is a transaction?

A transaction is really just a data set that you wish to store on a blockchain, it can be an actual transaction (money transfer, goods or services transfer) or it can simply be storage of specific data.

The basic set up of a transaction looks like this:

blockchain transactions.png

The data stored on the blockchain

The transaction on the left shows an exchange of goods or services, someone (public key 1) sending 75 points to someone else (public key 2).

While the transaction on the right shows a storage of data, for example, a deed to a house that they wish to store on the blockchain or a book or a contract.

Transactions contain the sender’s public key, the data they wish to store, their electronic signature and the hash of all of the above which becomes the transaction hash.

Which brings us to …

Hashes / Security of transactions

Security is provided in the form of cryptographic hashing and the use of a hash tree, better known as a Merkle tree.
I have a different paper on the Merkle tree but to understand blockchain I need to mention it, here is the very basic principle of the use of the Merkle tree in the blockchain:

“A Merkle tree is a tree in which every leaf node is labeled with the hash of a data block and every non-leaf node is labeled with the cryptographic hash of the labels of its child nodes. Hash trees allow efficient and secure verification of the contents of large data structures.”

Each transaction is captured in a cryptographic hash, in short, a unique string of numbers that represent all of the data in the transaction. This hash is a unique representation of the data in an alphanumerical string, this hash becomes part of the transaction and any change to the data changes the hash itself.

I.e. once data is in a transaction and the hash has been generated that data can no longer be changed without changing the hash of the transaction.

When a transaction is added to a block, the transaction and all other transactions in the block, as well as the hash of the previous block, make up the hash of that block (again in simple terms). This creates a chain of blocks that each refer to the previous block and none of the data in these blocks nor the data in the transactions can be changed without changing the hash of that transaction and as such the hash of the block and thus the hashes of all subsequent blocks.

I.e. any change is immediately visible to the network.

transactions hashed in a merkle tree.png

Read Our Blog About The Merkle Tree

In this example, the transactions (TX) each get their own hash (e.g. Hash0); are combined with other transactions, which generates another hash (e.g. Hash01), which are then added into a block, which receives a block hash.

If you remember from the previous image, the block also contains the block hash of the previous block and all of that data combined makes up the hash of that block.

a block.png

The network uses a consensus algorithm to agree on which blocks get added to the blockchain and as such safeguards the data.

This Merkle tree structure ensures that the data cannot be changed and is irrefutable, the only way to change the past data is for the majority of the network to agree on accepting such a change and to roll-back the entire blockchain.

Let’s say that we want to change the data of transaction X, added to the chain on 24 October 2017.

Since such a rollback would dictate that all data that was added since transaction X was added would need to be either updated or removed completely, this kind of rollback will never reach network consensus.

To my knowledge it has been done only once, in Ethereum, to counter a hack of the cryptocurrency protocol (not of the blockchain itself) which did not receive network consensus and caused a split in the Ethereum community (Ethereum and Ethereum Classic).

https://blockchainlabs.ai/the-merkle-tree/

Powering the Blockchain network

So we have a technology with irrefutable transactions that operate on a public network, with data accessible by anyone (with encryption for privacy protection if needed); who/what powers this network?

The answer is quite simple, the blockchain is powered by its users and miners.

Many different blockchains use nodes to do so, a node is basically you, the computer/device that you use to access the network. Some people dedicated their computers to help run the network (setting up a master node or a trusted node) which then assist with providing additional processing power to the network, miners also contribute to this.

Nodes receive a copy of the blockchain (either partial or in its entirety) and as such the ledger can always be retrieved, even if 90% of the network is down (which is purely hypothetical, 90% of a global network being down would signify a natural disaster or other catastrophes on a planetary level). And the total ledger is as such always retrievable.

 

Consensus Algorithms

In order to successfully operate a blockchain, you need the network to have consensus on the transactions that are being added to the chain, different technologies use different consensus mechanism to do this.

Since blockchains don’t require trust (or are trust averse) they need highly functional, efficient and secure consensus algorithms to operate. Here are some examples of what is being used:

Proof-of-Work (POW)

Probably the best know as it used by Bitcoin, it achieves two things, it ensures that the next block in a blockchain is the one and only version of the truth, and it keeps powerful adversaries from derailing the system and successfully forking the chain.

Proof-of-work is established by “miners” while “mining” the block. In proof of work, miners compete to add the next block (a set of transactions) in the chain by racing to solve an extremely difficult cryptographic puzzle. The first to solve the puzzle, wins the lottery.

As a reward for his or her efforts, the miner receives 12.5 newly minted bitcoins – and a small transaction fee. For an in-depth look at how this works, please see (https://steemit.com/blockchain/@iwan.spillebeen/blockchain-decrypted-how-mining-works).

 

Proof-of-Stake (PoS)

The most common alternative to proof of work. In this type of consensus algorithm, instead of investing in expensive computer equipment in a race to mine blocks, a ‘validator’ invests in the coins of the system.

Note the term validator. That’s because no coin creation (mining) exists in proof of stake. Instead, all the coins exist from day one, and validators (also called stakeholders, because they hold a stake in the system) are paid strictly in transaction fees.

In proof of stake, your chance of being picked to create the next block depends on the fraction of coins in the system you own (or set aside for staking). A validator with 300 coins will be three times as likely to be chosen as someone with 100 coins.

Once a validator creates a block, that block still needs to be committed to the blockchain. Different proof-of-stake systems vary in how they handle this. In Tendermint, for example, every node in the system has to sign off on a block until a majority vote is reached, while in other systems, a random group of signers is chosen.

Proof-of-Activity (PoA)

In proof of activity, mining kicks off in a traditional proof-of-work fashion, with miners racing to solve a cryptographic puzzle. Depending on the implementation, blocks mined do not contain any transactions (they are more like templates), so the winning block will only contain a header and the miner’s reward address.

At this point, the system switches to proof of stake. Based on information in the header, a random group of validators is chosen to sign the new block. The more coins in the system a validator owns, the more likely he or she is to be chosen. The template becomes a full-fledged block as soon as all of the validators sign it.

If some of the selected validators are not available to complete the block, then the next winning block is selected, a new group of validators is chosen, and so on, until a block receives the correct amount of signatures. Fees are split between the miner and the validators who signed off on the block.

Proof-of-Burn (PoB)

With proof of burn, instead of pouring money into expensive computer equipment, you ‘burn’ coins by sending them to an address where they are irretrievable. By committing your coins to never-never land, you earn a lifetime privilege to mine on the system based on a random selection process.

Depending on how proof of burn is implemented, miners may burn the native currency or the currency of an alternative chain, like bitcoin. The more coins you burn, the better chance you have of being selected to mine the next block.
Over time, your stake in the system decays, so eventually, you will want to burn more coins to increase your odds of being selected in the lottery.

Proof-of-Capacity (PoC)

As we’ve seen, most of these alternative protocols employ some type of pay-to-play scheme. Proof of capacity is no different, but here you ‘pay’ with hard drive space. The more hard drive space you have, the better your chance of mining the next block and earning the block reward.

Prior to mining in a proof-of-capacity system, the algorithm generates large data sets known as ‘plots’, which you store on your hard drive. The more plots you have, the better your chance of finding the next block in the chain.

By investing in terabytes of hard drive space, you buy yourself a better chance to create duplicate blocks and fork the system.

Proof-of-Elapsed-Time (PoET)

Chipmaker Intel has come up with its own alternative consensus protocol called proof of elapsed time. This system works similarly to proof of work, but consumes far less electricity.

Further, instead of having participants solve a cryptographic puzzle, the algorithm uses a trusted execution environment (TEE) – such as SGX – to ensure blocks get produced in a random lottery fashion, but without the required work.

Intel’s approach is based on a guaranteed wait time provided through the TEE. According to Intel, the poof-of-elapsed-time algorithm scales to thousands of nodes and will run efficiently on any Intel processor that supports SGX.

The one problem with this protocol is it requires you to put your trust in Intel – and that brings us full circle, blockchains are meant to operate trust averse.

 

Conclusion

There you have it that is the basis of blockchain technology.

It is a structured ledger that is not controlled by a single entity and that is as widely distributed to the network participants as possible anywhere in the world, which, thanks to consensus algorithms, does not require participants in the network to trust each other.

There are a wide variety of use cases and practical uses for blockchain technology, which I’ll talk about in upcoming papers.

See how the blockchain matches up against traditional databases – https://blockchainlabs.ai/blockchain-vs-database/

Acknowledgements / References

Artwork:

• Title page “Intelligent Solutions” courtesy of http://www.hloom.com/cover-pages/
• Page header / footer “Abstract blue lights” created by Kotkoa – Freepik.com

Other references:

• https://blockchain.info/charts/hash-rate
• https://blockchain.info
• https://blockchain.info/charts
• https://www.coindesk.com/short-guide-blockchain-consensus-protocols/
• https://www.lifewire.com/cryptographic-hash-function-2625832
• https://en.wikipedia.org/wiki/Merkle_tree

 

Read the original article on Steemit

Advantages of a blockchain system