The previous articles in this series have been very abstract, working towards understanding cryptocurrencies as thermodynamics processes. Which is a nice way to think, but the thing about cryptocurrencies is that people want to make money out of them, so how can that understanding be converted into a practical project that yields a good return on investment?
This is going to require thinking and it helps if you’ve studied physics. But the TL; DR; is
- We can find useful parallels between basic physical processes and blockchains which guide us towards developing a system for massive scale.
- Other projects are creeping towards similar ideas by a slow process of trial and error. Convergent evolution leads to protocols that all have similar forms. Understanding the basic physical constraints means we can cut out a lot of the trial and error and go directly to an optimal design.
- Recognising that the Second Law of Thermodynamics is the fundamental thing that makes records irrevocable points us towards ways to get fast finality so that transactions become irrevocable almost instantly.
- Understanding blockchains as a process evolving in time automatically points us towards introducing the notion of space, which suggests a simple way to scale via sharding.
- Basic physical processes use the UTXO model, which is naturally parallelizable.
- The UTXO model incorporates conservation laws. This can be mapped into conservation rules for any number of tokens.
- A sharded UTXO system with any number of tokens gives you 95% of the utility of smart contracts, without having to write smart contracts.
- Creating Non-Fungible tokens become trivial. No need for the complexities of ERC-721 or ERC-1155.
- Because any transaction can include many token types then such a system is a decentralised exchange by default.
- Because it maps to basic physical processes and allows multiple tokens it’s perfect for supply chains and games.
For the curious, read on
The Moving Finger writes; and, having writ,
Moves on: nor all your Piety nor Wit
Shall lure it back to cancel half a Line,
Nor all your Tears wash out a Word of it.
The Rubaiyat of Omar Khayyam 1120 AD
Which is a poetic description of what blockchains are trying to accomplish, records that once writ can’t be unwrit.
Indelible records are important because they allow communities to keep track of rights and obligations between members, which is what money is. A way of recording who owes what to whom.
In the previous articles I’ve explained how cryptocurrencies use a source of negative entropy or ‘order’, in the form of electricity to create very highly ordered records, i.e. very low entropy, and at the same time make sure they can’t be changed easily by exporting high entropy. Making sure the records are indelible requires using the Second Law of Thermodynamics, because that says in a closed system (e.g. the Universe) entropy must always increase. In fact it’s the increase in entropy that ensures we can’t go backwards in time to unwrite what has been written. That would violate the Second Law of Thermodynamics. As far as we know time flows in one way because of the Second Law of Thermodynamics
A single blockchain is in effect a single world line evolving in time. So the obvious thing to ask is ‘What about space?’ Can we create a blockchain that encapsulate the notion of space as well as the notion of progress in time?
The obvious way to do this which is a use an analogy for space-time and set up a multi-shard blockchain, introduce a concept of distance between shards and arrange things such that each block uses the block hash from the previous block in the chain as normal but in addition the hashes from the previous blocks of its neighbours. Like this ;-
Displayed with just one spatial dimension, but of course you can have many.
The effect of this is to massively increase the amount of entropy added at each step which makes it very hard to reverse. Once information from a block has been transmitted to other agents which aren’t controlled by the block author then it’s almost impossible to revoke the block. As an example, if the shards are on a simple two dimensional square lattice, then each shard will have 8 neighbours. That means that in the next step after a block is created it’ll get 9 confirmations, and in the step after that an extra 25, so in just 2 steps you get 34 confirmations.
That means you get finality very fast, effectively after just one step.
Which is a good, but there’s a technical problem, standard blockchains do need to rewrite history when recovering network partitions but in a block lattice it’s virtually impossible to recover from network partitions. Network partitions happen roughly once a day in Bitcoin and more than that in Ethereum. It’s possible for separate blockchains to run independently for a while, and then reconnect. When they reconnect there’s a simple rule to decide which chain is the correct one, it’s the one with the most work. In a sharded system where chains distribute block hashes to neighbouring chains recovery from network partitions is really really hard because information has been spread out across the network so chain reorganisations are close to impossible.
The problem of network splits stems from the fact that BTC, ETH and similar are permissionless. Anyone can take part. Which means that at any moment in time there’s always a possibility that someone can come along and present a chain with more work, which then becomes the canonical chain. This happened to Ethereum Classic last year where someone did a 51% attack. They rented some hash rate, ran the chain independently for about a hundred blocks and then presented it to the world as the canonical chain. Read about it here
First of all such an attack would be very hard to do in a block lattice because the attacker would also have to mount an attack on the neighbours of a chain, and the neighbours of the neighbours and so on. The Kadena team have done some analysis of the probability of such an attack on a block lattice being successful and found that it’s almost impossible (analysis of Kadena Chainweb). Although network splits are not malicious, they have a similar form to 51% attacks. Part of the hash rate is used to work on a chain other than the main chain.
In proof of stake systems, e.g. Cosmos, EOS you don’t get those problems because there’s a limit on the number of participants. You can’t follow the procedures for Byzantine fault tolerance to get agreement between 2/3rds of the participants unless you know the total number of participants in advance. In these cases if you lose contact between participants the network just stops working. A sharded system is best run as a proof of stake system using a Practical Byzantine Fault Tolerant (PBFT) protocol to avoid network splits in the first place. Therefore in a block lattice protocol we’re pushed towards some form of Proof of Stake with PBFT for our consensus protocol.
Sharding is easier with the UTXO model
Another issue is that in sharded system you can’t know the state of an account held in another shard and the same block height as the block you’re working on. Which makes it impossible to write code that depends on knowing the state of an account, e.g. the balance held.
An account balance is the sum of all past transactions for that account calculated ‘now’. But in a sharded system there can be no universal ‘now’. This is true of all systems where information takes time to move from one place to another, in particular it’s the case right down at the fundamental structure of space and time as discovered by Albert Einstein in 1905. It’s called the relativity of simultaneity
The problem is easily seen if we look at a space time diagram.
In the diagram the lines ct and ct’ are the world lines traversed by things moving forwards in time. In those cases it’s possible to define a clear past present and future. But on the lines x and x’ which represent lines through time to get a concept of ‘now’, it isn’t possible to put events in a consistent order. There is no universal concept of ‘now’ because it depends on the motion of an observer. This applies not only in spacetime but in any situation where there is a time delay sending messages from one place to another, and this is the fundamental reason why it’s hard to maintain a consistent ordering of events in sharded systems.
This is important for account based systems like EOS and Ethereum because they rely on events happening in a definite order and the value of an account is the sum of all previous transactions moving value into or out of the account. It relies on a universal ‘now’, which doesn’t exist in sharded systems unless you work very hard, add lots of complex rules and bash things over the head to make the concept of ‘now’ apply for all shards in the system.
This is why Ethereum 2.0 uses ‘roll-ups’ of transactions, to sum the past history up to that point to get a value for the account ‘now’. Effectively retrofitting the UTXO model, and then bashing it to making it behave like an account based model. But you still have the problem that a smart contract running in one shard cannot know the value of an account in another shard at the same block height. Which is a deep problem when trying to run smart contracts on a sharded account based system. Hence the complexity in Ethereum 2.0 and why it’s taking so long. But…
UTXO based systems don’t have that problem, because you only care about the inputs and outputs to a single transaction. Transactions map directly to events in space time. They are the financial version of Feynman diagrams which describe fundamental events in space time. Here’s an example below
Reading the above diagram, time goes upwards, a neutron comes in at the bottom as the ‘input’, an event happens, equivalent to a transaction, and a proton, electron and antineutrino emerge at the top as ‘outputs’. We can take a lot of inspiration from this.
- Exactly like the UTXO model, quantities in a transaction are conserved. The sum of energy, momentum, angular momentum, electric charge, colour charge and lepton number on the inputs must be the same as the outputs.
- But many different quantities are preserved in the these fundamental transactions. Which inspires the idea that we can have any number of tokens as long as the rule sum of inputs = sum of outputs applies.
- To keep the rule sum of inputs = sum of outputs we’d have to have negative amounts. Which has useful applications in financial instruments.
- There are simple rules which govern what can happen in a transaction. Simple rules can create complex behaviour. You don’t need a Turing complete scripting language.
- It’s easy to run lots of these transactions in parallel. Nature does it.
- The actor model of computation was inspired by exactly this type of physical process (see Wikipedia article) and leads to programming languages that implement the actor model, which are therefore ideal for coding massively parallel blockchains, mostly notably Erlang/Elixir which run massively parallel telephone exchanges and message passing apps like Whatsapp and Discord.
A deeper understanding of the fundamental physical processes in cryptocurrencies allows us to take a short cut to useful protocols without having to make long detours through trial and error. E.g. Ethereum is only just now having to come round to retrofitting a quasi UTXO model, because that’s parallelizable, but it’s completely obvious that it has to be like that by looking at a spacetime diagram.
With that worked out we can think of new blockchain protocol taking inspiration from fundamental physical processes.
- A sharded system where each block depends on previous block hashes from its own and neighbouring shards. Also introduced by Kadena
- A UTXO model with multiple tokens at the base layer, also suggested for future development in Cardano
- A simple non-Turing complete scripting language. Also suggested by Kadena and in this research paper
- Use Elixir/Erlang because that’s a massively parallel functional programming system which implements the actor model of computation therefore it maps cleanly to a sharded UTXO system.
- The consensus model has to be one with a restricted number of participants in each shard. POS and DPOS seem a good fit but the obvious problem is plutocracy, especially considering that rich people are on average more dishonest that non-rich people. The next article discusses a novel 3-vector consensus model that ameliorates the problems of plutocracy.
Put together we get a system that can handle very high volumes, 1,000s of transactions per second, which has multiple tokens without complex smart contracts. It’s ideal for cases where you need simple transfer of value, with many possible values. By default it’s a decentralised exchange Supply chains are an obvious use case because you need to track many thousands of different products and allow new tokens to be created from other tokens according to well defined rules. E.g. tokens for all the parts of a car coming together and producing a single token for the whole car. Relatively simple non-Turing complete declarative scripting language makes that possible, as will be explained in a future article in this series.
Give it a name
“There are only two hard things in Computer Science: cache invalidation, naming things, and off-by-one errors.”
Anon, but based on a quote by Phil Karlton
Ether is the classical word for space, but that name’s taken. The complimentary Sanskrit name is Akasha and that’s been taken too. ChainSpace has been taken, and taken over by Facebook, and it’s too boring anyway. But then I remembered a quotation I found in a maths book about infinite reflections “Indra’s Pearls”,
In the heaven of the great god Indra is said to be a vast and shimmering net, finer than a spider’s web, stretching to the outermost reaches of space.
Strung at each intersection of its diaphanous threads is a reflecting pearl.
Since the net is infinite in extent, the pearls are infinite in number.In the glistening surface of each pearl are reflected all the other pearls, even those in the furthest corners of the heavens.
In each reflection, again are reflected all the infinitely many other pearls, so that by this process, reflections of reflections continue without end.
From the book Indra’s Pearls
Also see Indra’s Net
Which is very apt description of how a block lattice protocol works. Each shard reflects all the others. Therefore I’ll name the protocol Indra’s Pearls.
Here’s a view of infinite reflections based on the idea of Indra’s Pearls
An initial proof of concept for the system shows linear scaling, at least for up to 15 nodes. The second iteration of the design will be published soon on Github.
In the next article in this series I cover the details of the 3-vector proof of stake consensus mechanism and the uses of the scripting language to create tradable options for financial instruments and fan-in, fan-out transactions for supply chains.