How does the blockchain work? Explained for non-techies
By Alexander Hemdorff Koch, Blockchain enthusiast.
This is the second article in a three piece series. The first article covers what disruptions blockchain might bring about. This the second covers a technical description in layman terms of what the blockchain is. The third explore which areas of businesses should investigate blockchain for efficiency gains
Did you miss the first article? Find it here: https://lnkd.in/eXYNTkk
The Blockchain term refers to the underlying technological innovation that enabled Bitcoin rather than Bitcoin itself. There are two reasons for this, the first is that Bitcoin in its early years got some bad press, justified or not. The other reason is that Bitcoin as a project has been rather conservative in its development plan. Bitcoin has stuck to its main use case of being a currency first. Blockchain as a technology is much more than Bitcoin and has several other use cases.
This article explores Blockchain as a technology and covers some of the different use cases. The aim of this article is to communicate what is blockchain and how does it work from a technology consumer perspective.
The Invention of Blockchain
Blockchain is a protocol that was invented in 2008 and its first implementation was launched in 2009 as the cryptocurrency Bitcoin. The invention was published as a white paper to a cryptography mailing list. Cryptography is the practice of ensuring secure communication, think spies and the military. The white paper was released under synonym Satoshi Nakamoto, the real identity of the author is still unknown.
The breakthrough promised in the white paper is solving the double-spending problem in a decentralized system. For currency, not being able to spend your balance twice is an obvious necessity. Solving the double-spending problem also enables various other applications like distributed databases, Smart-contracts and more.
Traditionally a master slave structure is required in a distributed network to ensure unison and wheat out bad players. With the blockchain, participants in the distributed network compete to be the master of the network at an interval.
As mentioned in the previous article blockchain has the potential to digitalize some of the oldest processes of the modern society. This includes but is not limited to our financial system, our judiciary system and the interfaces in business-to-business. These systems all have that in common that they use a 3rd party role to establish trust.
Financial Processing
In current financial processing banks use a settlement layer with a guarantor to conduct international transactions. Blockchain can optimize that process with the application cryptocurrency. A crypto currency is when the protocol that is blockchain is used to keep count of balances (decentralized database) and transactions between accounts. Bitcoin is a cryptocurrency and is being traded within an ecosystem of its own transactions and exchanges. Cryptocurrencies are given value by the market. This can be done because the rate of inflation is known and balanced can’t be double spend.
Banks could in theory use bitcoin by buying up the amount of bitcoin the need from the market, then sending that amount to the recipient bank who then sells bitcoin back to the market. However practically this isn’t possible because of regulation where banks have to comply with KYC, Know your customer. Buying of the market from exchanges that can’t or won’t enforce KYC is off limits.
One cryptocurrency that early circumvented this was Ripple. Ripple uses a role called a liquidity provider to make the market trade. Ripple is not as decentralized as if banks were allowed to interface directly with the market. Ripple is a competitor to the Swift GPII network. Other initiatives for practical implementations include private blockchains where distribution is kept within a verifiable user base.
Judiciary System
In transactions of goods sales and carriage contracts are used. In case of enforcing contracts the judiciary system functions as 3rd party. If buyer or seller doesn’t trust the judiciary system they can opt in to also use a deposit and a trusted 3rd party agent.
When participants of a network have to route through a central hub, that hub becomes a target for attacks. Participants have to trust that the central point isn’t affected by an attacker. An attack can come in the form of corruption or coercion of humans or hacking of systems.
The significance of Blockchain is the promise to facilitate transactions either without a 3rd party agent using programmed contract clause (smart contract) or by adding transparency to the use of a 3rd party role. Programmed contract clauses can be used if the problem is a deterministic algorithm meaning a state machine where the effect on input to output is predictable. Transparency is provided by having an immutable public readable trail of the transaction that can’t be tampered with afterwards.
Fundamentals of blockchain
The name blockchain derives from a series of blocks. A block is a timestamp where transactions between accounts of tokens are balanced. The Timestamp is generated by computers competing to solve a cryptographic math problem (mining). The difficulty of the problem is roughly adjusted every 14 days to account for more computing power being added to the network. If this wasn’t done, the timestamp would be generated faster and faster as computing power on the network increased. The speed of Bitcoin’s timestamping is very conservative (approximately every 10 minutes). Most new cryptocurrencies have much faster timestamping. The benefit of a slow timestamping is that the blockchain is kept smaller. In the case of bitcoin the size of the blockchain is made to match Mores Law predictions of how hard drive space and speed of internet connections will grow. The disadvantage is that timestamping is the same thing as confirmation time of a transaction. For Bitcoin you can’t be truly sure about a transaction until you’ve waited an hour. That is 6 confirmations = 6 timestamps = 6 blocks.
End-to-End Processes of using a blockchain
Scenario A: Share a file while having proof that it was shared a given day.
Scenario B: Make an international financial transaction.
Scenario C: You want to prove a transaction of goods.
Process A: 1) Prepare a file by uploading it to a location where it can be downloaded. The link to the file should be less than 80 bytes 2) Download bitcoin clients with support for colored coins for both sender and receiver. 3) Buy bitcoin and have them deposited into the sender client. 3a) Use social media to do a face-to-face transaction. 3b) Register an account with- and purchase from a bitcoin broker. 4) Send a small bitcoin transaction with the link as a data string attached with a tip generous enough to reflect the transaction size ensuring that the transaction is included in the next block. 5) Receive transaction and read data. Open and download file.
Process A could be made more private by only communicating a public key that together with a private key that the receiver has offline generates the link. Other blockchain projects handle this process much better than bitcoin.
Process B: 1) Download bitcoin clients for both sender and receiver. 2) Buy bitcoin and have them deposited into the sender client. 2a) Use social media to do a face-to-face transaction. 2b) Register an account with- and purchase from a bitcoin broker. Send bitcoin transaction, the standard tipping for the miners should be fine. Wait for 3-6 confirmations to ensure no double spending issues 3) Receive bitcoin and use either a broker or local face-to-face transaction to convert to local currency. Some large cities even have bitcoin ATMs.
Process B is competition to bank wire transfers and western union. It works best for smaller transactions as cost associated usually is a small % where the fee using the traditional methods is flat rate + %.
Process C: 1) Download Ethereum client. 2) Buy Ether either directly or by first purchasing bitcoin and then trading them for Ether. 3) Create a smart contract using the Ethereum client. A smart contract is written in the Solidity coding language developed for Ethereum. The Smart contract should have custom (name & count, decimals) tokens for each asset in the transaction of goods. The type of contract should execute a trade between accounts of token types if both accounts sign the transaction. Then send an approximate amount of Ether to cover the cost of creating the smart contract. 4) Use the contract by Input the values that the contract has to validate. When both parties/accounts have signed the contract a digital immutable footprint of the transaction exist on the blockchain.
Ethereum differs from bitcoin in that data on the blockchain can be amended later if the contract is coded for it. Perhaps in Process C the involved parties want to be able to revoke the trade if they cosign again. Ethereum support both immutable and mutable contracts.
Elaboration on sending a transaction
It is called mining when a block math problem is solved to generate the timestamp. There are now variations to how the timestamp is generated but mining persist as a common term. The two most common types of mining are Proof of Work and Proof of Stake. Proof of Work gains security from cost of hardware, Proof of Stake gains security from having its tokens distributed. With Bitcoin, mining is done by Computers competing to solve a math problem (Proof of Work). The solution to the math problem can only be solved by brute force. While it takes some 10 minutes to solve the problem, it only takes a few seconds to verify the solution by the competitors. The incentive of verifying the solution for the competitors is that the solution is a key that defines the next problem. Sometimes two computers reach the solution within seconds of each other. The winner then becomes the most verified solution. This is often a matter of internet speed. For a brief moment the blockchain will split into two versions, this is called a fork. The computers that compete to mine the blockchain will check themselves whether they are mining the most popular blockchain. The user clients will connect to the most popular blockchain. The popularity is measured by length, meaning count of blocks in the blockchain. As one chain would have more compute power than the other, but both would have to solve problems of the same difficulty, the chain with the most power would grow faster than the other. Incentive in being on the longest chain is significant to why a public blockchain value should have a price.
For most blockchains a block is not limited to a fixed number of transactions; rather it is a fixed amount of storage space. This storage space is called blocksize. Bitcoin’s blocksize is 1MB. Most of that space is only used for transaction related data, but there is an option to attach 80 bytes of data to each transaction. This is not much data, but enough to send a signal rather than a full message or file. The signal will then guide to the full message or file stored separately from the blockchain (off-chain). Bitcoin has been hovering around 1400 transactions per block throughout 2016. A number big enough for Bitcoin as a settlement layer between financial institutions but much too small to rival Visa and MasterCard.
There are three things to consider when understanding the blocksize limit. First is that the limit prohibits spam of transactions on the network. The second is that the limit ensures that the blockchain file stored on each miner and each full client is kept within a reasonable size. The third is that changing the blocksize limit is seen as changing the fundamentals of bitcoin which could indicate that the project is not immutable about its core variables like inflation rate and total ever minable coin cap.
One of the security elements of a blockchain network is that it cannot be Distributed Denial of Service Attacked (DDOS). DDOS is a common way for hackers to put centralized storages out of business temporary. DDOS is favored by the hacker/activist group Anonymous. Blockchain is DDOS proof because to spam a node with transaction would be costly in fees and also limited by the total amount of transactions possible. A bug that allowed DDOS attacks was fixed after the famous Mt. Gox hack.
Elaboration on blockchain interfaces
As an isolated application component blockchain technology is incredibly robust and secure. When taking a more holistic approach to the technology the interfaces to blockchains are still lacking. Today if you want to use a feature of a blockchain you will first have to acquire (buy) tokens on that blockchain from an exchange. Then you have to extract those tokens to your computer where you can then access the API if the cryptocurrency support such to send transactions spending your tokens.
Bitcoin function as the de facto entrance to many other cryptocurrencies. While some of the more popular cryptos have dollar pairing on exchanges only a few of those actually have real volume in their dollar pairing. Cryptocurrency is a use case where the tokens of a blockchain is treated as assets and traded by users. Bitcoin is the first implementation of the blockchain invention and is a cryptocurrency first and primarily.
This year Microsoft announced that they would support Blockchain as a Service on their Azure Cloud Development Platform. What this means today is developers in practice through the Azure platform can interface with blockchains. While this is great news, the API to most blockchains is still lacking and the API between blockchains is still very crude.
Some blockchain projects are trying to overcome this impractical process. The need to bring coin interface out of centralized exchanges is two-fold.
First centralized exchanges serve as honeypots for hackers. A recent study estimates that one third of all exchanges have been hacked. Often the loss is carried by the users as the legislative practice around crypto is still unclear so the exchanges can’t get insurance.
Another issue is that on central exchanges the tokens aren’t active. For security reasons most tokens are kept in what is called cold storage meaning in a format with no access to the internet. This seems counter intuitive to have a digitial peer-to-peer currency offline. Special hardware wallets are used that store the different keys used to unlock the account balance. One could even print out the keys in the format of QR codes and then later load them into an online wallet again. When a token is not active on the network it cannot be used to access the functionality of the blockchain application. Trades on a centralized exchange is not actually transactions on the blockchains. Most exchanges will also lock your transactions for a period of time when depositing and redrawing so exchanging access to new functionality can take hours.
Different crypto projects are trying to deal with this major hurdle by creating Decentralized exchanges and even fully Distributed exchanges. The functionality sharing between blockchains on both types of exchanges are still mostly proof of concept. Focus is on developing the platform rather than the applications right now. Proof of concept is often a simple chat program that sends a message from one blockchains address to another blockchains address. Examples of Decentralized exchanges are the HZ and NXT coin projects. Examples of the Distributed exchanges are the Blocknet and Supernet projects. The difference between decentralized and distributed is whether or not the tokens/coins can be send directly from user to user or if it has to have a mediator node between them. See the article picture for a great representation of the difference between these network types.
A couple of blockchains do API to its chain very well. One such project is Ethereum now almost as known as bitcoin. Ethereum is a Turing-complete programmable distributed computer. Yes distributed as in many computers cooperate to create one giant virtual computer. It is a slow computer but also a very precise computer. Ethereum uses its blockchain to store small instructions of data. It is very easy to interface with that data from its user facing application. A user can both write data to the blockchain but also deliberately mark the data as invalid with a later transaction. The main use case for Ethereum is Smart contracts. A smart contract is advanced scripting on the blockchain where transactions are conditionally executed.
IBM and the Linux foundation is working on a project called Hyperledger also with a focus on smart contracts.