Blockchain – just the word seems to stir up confusion. Because there is so much confusion surrounding blockchain, it’s often hard to get clarity about what it really is and how it works. Blockchain is not that complicated, rather it’s remarkably simple. And moreover it has the potential to fundamentally change the way that businesses do business. If it does is yet to be seen, but one cannot simply ignore it either. In this post, we’ll attempt to unpack some of the most fundamental concepts of blockchain technology to help you better understand the it.
A blockchain is fundamentally a ledger. A ledger is any record keeping system where the records are added in chronological order. Typically, ledgers are most often associated with finances where the idea has existed for centuries. Other kinds of ledgers include something as simple as a check register or a bank statement. In computing, however, a ledger can be anything that simply records data in chronological order such as a log file. The important thing to remember about a ledger is not so much about what kind of data is written to the ledger, rather that it is written in chronological order.
With a blockchain ledger, the data is chained together by each new record in the ledger containing a hash from the previous record. This makes the data on the blockchain tamper resistant, because you cannot change a past record without messing up the hash.
In the example ledger above, record 102, contains a hash from records 101, and 101 from 100, and so on. Also note that each record contains a timestamp. The timestamp along with the hash are the critical pieces of data on the blockchain.
The Distributed Ledger
The next key concept in a blockchain is how the data is stored. In a traditional ledger, the data is typically stored centrally and a trust relationship between entities is brokered by a central authority. Think about eBay – eBay provides a marketplace for sellers to list items and buyers to buy items. The transaction between the seller and buyer is brokered by eBay and both the seller and the buyer trust eBay without having to trust or even know one another.
With a distributed ledger though, the need for a central authority need not exist because the distributed ledger itself acts as the intermediator. Everyone using the ledger has a copy of it and can read and write to it in a secure way. This enables two parties such as a buyer and seller to interact directly with one another without the need for the middle man.
It’s almost impossible to talk about blockchains without mentioning cryptocurrencies. Cryptocurrencies are things like Bitcoin, Litecoin, and Ether that are exchanged on blockchain networks. These use a distributed ledger to securely track the exchange of the currency. To make the networks work though, the networks incentivise hosting nodes on the network by reward the cryptocurrencies to nodes that do the work of processing and verifying transactions. This is what is commonly referred to as “mining”
Will cryptocurrencies are inextricably linked to blockchains though, it is not necessarily the other way around. Blockchain technology neither needs or requires cryptocurrencies to work, especially with private blockchains. One could think of cryptocurrencies as but one of many possible applications for blockchains, which brings us to the next concept, smart contracts.
Smart contracts fundamentally are apps that run on a blockchain. Just like any other app, a smart contract starts with code, which is then compiled, and then deployed. These were first introduced with Ethereum and the concept has caught on with other blockchain implementations. Before smart contracts, blockchains were principally being used to mediate the exchange of cryptocurrencies, but smart contracts enable blockchains to do much more than that.
When a smart contract is deployed to a blockchain, it becomes an immutable asset just like anything else stored on the blockchain. The contract itself contains methods that can be invoked by way of remote procedure calls (RPC) which execute some code on the blockchain. A contract can store data on the blockchain as part of the ledger as described earlier. Because the data and contracts become part of a blockchain, users can deploy code to a blockchain that can be shared and trusted without the need for a trusted third party.
One thing to remember about smart contracts though, is that while data on the blockchain is immutable, the contract state can be changed by adding a more recent transaction to the contract. Both the old state and new state are still stored, but the latter takes precedent for the current state of the contract.
On to part 2…
This concludes part one. In our next post, we’ll look at setting up a blockchain for doing development work with Smart Contracts.