The Architecture of Blockchain
Vamsi Talks Tech
The Architecture of Blockchain..(Four/Five)
The easiest, as well as the most comprehensive way, to define the Blockchain (BC) would be to to call it a “a very secure, resilient, algorithmic & accurate globally distributed ledger (or global database or the largest filesystem or the largest spreadsheet) that provides a foundational infrastructure pattern to build numerous types of applications that help companies (across every vertical), individuals and society detect fresh business models, transact, trade & exchange information & assets. “
Why is the Blockchain such a terrific innovation?
The creation of the Blockchain by the eponymous Satoshi Nakamoto is nothing brief of a work of disruptive genius. While Satoshi’s objective was to create a currency (bitcoin) that did not need a central authority to create, validate & maintain, the architecture as laid out provides the chassis for running truly distributed applications that eliminates the need for 3rd party verification – thus establishing a true peer to peer economy.
Let us consider Banking as we have known and understood it for almost four hundred years.
Banking is a system of intermediaries across the spectrum – ranging from payment networks (e.g Mastercard, Visa etc) to Clearinghouses in Capital Markets to Banks etc . And the reason these intermediaries exist is to establish trust inbetween two parties who do not know each other. Thus currency or any other financial instrument created without the need for a central authority needs to be protected from fraud & manhandle. In Banking, large institutions stand behind and protect payment systems.
The Blockchain serves that purpose in the sphere of the Bitcoin and stands behind every bitcoin ever created by maintaining the proof of ownership.The innovation is it’s openness yet it’s security which ensures that the currency is tamper proof.
Prior to Blockchain, two significant shortcomings had hindered the development of a truly secure digital currency.
- Currency Counterfeiting – The problem of dual spending that permitted the copy and reuse (effectively counterfeiting) of digital currency again and again (much like an mp3 file) after issue. What is different with bitcoin is that once a bitcoin has been purchased or transferred anywhere in the world – ownership is established and recorded authoritatively via the Blockchain . The Blockchain operates at such a massive scale which makes it virtually unlikely (and cost prohibitive) to hack or otherwise break into bitcoin. Thus there is no need for a central 3rd party to a issue, authenticate and validate ownership of the currency.
- Who is the definitive legal proprietor of a given unit of Currency ? – For a peer to peer currency to truly work, each member of the millions of global knots must be in agreement about the ownership of every unit of the currency & the total number of coins any member possesses at any given time. This problem of global consensus (also called the Byzantine Generals problem) in a distributed network is solved by the Blockchain. The Blockchain leverages peer to peer communication to achieve consensus on transaction blocks every ten minutes (avg) while processing newer blocks permanently as business transactions occur using Bitcoin (or any of the other AltCoins). Specialized knots called Miners perform the issue of fresh units of currency while at the same time performing large & sophisticated calculations. Doing these ensures that the Miner knot(s) can mine a block of transactions during the same time. The benefit to the Miners is that they can keep the transaction fees associated with that block as a prize. It is almost unlikely for this system to be violated into as it is in the interest of all the miners to form a distributed consensus based on valid block information. This capability is termed as the proof of work
Blockchain Architecture Considerations:
When one examines the architecture of Blockchain, a few significant design aspects that need to be discussed are –
- The Blockchainplatform itself
- The role of Knots in constituting the overall blockchain & the Knot discovery process
- Transactions that make up the blocks running in the Knots
- Security implementation that generates the Blocks
- The process of adding newer blocks to the Chain
Illustration one – Wire Transfer of Bitcoin using the Blockchain collective ledger
Lets examine each of these in the context of the current public blockchain in terms of an end to end transaction shown below. It is my expectation that other kinds of blockchain variants will leverage the current technology as a foundational design pattern while layering in their own industry or consortium specific requirements.
The Blockchain itself is an application that runs on a network of distributed servers. The core application is a transaction database modeled as a secure ledger, that is collective by all knots (servers) that run the utter stack install. It is thus a 100% decentralized transaction system that acts as a very semi-transparent ledger. Any knot running the Blockchain software can run the entire Blockchain locally. While the Blockchain client uses Google’s LevelDB database to store metadata internally – the Blockchain data can be stored in a plane file or in a relational DB depending on user preferences.
The below architecture diagram broadly captures the three main layers of the Blockchain along with their roles.
Illustration two – Blockchain Architectural Layers (Click to increase)
Once installed on a server, the utter Blockchain client syncs up with other knots in the network. From then onwards the particular server maintains all and any transaction records conducted using bitcoins (or any other application running on the Blockchain). The integrity and chronological order of the transactions (& the addresses wielding the currency) are enforced by strong cryptographic rules. As stated above, the Blockchain software operates at such a massive scale which makes it virtually unlikely (and cost prohibitive) to hack or otherwise break into bitcoin or any other application running on it. Thus there is no need for a central 3rd party to a issue, authenticate and validate ownership of the currency.
The knots in the overall network use the peer-to-peer IP network to process and verify transactions. When several knots all have the same blocks in their individual databases, they are considered to be in consensus.
Blockchain is a peer to peer (P2P) network working on the IP protocol on the internet. A P2P network is essentially a plane topology with no centralized knot, hierarchy, or special server knot. All knots identically provide & can consume services while collaborting via a consensus service.
As discussed above, the knots in the blockchain play the role of a Central Bank or a trusted third party. Every knot maintains a fully replicated copy of a database that contains the payment history of every bitcoin ever created along with ownership information. As transactions happen using the currency, a consensus mechanism essentially dictates how knots agree on blockchain updates.
The graphic below shows the current number of knots active in the bitcoin network and their locations on the globe.
Illustration three – Blockchain Knots – Jan 25,2016 [Four]
However the blockchain enforces an equal structure among all the knots that are part of the network, knots can play different roles based on their flavor or business intention.
Thus, there are four basic knot types as depicted in the below illustration.It is to be noted that all of the knot types detect and maintain connections with peers & also validate blocks.
Total knots maintain a finish copy of the blockchain database and can verify any transaction without the need for an outer lookup. On the other end of the spectrum, knots that only store a subset of the blockchain database verify transactions using a method called Simplified Payment Verification (SPV).
Knots of type Miners perform the core process by which transactions are confirmed & processed and eventually included in the blockchain. To be confirmed as valid, transactions are very first packed in a data structure & format called a Block that has to please strong cryptographic rules that are verified by the blockchain network. Cryptography also prevents already committed blocks from being further modified as doing so would invalidate all following blocks – which protects system integrity. Mining also creates an implicit meritocracy in that systems which can process transactions swifter and more efficiently get credited for them. For applications like bitcoin, rollbacks presently are almost unlikely in the vanilla blockchain architecture – which is a current limitation.
The miner knot concept is unique to blockchain as it confers it a high level of security because brief of controlling more than half the miner knots affectionately termed the “51% attack ” (which is a computationally unlikely feat to perform at scale), the network cannot be compromised or taken over.
Network Protocol Stack : Once knots are booted up, they perform a peer discovery to contact any other valid knot using a given port over TCP. The Blockchain stack is depicted below and is layered on the OSI stack. The Blockchain Message Exchange specifies the handshake logic inbetween knots as well as the serialization format for messages exchanged over the wire.
The Blockchain Overlay Network provides higher level semantics that permit numerous types of blockchains (public, vertical specific & private blockchains) to co-exist as well as provides management abstraction for the same. Developers will essentially use this layer to extend vanilla blockchain to support other kinds of applications which can leverage the existing bitcoin blockchain to validate their transactions. E.g. Other kinds of virtual currency, sidechains etc.
Illustration 4- Blockchain Network Architecture (Click to enhance)
Applications, the very first among them being Bitcoin use blockchain to timestamp transactions. The blockchain implementation consists of two kinds of records: transactions and blocks.
Salient features of transactions –
- Transactions can be created on the behalf of any client using a Mobile Wallet or any other client application
- Transactions contain the actual business data to be stored in the blockchain
- Blocks record the sequence of transactions in the blockchain. Transactions are journaled into the blockchain based on specific sequences
- Miner knots create blocks as discussed in the above section
Illustration 5- Transactions are converted into Blocks (Click to enhance)
The above illustration depicts how currency transactions are converted into blocks. As can be seen,once a transaction (typically a kiosk purchase or wire transfer or credit card payment etc) is submitted into the system, a transaction (say Transaction A) is generated that is shoved into the blockchain knot network. A miner knot(s) intercepts this to do some sanity checking, once done and it is determined that this is a legit transaction, it is fed into a cryptographic hash function as depicted to generate a unique string of digits. It is then also be combined with other transactions as shown. The generated hash is then stored with other metadata into the header of a data structure called a block. The header is key as it becomes the basis for running the hash function again to create a child block.
The hash function is used as the math puzzle that the miners race to solve by looking over virtually trillions of possibilities. The miner that solves it very first submits it for a check by other knots and once confirmed, the block is stored into the blockchain for posterity. The miner knot is then credited a very petite percentage of the transaction as fees.
While that completes our view into the main architectural underpinnings of Blockchain, the next & final post in this series will take a broad look at the innovation that will likely be extracted by the Blockchain across the industry. We will also discuss what steps CXO’s & IT managers need to take to avoid being disrupted by startups in this area.
[Three]”Mastering Bitcoin” – Andreas Antonopoulus – O’Reilly Press