Demystify Blockchain
Public blockchain: A decentralized game theory
In previous posts, we went through the fundamentals of blockchain data structure serving as a tamper-proof data storage as well as a transaction-ordering mechanism that are carefully designed for permission-less decentralized systems such as Bitcoin and Ethereum. We also covered how classic cryptography techniques are used in these systems for transaction repudiation. In Post 1, we explained how Bitcoin can prevent various malicious activities using the fictional examples of Tom, Jerry and Mickey. However, we intentionally did not address one attack that is commonly seen by centralized systems: the Denial of Service (DoS) attack. Note that DDoS (distributed DoS) is to carry out DoS with distributed resources and/or to aim distributed targets and the nature of the attack itself does not change. For the simplicity of discussion, we classify all such attacks as DoS attacks.
- So, is it possible to carry out a DoS attack to a permission-less decentralized system such as Bitcoin or Ethereum?
At a reckless glance, it seems very hard to play a DoS attack to a decentralized system. You may think that it would be very hard for an attacker to flood all of the hosts in the system or even simply impossible to locate all the hosts. However, believing or not, carrying out a DoS attack to a decentralized system is as easy as or even easier than to a well-protected centralized system. Although many hosts exist in the decentralized network, due to the blockchain mechanism, only one block at a time is being created and published to the network. If this block cannot efficiently pack meaningful transactions, every participant in the network have to wait until next block to include their transactions. Therefore, as long as an attacker can flood the network with meaningless transactions, a DoS attack is successful.
Of course, this is foreseen by Satoshi. Therefore, Bitcoin adopts a bid-to-use regulation. In Bitcoin, a transaction initiator attach a small amount of fee (a fraction of bitcoin) that will be collected by a block generator once the block is attached into the main chain. This small amount of fee serves as a tip and the block generator will greedily try to maximize their earnings when ordering all the pending transactions and deciding which ones to be included into the next block. Since Bitcoin's computation is unitary, changing two accounts' balances, the tip mechanism is suitable and effective to prevent abuse of Bitcoin with meaningless transactions. Here, economic principles are clearly brought into the governance of Bitcoin.
Does Ethereum adopt similar principles? Yes. But due to its support of a more generic computational model, the design of its payment mechanism is much more complicated. First, to account that each transaction may involve different number of computational steps (think of a step as a JMP or CMP assembly code), Ethereum regulates that the final fee collected by block generator from a transaction is the number of computational steps times the fee per step, known as gas price (a fraction of ether) and specified by transaction initiator. Second, to avoid misuse or malicious smart contracts that execution never ends (think of while (true) {}), Ethereum requires every transaction to specify a gas limit, which is the max number of computational steps. Third, to prevent malicious attackers who send transaction with very large gas limit and gas price to play DoS and to balance the size of a block for propagation, Ethereum has a block gas limit that is changed from block to block, determined by an algorithm in Ethereum software and voted by the miners.
- So does the complicate payment rules successfully prevent DoS attacks in Ethereum?
Somewhat but not always. An attacker once successfully blocked the traffic on Ethereum to took away more than ten thousand ethers from a ponzi-scheming smart contract Fomo3D. Multiple retrospects of the attack reveal that the attacker carefully orchestrates two accounts on Ethereum, once one of them has locked in as owner of Fomo3D contract, the other one send out transactions with large gas price that would eventually fail (and therefore no actual payment is collected by the block generator) to block the traffic of Ethereum for about 3 minutes. Within this short amount of time, the ponzi-scheme smart contract failed to have a successive owner (as other transactions that try to lock in as owner of Fomo3D are blocked and not picked up by block generators) and relayed the accumulative ether to its last owner, the attacker. You can find more details online by searching keyword Fomo3D.
Now that we talked about bitcoin and ether and how a fraction of such cryptocurrency are paid by transaction initiators as an incentive for miners (block generators) to include their transactions in next block. You may wonder:
- Where come the bitcoins and ethers originally?
The answer is a little different for Bitcoin and Ethereum. In Bitcoin, the first block (genesis block) is mined by Satoshi and as a reward programmed in the software, a number of bitcoins are added into his account. From then on, each block miner gets rewarded with a certain number of bitcoin when they successfully complete a PoW calculation and attach a new block to the main chain. These bitcoins are transferred to more other accounts and starting to circulate in Bitcoin. In Satoshi's original design, the total number of bitcoins is fixed and the block reward decays along with the time. This design leverages another economic principle to encourage early adopters with potentially larger rewards in the future: it is easier to compete on PoW and the reward for each block is larger at earlier days although the bitcoins are less valued since the adoption and acceptance of Bitcoin is low. It is much harder to compete on PoW with larger set of miners and the reward for mining decays yet the bitcoin are more valued since the adoption and acceptance of Bitcoin becomes high.
In Ethereum, an initial coin offering event (the Ethereum presale) was carried out before Ethereum starts its network. By then, you may get an ether with as low as a little over 30 cents and your account with your investment is recorded in the genesis block. After Ethereum begins its operation, it also rewards the block miners with ethers accordingly. However, different from Bitcoin's design that the level of mining difficulty increases block by block and the total number of bitcoin is hard coded to a limit, Ethereum founders seeded a mechanism to introduce "difficult bomb" to manipulate incentives for miners to move to new protocols that are not backward compatible with previous ones. The introduction of Proof-of-Stake, known as PoS as part of Ethereum 2.0, is one potential timing that a difficult bomb could be deployed. However, if existing miners are unwilling to switch, the system could still encounter a hard fork, a potentially similar destiny as Bitcoin and Bitcoin Cash.
By answering the questions on DOS-attack prevention and mentioning hard forks, we are actually getting into a core piece that is technical yet also quite political in permission-less decentralized systems: governance. Bitcoin and Bitcoin Cash are the two forks of original Bitcoin. Both communities try to address the performance issue in original Bitcoin software but took two different approaches. Ethereum community is also actively researching solutions to address scalability and performance issues of current Ethereum. Yet, how would existing miners accept the new solutions is still up in the air and considering that various of core early-day Ethereum members fell out and started other protocols, it may not be optimistic. Although it could sound sophisticated, I have to say whatever regulation has its own limitations and no one can design a set of rules for unlimited future without any violation or deviated interpretation of the system's original intentions. Hence, Bitcoin and Ethereum are as fragile as governments, regardless being democratic or autocratic.
Decentralized autonomous organization (DAO) governance is a heated cutting edge topic and most likely a new research area in math, economy and politics. Retrospect on Bitcoin and Ethereum, although they are designed to be decentralized, the voting powers inevitably concentrated after sometime. Such concentration is subtle, yet breaking the delicate equilibrium of the system and annul effectiveness of carefully designed governance mechanism. ASIC and GPU are likely unexpected yet definitely doomed as well as anti-globalism and populism.
Regardless the potential turmoils that may come to these decentralized permission-less systems,
- Why do bitcoin and ether bear value?
The answer is unfortunately short and brutal: no, they don't. One argument on the value of bitcoin comes from the scarcity of the cryptocurrency. According to Satoshi's design in Bitcoin whitepaper, it is true that the total amount of bitcoin has an upper bound. Therefore, it is almost very reasonable to benchmark the value of bitcoin against the value of rare metals such as gold, silver etc.. Consider that bitcoin is much easier to use and circulate, it may bear an extra value on top. When think deeper, it is not hard to see that the scarcity of rare metals cannot be fully guaranteed with the advances of technology: people could be able to travel and find abundant gold in extraterrestrial galaxies. It is the same for bitcoin: the advances in computational technology, such as quantum computation could well challenge the base assumptions that guard the scarcity of bitcoin. Comparing to the technological advances that enable people to explore extraterrestrial spaces, which are still quite fictional, the computational technology advances are much closer to real applications in my point of view.
Actually, after so many discussions about how things are working in Bitcoin and Ethereum, from a software developer's perspective it should not be too hard for you to conclude that cryptocurrencies are simply digital records stored in many computers' hard disks that are owned by various people worldwide. It is a perfect analogy as fiat currencies that are circulated around the world. The paper bills themselves carry little value, it is the people's believes entitle them values: the believes in the existence of future acquirers who will ultimately give up physical resources in exchange of the currency, crypto or fiat. We will further illustrate the power of belief in next posts about MakeDao and Libra.
Stay tuned.