The first post in this series introduced Bitcoin & the crypto-currency movement that will help drive democratization in the financial industry and society at large in the years to come. This second of five blogposts will discuss Bitcoin (BTC) from a technology architecture perspective. The third and fourth posts will focus on the Blockchain from a business & a technology standpoint. The final post will bring it all together and will cover business models & native application architectures that will be created as part of this immense disruption.
As discussed in the last post, Bitcoin is essentially a novel way of stringing together existing technology (Cloud Computing, Big Data & Cryptography) to provide a disruptive payment service. The very concept and the software based implementation of Bitcoin were originally proposed in a white paper released (November 2008) by an individual(s) under the eponymous name Satoshi Nakamoto. The paper was titled – Bitcoin: A Peer-to-Peer Electronic Cash System. In this paper, the author(s) proposes BTC as a digital currency that overcomes two important challenges that bedeviled cryptographic digital currencies prior to the bitcoin.The term Bitcoin (BTC) is a frequently overloaded term referring to a currency, a digital protocol and also an ecosystem of services. This post will focus on the technology underpinnings of BTC.
To reiterate these –
- The problem of double spending that allowed 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 , a network of distributed servers. The Blockchain operates at such a massive scale which makes it virtually impossible (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.
- For a peer to peer currency to truly work, each member of the millions of global nodes must be in agreement about the ownership of every unit of the currency & the total number of coins any member owns at any given time. This problem of global consensus in a distributed network is solved by the Blockchain. The Blockchain leverages peer to peer communication to achieve consensus on transaction blocks every 10 minutes (avg) while processing newer blocks constantly as business transactions occur using Bitcoin (or any of the other AltCoins). Specialized nodes called Miners perform the issue of new units of currency while simultaneously performing large & complex calculations. Doing these ensures that the Miner node(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 reward. It is almost impossible for this system to be broken 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
Like most modern computing stacks that provide web scale data & application processing capabilities, the most among them notable being the Hadoop ecosystem and modern Cloud Computing architectures built on OpenStack- Bitcoin is essentially architected as a massive peer-to-peer network.
Bitcoin works on top of the IP protocol that connects the internet together. Peer to Peer (P2P) essentially implies a flat network with no single controller or server node. Each node plays an equal role in providing & consuming services on the behalf of users (and their bitcoin wallets). Early peer to peer networks include BitTorrent & Kazaa etc. The P2P nature of Bitcoin ensures that the supply of the currency is regulated by no one authority and the deflationary property of the Bitcoin system’s money supply is distributed evenly by specialized nodes called miners who not only generate the currency but also help secure the network.
The technical architecture of Bitcoin is depicted in the below illustration and is composed of the following 3 core services –
Illustration 1: Bitcoin Architecture
- The Blockchain Platform
- Bitcoin Protocol & Client Application Layer
- Bitcoin Currency Layer
Let’s cover each of these below –
The blockchain is a decentralized database that acts as a highly transparent ledger which maintains all and any transaction records conducted using bitcoins. The integrity and the chronological order of the block chain are enforced with strong cryptography implementation. The Blockchain is comprised of millions of network nodes participating in the Bitcoin network. Each node in the Bitcoin network runs a portion of Blockchain which ensures that every transaction conducted using the Digital Currency is unique across the system.
Bitcoin mining is the core process by which currency transactions are confirmed & processed and eventually included in the blockchain. To be confirmed as valid, transactions are first packed in a data structure & format called a Block that has to satisfy 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 a meritocracy in that systems which can process transactions faster and more efficiently get credited for them. In addition, rollbacks are almost impossible which prevents chargebacks using the bitcoin currency.
Grids of servers called “miners” create bitcoins by constantly computing answers to mathematical problems while simultaneously processing transactions. It is to be noted that any node participating in the bitcoin can be a miner provided it runs the full stack of Bitcoin software. Once it is a designated as a Miner, it can first certify and then record transactions. The Bitcoin Miner thus plays the role of a Central Bank in creating and updating currency. The Bitcoin architecture is designed such that every 10 minutes, a Miner is able to validate transactions conducted in the last 10 minutes and is rewarded with bitcoins. Every 10 minutes on average, a miner(s) is able to validate the transactions of the past 10 minutes and is rewarded with new bitcoins .The Blockchain (BC) is shared by all nodes & is updated by the miners. The BC maintains an ordered and timestamped ledger of all transactions. Cryptography ensures the constant integrity of the Blockchain.
To give readers a technical sense of the current state of the bitcoin mining process, the miner process begins scanning for a value that when hashed twice with a cryptographic hash function like SHA-256 begins with a number of zero bits. Thus, this has the two pronged consequence that the required computational work required goes up exponentially with the number of leading zero bits required but a hash can always be certified by executing a single round of double SHA-256. Thus, “hard to solve but easy to prove“.
Once the process has produced a valid result, the transaction block cannot be changed without redoing the work. As later records or “blocks” are chained after it, the work to change the block would include redoing the work for each subsequent block.
Bitcoin mining has become a highly resource intensive process with clusters using high end chipsets and CPUs & GPS’s and even FGPA/ASIC technology found in high end architectures.
Majority consensus among the nodes in a bitcoin network is represented by the longest chain, which required the greatest amount of effort to produce it. It is a given that a majority of computing capacity and power is always within the limits of honest miner nodes. Past blocks cannot be modified by rogue nodes as the computational capacity needed to do so will be exponential in terms of surpassing the legit nodes.
PS – Blockchain’s internal architecture will be covered in more detail in the next two posts.
Bitcoin Protocol & Client Layer –
The Bitcoin protocol provides two main functions –
- APIs that mediate access to the underlying blockchain platform.
- Algorithms that drive & control Miners across the network.
Bitcoin’s API Layer exposes programmatic interfaces & APIs to all the various points of interactions with the BTC system mainly the bitcoin wallet,the blockchain network and transaction services provided by Bitcoin.
Illustration 2: Bitcoin Developer APIs
A list of APIs is called out below and a full list is available at .
Bitcoin’s Client Layer consists of end user software applications that can be installed on a full server or a smartphone or simply used over an internet browser. The client facilitates the generation of security features like private keys and also provides Wallet functionality that facilitates the sending of currency transactions using the client’s private key. As discussed above, the block chain is a shared public ledger on which the entire Bitcoin network relies. All confirmed transactions are included in the block chain. Using APIs provided by the Bitcoin client, wallets can calculate their currency balance and the blockchain network can verify transactions for account limits.
Bitcoin Wallets –
A Wallet is a simple file or database that stores (digital) keys (among other things including addresses & digital signatures) that prove ownership of bitcoins. The keys stored in a user’s wallet are generated and managed by the user’s wallet software without reference to the blockchain or access to the Internet. The usage of keys provides three important functions – a. A model that enables decentralized control b. a high degree of security & c.proof of ownership.
Illustration 3: Bitcoin Wallet from the Core Client from Bitcoin.org
The Bitcoin client can take different forms depending on the amount of control the user desires over their currency transactions – payments & transfers etc. To sum up, there are three main forms of Bitcoin clients :
- Thick (full) client
- The full client also called as a “Full node” is a client that provides the user’s Wallet & stores the entire & complete ledger of transactions using the currency that were ever performed..virtually every transaction. It also provides highly useful information information about the state of the blockchain and (to not put too fine a point to it) the **complete set** transactions conducted using the currency.
- Lightweight client
- A lightweight client stores the client’s wallet but relies on third-party–owned servers for access to the bitcoin transactions and network. The light client does not store a full copy of all transactions and therefore must trust the third-party servers for transaction validation.
- Web client
- Web clients as accessed as a service over a web browser. They are the easiest to use but do not provide any of the advanced features the other two types of clients provide. Bitcoin is also very mobile friendly and provides clients for smartphones, that can either operate as full clients, lightweight clients, or simply web clients.
Vendors like mSIGNA build on top of the core APIs to provide advanced yet easy-to-use wallet featuring speed and simplicity, enterprise-level scalability, and strong security. Advanced clients like those of mSIGNA support a range of capabilities beyond the vanilla – multisignature transactions, offline storage, multidevice synchronization, and encrypted electronic and paper backups (src: mSIGNA).
Bitcoin Nodes use the peer-to-peer IP network to process and verify payments. Bitcoins are sent from one address to another using transactions and the network thus forms a highly secure payment network. The nodes can take one of four personas as depicted in the picture below.
Illustration 4: Four Node Personas in a Bitcoin Network
The “Satoshi” reference client that is downloadable from bitcoin.org is a complete implementation of all node personas depicted above. It includes a complete copy of the bitcoin ledger & filesystem, client wallets, a transaction verification engine. It plays the role of a full network node in the peer-to-peer bitcoin network. A client configured as as a full client joins up the blockchain network and downloads the complete transactions onto itself in a process that could take anywhere from hours to days.Such nodes discover and connect up with their neighbors in the p2p architecture, then receive, validate and then propagate transactions and the relevant blocks. This routing functionality is depicted as the “Routing Node” in the above picture.
Transactions are messages that denote business actions using bitcoins. Naturally, they are are the heart of the bitcoin system. Client applications create transactions that are then propagated into the network, processed & committed by Miners and then finally added to the indelible record that is the Blockchain ledger. Transactions are essentially data structures that encode the transfer of value between participants in the bitcoin system.There are multiple types of transactions depending on the use case ( a credit card payment, wire transfer & a payroll transaction sent to hundreds of receivers) but they all have one or more Inputs and one or more Outputs. This is to ensure that bitcoins can be split and combined. Common transactions will have either a single input from a larger previous transaction or multiple inputs combining smaller amounts, and one or two outputs: the first one for the payment of the transaction, and second one returning the change owed to the consumer. The transaction fee to the miners is the difference between the input and output amounts.
Illustration 5: Blockchain’s Transaction Explorer
Bring it all together –
Let us now consider an end to end BTC Wire Transfer Illustrated using all the concepts discussed above – Wallets, Transactions,Miners & the Blockchain.
The below diagram illustrated how the process works end to end while bringing together all the technical building blocks discussed above & is largely self explanatory-
Illustration 6: End to End Wire Transfer using BitCoin
 “Mastering Bitcoin” – Andreas Antonopoulus – O’Reilly Press