When it Comes to Throughput, Transactions Per Second is the Wrong Blockchain Metric
By Kai Krämer and Sam Hartnett
“Blockchains don’t scale.”
It’s a common refrain among those skeptical that blockchain could ever play a meaningful role in the global economy, particularly the energy sector, which features millions (even billions) of physical and financial transactions daily.
Critics frequently point out that public blockchains such as Bitcoin, which averages around 3 transactions per second (tps), and Ethereum, which has an upper boundary around 20 tps, pale in comparison to centralized platforms such as PayPal (450 tps) and Visa (56,000 tps).
Following this logic, either a miracle must happen or blockchain will never be practically applied in the energy sector, let alone the broader Internet of Things. (An estimated 127 new devices connect to the Internet every second, with a potential total of 3 trillion devices online by 2030.)
Yet thinking narrowly only in terms of transactions per second is misleading and misses the bigger picture.
Pay to play: shifting from transactions to smart contract ‘fuel’
Modern blockchains execute computer programs, better known as “smart contracts” in blockchain speak, on a decentralized virtual machine. On public blockchains, anyone can deploy and interact with smart contracts, but only those who operate network nodes incur the real costs-computational and financial-of executing smart contracts.
To both compensate nodes for executing transactions and to deter users from spamming the network with unnecessary computations, blockchains charge a “fee” proportional to the computational burden that the use will impose on the blockchain. This fuel is known as gas.
Generally, the more computationally complex a smart contract is, the more gas it will cost to run. The fee schedule for Ethereum is a good example (see Appendix G). The more lines of code and the more complex the functions, the higher the gas fee for a smart contract will be. It’s a simple and proportional “pay to play” approach.
Flexibility: transactions per block may vary within a given gas limit
Unlike simple and largely identical credit card swipes, not all blockchain transactions are created equal. Some are more complex than others, as determined by the code of their smart contracts. Meanwhile, blockchain protocols create blocks at regular intervals, and a block gas limit (i.e., the maximum amount of computation allowed) determines the size of each block.
Hence the blocks of a blockchain can contain a varying number of more- and less-complex transactions. The sum total of their gas must remain with the block gas limit. And thus block time and block gas limit emerge as the more important metrics for blockchain throughput, rather than raw transaction speed.
Achieving consensus: protocols matter for block finality speed
A blockchain’s consensus mechanism importantly influences block time and other metrics. Proof-of-Work systems such as Ethereum require validators to race for a solution of a cryptographic lottery, which consumes considerable amounts of energy and also takes time.
Alternatively, in a Proof-of-Authority network-such as that of the Energy Web Blockchain-approved validators obviates the need for a cryptographic solution. As a result, PoA networks use considerably less energy, and have more predictable and potentially faster block times.
These attributes enable PoA networks to achieve considerably higher throughput than PoW networks. This is all for a single chain, and there are other ways to “supercharge” a blockchain’s throughput.
Chain gangs: scaling through parallel processing
If gas limit and block time determine basic throughput speed, a seemingly obvious solution to improve performance would be to increase the gas limit and/or decrease the block time. However, these approaches come with significant tradeoffs. Blockchains have a ‘sweet spot’ for gas limit and block time. If the limit is too low, each block can’t fit a meaningful number of transactions. Too large, and it becomes harder and slower for nodes to achieve consensus on each block. Likewise, shorter block times may not allow a block to propagate among validators within the allotted time.
A promising alternative is parallel, interoperable chains, or “parachains.” This approach essentially delegates some computational responsibility to subordinate chains, which report and notarize their results to other chains. The network thus achieves consensus by parallel processing computations, rather than burdening a single chain.
Consider a hypothetical example for the German energy market. Rather than a single blockchain for all of Germany, there could be one main chain for Germany, but then also separate chains for each of its 16 federal states, and 20 more chains for each larger city in each of the states, the result would be 337 chains stacked on three layers, increasing throughput by three orders of magnitude compared to a single chain. This architecture would also address data sovereignty regulations, which require data to be stored within specific geographical boundaries.
Beyond the block: leveraging off-chain state channels to streamline on-chain consensus
Though parachains may dramatically increase the throughput of blockchains, in the long run true scaling may be achieved by emerging solutions like state channels, which can securely process certain transactions without forming consensus on-chain.
State channels are smart contracts that create bilateral connections between parties (users or smart contracts) that perform rapid, low-cost transactions off of the main chain. The state channel contract defines the rules for how transactions occur (e.g., how funds can be moved between parties). Channels can be opened for a predetermined period of time or they can work like prepaid cards (which start with a specific balance and then close after the sum of the transactions use the entire balance).
Instead of pushing every single transaction on the chain, state channels use a number of functions to process transactions between the two parties directly and only settle the final outcome onto the blockchain after the channel closes. As there is no practical limit to the number of channels that can exist, and no limit to the number of payments in each of them, concerns about throughput on the blockchain may turn out to be unjustified.
To revisit the electricity market example, let’s assume that a household initiates an on-chain transaction via a smart contract to pre-load 50€ onto a state channel with a particular supplier (which could be a traditional supplier, a particular generator, or a neighbor). The state channel would process the transactions between household and supplier directly, closing once the 50€ is spent and settling the outcome on-chain. The only limit to the number of transactions in the channel is the initial balance, and payment transactions could be as large or as small as desired.
Bringing flexible scalability to the Energy Web Chain
EWF is taking a multi-faceted approach to increasing the scale of its blockchain.
To start, the EW chain combines a unique governance model and Proof-of-Authority consensus mechanism that creates consensus between vetted validators instead of random peers. These validator nodes run on professional server hardware in corporate computer centers with stable broadband connections, and their number is limited. By design, this consensus mechanism enables faster block time and increases the throughput of EWF’s Ethereum-based infrastructure 50 times compared to Bitcoin.
Block time on the Tobalaba test network varies between 3 and 10 seconds and gas limit stands at 80 million gas. Gas fees for the EW blockchain are not yet finalized, but will be lower than other public networks due in large part to the factors described above. EWF will publish gas fees in advance of the EW genesis block in Q2 2019.
Though an improvement over other public blockchains, throughput capacity on the EW blockchain must still increase significantly if it is to be adopted in the energy sector for commercial applications. EWF’s technology roadmap continues to focus on scaling.
To help overcome the throughput limitations of the blockchain itself, the EW blockchain will apply the Raiden Network for off-chain payment channels in late 2018 or early 2019. EWF is also pursuing parachain integration for both scaling, regulatory, and business purposes. To fully integrate parachains with the EW Blockchain, we need a way for those chains to interoperate seamlessly. To that end, EWF will also adopt Polkadot, a leading multi-chain technology with a genesis block currently scheduled to occur in Q3 2019.
To be clear, parachain and state channel technologies (not to mention blockchain technology itself) are still in the research and development phase. Despite the enthusiasm and excitement in the blockchain space, mass-market applications are still likely years away. But given how rapidly these technologies have advanced since their inception-especially relative to other technologies like the internet and mobile phones, which took decades to mature-there is good reason to be optimistic.
Kai Krämer is the technical lead for EWF. Sam Hartnett is an EWF team member.
Originally published at https://www.energyweb.org on May 10, 2018.