A lot of people are talking about blockchain these days. They’re talking about blockchain as the next big thing after mainframes, computers, the internet and social networking. This introduction is the first part in a series of blockchain posts.
In this first article about the innovative blockchain technology, we’ll cover the following topics:
- Blockchain and its relation to Bitcoin
- What is blockchain
- Types of blockchain networks
- The consensus process
- Smart contracts
- Valid blockchain business cases
- Existing platforms
- Thinking decentralized
- Recommended reading
Blockchain and its relation to Bitcoin
First of all, Bitcoin and blockchain are two different things. People tend to use both words by each other in three different contexts:
So when talking about Bitcoin or blockchain with people, it’s important to mind this terminology. Here’s a funny quote I read in the book Blockchain: A Blueprint for a New Economy, which describes this ambiguity very well:
It's as if PayPal called the internet PayPal on which the PayPal protocol was run to transfer PayPal currency.
In January 2009, the Bitcoin network came into existence. Bitcoin isn’t the first attempt to digital currency, but it’s the first one that uses a peer-to-peer network to create a platform for executing transactions without depending on central authorities who validates them.
You should see Bitcoin as the first platform that implemented blockchain technology.
What is blockchain?
So forget about Bitcoin now. That’s not what this post is about. People say blockchain is as important as the introduction of the internet. The internet is a worldwide network to share information with one another, but it is far less suitable for transferring value. If you send someone a file, it is always a copy of your file, which means you and the receiver are both in possession of the file. As we already stated, that is ideal for sharing information, but not applicable for money, certificate of ownership, and so forth. And the latter is exactly what blockchain enables: digitalizing and transferring such values.
Let’s take a look at the underlying decentralized ledger technology. We believe blockchain’s definition is a good starting point:
“Blockchain is a type of distributed database that stores a permanent and tamper-proof ledger of transaction data.”
Blockchain is a decentralized immutable data structure. In short the blockchain is a network of computers, called nodes. Every node has the same copy of the database which they manage together. A transaction is encrypted and signed on a mathematical way. When a transaction is saved in the blockchain, it is duplicated across all nodes in the network. That’s why we talk of blockchain as distributed ledger technology, a ledger of transactions, distributed across a computer network. Transactions are bundled in one block before they are validated by other nodes. Once the network reached consensus about the validity of these transactions, the block is appended to the existing chain of blocks. The block stores the validated transactions together with a hash and a reference to the previous block. Stored transactions cannot be undone, as this would invalidate all hashes in the chain.
Now a little more in detail…
Transactions are broadcasted to the network for miners to mine. They assess the non-validated transactions on the memory pool by solving a mathematical puzzle. A miner builds a block containing all transactions, a proof of work that the puzzle was solved (also known as the block root hash, which is also the ID of the block) and a hash to the previous block.
A block also contains the following items:
- A timestamp
- a nonce
- and a merkle root hash
A merkle root does not verify transactions, but verifies a set of transactions. Transaction IDs are hashes of the transaction, and the merkle tree is constructed from these hashes. It means that if a single detail in any of the transactions changes, so does the merkle root. It also means that if the exact same transactions are listed in a different order, the merkle root will also change. So the merkle root is cryptographic proof of the transactions in the block together with the order they are in.
The nonce number is a field whose value is set so that the hash of the block will comply with the predefined network rules (eg: a run of leading zeros in Bitcoin). Miners increase the nonce until the hash is valid. Sha-256 is used to hash.
The miner appends the block to the blockchain. And the majority of the other nodes, 50% + 1, double-check by verifying the proof of work in the block. It sometimes occurs that miners will validate two blocks at the same time and they will be appended to the chain. When this occurs, which doesn’t happen often, the principle of Longest Chain Wins will be implemented. The longest chain remains and the conflicting chain will be discarded. The transactions of the discarded chains will be put back in the memory pool to be mined another time.
You now have a basic understanding of why we call it the blockchain.
Types of blockchain networks
Public blockchains (aka. permissionless)
This is a blockchain that everyone in the world can view, write transactions to, expect that these transactions will be validated and added to the blockchain. In this type of blockchain network, any connected node can contribute the consensus process. This process is used to determine if a block is valid or not. You can read more about the consensus process further in this blogpost.
The public blockchain is generally a complete peer-to-peer network. Its characteristics are:
- The users from the chain get protected from the creators of the chain, because there are actions to the network that even they cannot perform. Developers are not the owners of the network and don’t have more or less privileges than normal users.
- These chains are transparent because everyone can see what is happening inside the chain.
"In some cases, public is clearly better; in others, some degree of private control is simply necessary. As is often the case in the real world, it depends." - Vitalik Buterin of Ethereum
In this type of blockchain network, the consensus process is executed by a predetermined group of nodes in the network. Let’s take a consortium of fifteen financial institutions as an example, each with a node. From this group of fifteen, there are ten nodes that need to sign each block before it is valid. You could say that these ten take ownership of the data in the blockchain. They decide which transactions are valid and which ones are not. Read rights can be public or restricted to the members of the network, eg. we can limit public view to a set number of times.
Public and consortium blockchain networks are decentralized, with the difference that the consortium network is not completely peer-to-peer, because not everyone is equal.
Private blockchains (aka. permissioned)
There is only a small difference between consortium and private blockchain networks: write rights are with one organization instead of multiple. The read rights can be the same as with a consortium blockchain.
The following characteristics apply for a private blockchain network:
- The company that controls the private chain can alter the rules of the chain. In some cases this can be necessary.
- The nodes that confirm a block are known, so there can’t be a majority by a mining farm with a 51% attack.
- Transactions are cheaper than with public chains. This is because they need to be verified by less nodes.
- Nodes are well connected and errors can be fixed quickly with manual interaction. This means that these networks give a faster confirmation and they will always be faster than public networks.
- Private blockchains are just better at privacy because the access to the blockchain can be limited. From a legal point-of-view, this characteristic can have significant impact on the type of blockchain network you’ll pick.
The consensus process
As we mentioned before, the network must reach a consensus of 50%+1 for a transaction to be written to the blockchain. There are a few ways a blockchain network will do this. We will be discussing the two most used. Ronald Chan wrote a nice article about consensus mechanisms in Consensus Mechanisms used in blockchain.
This is used to deter people from tampering with the blocks and launching (d)dos attacks. We let them do a feasible but not insignificant amount of work to get a consensus. For example in the blockchain they need to find the correct nonce number that is part of the block to create a hash that fits the predetermined rules. A rule can be that the hash must start with six zeros.
In this case you don’t need to find a nonce number but you just need to proof that you have a certain stake in the network. The bigger your stake, the more you can mine from the network.
The term smart contract has no clear and settled definition.
So what is it?
Smart contracts are traditional contracts and official documents, but written in code. As such, the contract is understandable for everyone across the globe, irrespective of the jurisdiction it is related to. Smart contracts are like If This Then That statements, only they tend to be a lot more complex.
The different definitions usually fall into one of the following two categories:
- Sometimes the term is used to identify a specific technology. Pieces of code that are stored, verified and executed on a blockchain. For example, a hello world program.
- The term can also be used to refer to a specific application of that technology: as a complement, or substitute, for legal contracts.
Valid blockchain business cases
It’s important to understand that blockchain isn’t a solution to all of your business problems. Like in any other project, you shouldn’t make critical technology decisions on hyped buzzwords. Instead you should focus on the business value it delivers. When we translate the blockchain characteristics to business values, it can potentially solve business problems in the following five key elements:
We’ll discuss each element in detail and explain why blockchain technology can be an answer to that business problem.
In a public blockchain network, by default every member of the ecosystem can access all transactions stored in the chain. They can even access smart contracts.
An example of improved transparency is in the supply chain. Documenting a product’s journey across the supply chain reveals its true origin and touchpoints, which increases trust and helps eliminate the bias found in today’s opaque supply chains. Manufacturers can also reduce recalls by sharing logs with OEMs and regulators.
Another potential use involves the recording of patents and intellectual property. Due to blockchain’s 100% transparency and its unforgeable nature, the information cannot be altered. Because transactions are easily trackable, it’s the perfect solution for recording ownership of patents and properties.
You can only achieve 100% transparency if you setup a public, permissionless blockchain network. In a consortium- or private blockchain network, you can define access rules to say which members can query certain information, which reduces its transparent nature.
Because business logic is implemented as smart contracts, and smart contracts are replicated over the different nodes that execute them, you have decentralized business logic. This allows you to use the same open source technology in all departments of your business. As a result, business processes are joint together, in contrast to Enterprise BPM, where business logic reuse is limited due to single enterprise data silos.
By using blockchain technology, you have less dependency on a central infrastructure. That is because all nodes can execute transactions. When one node goes down, other nodes take over the processing. You can say that in a blockchain network, you have automatic failover.
We already talked about the fact that activities in a blockchain cannot be undone. They are immutable. Because of this characteristic, there’s an audit trail of what happened in the system.
You could say that this audit trail has a lot of similarities with the architectural pattern Event Sourcing. With Event Sourcing, all changes to application state are stored as a sequence of events. This is comparable to how transactions are stored in the blockchain. It could be interesting to combine both blockchain technology and Event Sourcing principles in a project.
If you want to learn more about Event Sourcing, make sure to visit the following pages:
- There’s an excellent article on Martin Fowler’s blog
- Our colleague Yannick De Turck also has a chapter on Event Sourcing in his blogpost about Lagom
- Ken Coenen has written about CQRS and Event Sourcing too after Ordina JWorks was present at DDD Europe back in 2016
Please note that you can only achieve full immutability if you setup a public, permissionless blockchain network. In a consortium or private blockchain network, transactions can be altered because you know the nodes that validate them.
Blocks are timestamped and protected with cryptographic technology that is considered unbreakable. If a block is added it can’t be removed or altered. If you change a single bit of a transaction, the hash of this transaction will be completely different. So the merkle root hash (Merkle trees are explained in the section What is blockchain) won’t be the same, the nonce number will then be wrong and the block will be considered invalid. In this way transactions are secure once chained to the blockchain.
The cryptographic technology works with the principal of public and private keys, but hashing is also a part of this technology. The private key is linked to the public key, but you cannot find out the private key if you have the public key. The private key allows you to verify that you are the owner of the public key. To make transactions, you’ll need a unique key (private key) to make a digital signature to prove that you are the owner. The private key is stored in your wallet.
Your wallet doesn’t always need to contain money, it can also hold your identity.
The network is also protected from (d)dos attacks because of the distributed nature of blockchain. If a hacker wants to take down the blockchain they would need to take down every node in the network. The proof-of-work can also help deter these attacks and spam because of the high costs of mining. Even if a hacker is able to penetrate one network and attempts to steal funds, there are multiple redundant copies of the same ledger stored around the world. If one is tampered with, the others could be used as a backup to prove what funds actually belong in each account.
We will now discuss a few platforms that can be used to set up a blockchain and also compare Bluemix and Azure.
The first one is Ethereum, a public blockchain. Ethereum looks like the Bitcoin blockchain, but it uses Ether as the currency. It is faster than Bitcoin with a transaction taking seven seconds instead of ten minutes. We can also put smart contracts on the chain, with bitcoin you can only put transactions on there.
Another big one we have is Hyperledger. This is a open source collaborative effort created by The Linux Foundation. Another big partner in Hyperledger is IBM because they helped them with development and donated some patents. Hyperledger is also more focused on private networks. The fun part is that you can run Hyperledger locally on your computer and try out the technology. That brings us to IBM Blockchain. IBM’s Bluemix platform focusses on private blockchains. It empowers businesses to digitize their transaction workflow through a highly secured, shared and replicated ledger. The current technology possibilities weren’t cutting it in terms of privacy so they added their code and patents to the Hyperledger project.
The next one is Multichain. Multichain is an open source private blockchain, which is Bitcoin compatible.
Next up is Openchain. Openchain is a little bit special because it doesn’t use the concept of blocks but the transactions are directly chained with one another, which makes it a lot faster. Openchain is an open source private blockchain. It also doesn’t use proof-of-work but proof-of-authority.
BigChainDB is not really a complete blockchain but it is more a database with blockchain features like: decentralization, immutability, public/private and consensus. BigChainDB is also open source.
Last but not least, we have Microsoft Azure blockchain left to discuss. As you may have guessed, Azure is the complete opposite of IBM’s Bluemix. Azure focuses on being public, although this does not mean they don’t believe in the private model. Microsoft has said that private networks will still be important for the commercial adaptation of the blockchain technology. Microsoft also don’t dedicate their platform to one type of technology like Hyperledger for Bluemix but they support many different technologies like Ethereum, Hyperledger and more. They do have a preference though for Ethereum because they joined the Enterprise Ethereum Alliance.
Last year, Ken Coenen gave a presentation about the popularity of APIs, and how companies team up to create innovative solutions. Data is freed from their silos and made available through APIs. It’s consumable for other departments and even other companies. However, when you think about it, all of this data is centralized and we need extra effort to expose it to other parties.
When working with blockchain technology, your data is decentralized by nature. It’s funny when you think about it… Why do we want to store the data somewhere centralized in a silo and then make an extra effort to expose it? Isn’t is easier to start decentralized from the beginning and give access to the people who need it? What have we been doing all these years?
We’ll give an example. All applications implement their own user profile functionality. All of this user data - your profile information - is duplicated across many companies. It’s already a big improvement that applications allow you to use another platform’s credentials. Logging in with your Facebook or Google account is becoming a habit. This gives the end user a way to minimize his/her digital footprint. Don Tapscott explains this really well in summer 2016’s TED Talk How the blockchain is changing money and business. Of course, blockchain technology is still in its early stages. It’s not even sure whether the technology will last. Although these statements are purely hypothetical, we find much food for thought in them.
When talking with people about the possibilities of blockchain, it quickly becomes clear that we still have a long way to go. People aren’t waiting for yet another technological revolution. Instead, we need to start small. Blockchain and distributed ledger technology in general will have to evolve naturally.
Blockchain solutions like IBM Blockchain or Microsoft Azure Blockchain-as-a-Service make the technology very accessible to companies in an early stage. We believe that a private blockchain network is the best way to start for a company because of the following reasons:
- Throwing all your data at the world is still a very scary idea
- You have to take all legal aspects into account (think of the EU’s new General Data Protection Regulation)
- You can start small and expose some transactions by defining permissions
Companies are starting to develop applications on their proprietary Bluemix- or Azure platform, without exposing everything to the outside world. Get inspired by visiting State of the Dapps.
You can read the following books if you like to get a grasp on possible use cases which can be implemented using blockchain technology. Please note that neither of these books will deep dive into the technical aspects.