What is a Blockchain ?
By: Connor Wiseman
Tags: Crypto, Blockchain, Future, Decentralization, Bitcoin

What is a Blockchain ?

A general overview of what is this technology and how it works.

Introduction

You may have heard the word blockchain popping up here and there over the last 12 months and it’s most probably because of digital currencies like Bitcoin, Ethereum, Monero, Dash or Ripple. This blog post aims to give the readers a more clear understanding of blockchain technologies and why they are the hottest thing in the world right now. If you have not heard of the blockchain in the last twelve months, it’s alright as you’ve come to the right place because we are about to dive deep into the world of blockchains, so you can gain a sufficient amount of knowledge of the technology, where it came from and where it is going.

Blockchain has been being used for years by government organisations and central hierarchies to keep track of data and other kinds of important information. The first blockchain to be used by the general public was the bitcoin blockchain which was created by an anonymous person or group of people called “Satoshi Nakamoto”. In 2008 Satoshi published a Whitepaper explaining the reasons for bitcoin and why it should be used in society as a medium of exchange or a store of value as its usually referred to now days. In Satoshi’s whitepaper he/she/they explain the need for a global currency that can be transacted in a trustless manner across boarders. He/she/they also explains in the whitepaper how the protocol will be maintained throughout its lifespan, if you would like to read the whitepaper there is a link below.

So why is this new form of technology called a blockchain?Well that’s because a blockchain is made up of blocks of data that run in a linear chain of cryptographic proofs hence the name blockchain. You may also come across other names for a blockchain such as distributed ledgers, or decentralised ledgers so don’t get confused if you hear either of the terms I just mentioned. If it is decentralised, distributed and a ledger it will be a blockchain. Although I will say not all blockchains are decentralised, there are three kinds of blockchains: public, private and a consortium.

A public blockchain is a blockchain that is accessible to everyone and anyone. Where as anyone can participate in the network/protocol and become a user of the service or benefits that it offers. A private blockchain is a permissioned blockchain where by you will only have access to the data or services if your are given the right to do so by someone that has the authority or power to grant you access. Consortium blockchains are blockchains that are run by a few people or groups usually a bank, government or constitution (i.e J.P Morgan, Chase, Barcalays or the NSA)

These consortium chains can only be accessed by people within the consortium community or circle and to provide an outsider with the privilege to view or interact with the ledger would be seen as a malicious act and probably result in banishment from the consortium. The blockchains I mentioned in the first paragraph that where being used back in the 80s/90s would of been consortiums for intelligence services such as the NSA.

What are the principles of a blockchain ?

The principles of a blockchain will vary depending on which kind of blockchain you are referring to and for the purpose of this blog post I am going to focus mainly on public blockchains as they are of my most interest and the area of which I hold most knowledge in. I will touch upon some information for private and consortium blockchains although I will not dig deep into the low level stuff. The three main principles of a public blockchain is that they are

Permissionless- you do not need permission to join in, contribute or utilise the services that it offers. Trust-less- you do not need to trust the integrity of the data on the blockchain or even trust the person or entity you are transacting with over the network. Censorship-resistant- Blockchain is free of third parties being able to manipulate the blockchain by imposing a particular distribution of documents over the network.

Private and consortium blockchains will almost always definitely hold two of the three principles I described above (trustless and censorship-resistant) and public blockchains will always have all three attached to the protocol/network. A couple more important features of a blockchain is that the data on the blockchain will be perpetually immuatable once added so the data will always be their to be viewed by anyone with access. This gives the blockchain a level of transparency. So as a user, you will always be able to see where the tokens, data or information you have received has come from, how long its been there and where the person or business you transacted with aquired the tokens, data or information from themselves before sending it to you.

The transparency of the blockchain is achieved by the immutability which is achieved through a BFT (byzantine fault tolerance) algorithm, which requires validators of the network or nodes to agree that the state of the network is valid and truthful, a consensus of 2/3 of all nodes(more on validators/nodes in later paragraphs) must be reached before a transaction or piece of data is deemed valid. These are the basics of what makes blockchains such a great piece of technology.

Never before have we as a society been able to track the provenance of the products we buy, consume and use on a day to day basis. Never have we been able to send money overseas and have the recipient trust us 100% without having to go through an intermediary and get charged extortionate fees. Never before have we been able to hold voting elections where the public can 100% guarantee that the votes were not tampered with. These use-cases are just some of the many that blockchain technologies are being used right now and with future applications coming in the near future.

Another very important part of blockchain technologies is that they are cryptographically secure by which means that all the data on the blockchain will be in the form of a cryptographic hash produced by a sha256 algorithm. Everything from your user address to the data inside the blocks will be hashed into lengths of byte data. The length of the hashes will also vary depending on how much data is being run through the algorithm. Say in a blockchain like Ethereum, your public key (user name) is 20 bytes and your private key (password) is 32 bytes.

The expression of user name and password is just an anology you dont actually put in a user name and password when generating a key pair for a blockchain. Sometimes you will be asked to create a password but thats only so you can access a JSON file on MyCrypto or MEW.

See the video below for a succinct explanation on sha256.

How does a blockchain work ?

A blockchain operates through nodes or miners participating in the network to validate the blocks that get put on the the chain. Without miners, validators or nodes, a blockchain would not be able to function because there is no one to keep the network running. Each node or miner in the network first has to sync a full copy or lite copy of the blockchain they wish to operate on, they sync the blockchain by connecting to other computers near by that hold a copy of the same blockchain. Effectively this a p2p network of computers all operating together in a synchronous manner.

The first block in a blockchain is called the genesis block. The genesis block will hold all the initial data that allows a blockchain to begin functionality, such as the balances of the addresses that gave funds to the project during the initial crowdfunding or inception. Or in the case of the bitcoin blockchain the genesis block just held the first set of transactions that Satoshi made to his/hers/their peers.

When a transaction is sent out the network in a blockchain the transaction is broadcast across the network and goes to a memory pool, or transaction pool where it will sit until a miner pulls it out of the pool to mine into a block. The transactions will all have a transaction fee where a user must pay to get their transaction mined, thus gives us the creation of cryptoeconomics. The miners have the ability to choose which transactions that want to include in a block and they pick transaction based on how how high of a transaction fee the user has selected to pay. If a user sends a transaction with a low transaction price, it may sit in the memory pool for at least a few blocks or even a day or two, due to miners prioritizing transactions with higher fees first which they do for obvious reasons. You can however send a transaction with a high transaction fee and the transaction will get pushed to the front of the queue and it gets mined within minute or two.

So now you may be wondering okay I understand that for blocks to get put on the chain a miner must pull a load of transactions from a memory/transaction pool and crunch them into a block but how do miners operate the network and how do they know who is next to validate or mine the next block.

This brings us to something called Proof-of-Work (PoW). Proof-of-work is a consensus mechanism where miners have to compete against each other in a race to find a number with a certain amount of zeros attached to it, the number is arbitrary and usually negative something like (0000052783538). What the miners do is perform a mathematics equation over and over until they hit a number within a certain range that is deemed valid for the current hash power. The hash power of the network determines the number in which the miners have to find in order to validate the next block.

Currently in Bitcoin and Ethereum the consensus mechanism is PoW but a blockchain can use other consensus such Proof-of-Stake, Proof-of-Authority, Delegated-Proof-of-Stake and Delegated-Proof-of-Authority.

Proof-of-Stake is where each miner or validator has to stake a certain amount of the native currency of the particular blockchain they are working on. They do not need to solve a mathematics equation to mine the blocks as they are picked at random through an algorithm. Although in some chains the miners with the most staked in the escrow fund will be picked more than the others with less staked because they have more presence in the set of miners.

Proof-of-Authority is a consensus where only people that are the given the right to authorise blocks can do so, although this brings a level of centralisation to the table. Where you could have 10 miners, mining a chain that supports a 1,000,000 users. All of the 10 miners would be able to communicate with each other and stop certain transactions going through to the blockchain. Some public blockchains do have this consensus such as the PoA network and Ethereums kovan testnet but it would mostly be used in a private or consortium blockchain.

Delegated-Proof-of-Stake is the similar as Proof-of-Stake. However only the validators are delegated into their positions of being a validator. The same goes for Delegated-Proof-of-Authority.

How are transactions trust-less and verified ?

Now you know how the blockchain works and how the miners keep the state of the ledger the next learning step is how are transaction trustless and verified by each each node and recipient?

Transactions that happen through blockchain technologies are able to behave in a trustless manner because of the public key cryptography. When a key pair is generated by the software, you are given two keys: one public key and one private key. The public key is the equivalent of the your bank account number and sort code, the length of the public key is 20 bytes (in the case of an Ethereum address) but this may vary between blockchains due to different algorithms generating the addresses. The private key which is generated with your public key is the information you never give to someone when sending a transaction through any kind of service, you can think of it as your logging in details to online banking such as username and password. The private key is 32 bytes long and again this may differ between different protocols.

When a key pair is generated the public key will always be derived from the private key, this ensures the integrity of the key pair, the authenticity and the uniqueness of the keys.

Transaction example:

Lets say that Andy wants to send Barbra some amount of crypto.

But to do this Andy must first ask Barbra for her public key.

Once he has Barbra’s public key, Andy will input the public key into a text bar and the amount of ether that has been arranged between them into another bar.

Once both Barbra’s public key and the amount of crypto is confirmed, Aaron is now ready to sign the transaction with his private key. This is where the trustless nature of the cryptography comes into play

Andy will use his private key to sign the data of the transaction (Bailey’s public key, value amount, Andy public key, gas price, gas limit, nonce and any extra data) into a 64 bit hexidecimal hash which is the transaction hash. This hash will only be generated if Andy’s private key is paired with the public key that holds the balance he is wanting to deduct the value amount from.

If not, the transaction hash will not be generated, once the hash is generated it is 100% a guarantee that Andy is the owner of the public and private key that is sending the transaction and no one else.

Remember that the public key is always derived from the private key so if someone is sending a transaction through a DLT the person sending the transaction must have control of the private key.

The fundamental purpose of public key cryptography in cryptocurrencies and blockchains are to act as the middleman, the intermediary, the Western Union and Alibaba of transactions. Without the public key algorithm transactions on the blockchain would be not be able to happen and there would be no such thing as a trust-less system. However we are lucky to live in such a day and age where these kind of technologies are available to us to utilise. Although I have said that the transactions on the blockchain are trustless, I must emphasise that the public key cryptography ensures that the value being transferred from one account to another is trustless and that the from (sender) account did send what ever crypto it is that is being transferred. This does not mean that Aaron is actually a boy and that his name is genuine, it could be a girl named Alice that has just found 10 million quids worth of crypto. Although this is highly unlikley that this would ever happen. I would just like to say that only the transaction being signed by a private key from which matches the public key are the trust-less factors, not the person you are transacting with unless you know them personally or have conducted some form of visual or physical interaction with the person.

Miners are able to see the validity of transactions due to the accounts nonce which is a incrementing number each account has and it only gets bigger each time a transaction is sent. So if to say that Aaron tried to send Bailey a transaction with a nonce of 1 but he had already previously send 2 transactions to someone else this would be a in-valid transaction and the miners would see this and no process the transaction. The nonce ensures that the double spend problem does not occur and that an account sending a transaction is able to do so while keep the integrity of the state throughout the protocol.

What use cases are there in blockchain technologies?

Thanks to Ethereum we have seen some really exciting aspects of blockchain technologies such as smart contracts, dApps and the web3.0. The Ethereum blockchain is Turing complete which means it is able to run loops and iterate through memory. Thus giving the world a programmable blockchain that allows high level pieces of code to be deployed on the blockchain in the form of a smart contracts and arry logic to create fungible and non-fungible tokens. These tokens, both fungible and non-fungible can be rendered in a way that is both either transferable andor unique, paving the way for many applications such as payments, data management, self sovereign identity management, co-ownerships of real estate, verification of real world stock, agriculture and pharmaceuticals, p2p trading and decentralised autonomous organisations or DAOs.

Use cases such as payments would be fungible to allow liquidity into the crypto ecosystem and data management or self soverign identity ownership will be in the form a non fungible token. See the link below for a detailed analyst of what applications smart contracts can bring to the world.

Conclusion

To break down into simple terms a blockchain is technology that is bringing us immutable data bases that are tamper proof and hack resistant, which provides the new decentralised web3. Public blockchains allow anyone to participate and private and consortiums require a permissioned entry. It may seem crazy all this hype just over a distributed ledger. Although just think how the world could analyse the data that is on the ledger to improve and provide more insight to how the world is now and how companies, government, health services or HR can and will progress.

When the owner of the biggest logistics company in the world such as FedEx is calling blockchain, what they already have but on STEROIDS. Its definitely something that is going to change the way the world operates and deals with every day business.