TLDR: Elastic scaling is very useful for parachains that need a higher throughput than the current protocol allows. Polkadot is going to deliver elastic scaling in the near future.
Polkadots mission is based on delivering a platform that focuses on excellent scaling and security. The aim is to allow decentralised applications to operate with the best conditions possible. In this article we review Polkadot scaling, new changes that are making it even more scalable and achieve elastic scaling and conclude by explaining why elastic scaling is cool.
Polkadot Scaling
Polkadots scales by applying hierarchy to the platform architecture. Parachains are allowed to submit one block per relay chain block, which is the chain that provides the security. The relay chain can serve more than 50-300 parachains . Another feature that this architecture enables is shared security. The hierarchical architecture of Polkadot allows parachain projects to be able to combine their security resources and have strong security backing, making attacks extremely expensive while if each parachain were to run their own blockchains these security resources would have been split up and would make attacks cheap and easy to carry out.
Recently exciting changes have been proposed for Polkadot that open up more scalability opportunities.
Scaling a parachain beyond one Core
Currently polkadot can validate one parachain block per relay chain block. The newest change that Polkadot is enabling, part of Elastic Scaling, is to allow parachain to produce several parachain blocks for each relay chain block and have them validated. These parachain blocks can still be built in a sequential fashion, but the relay chain processes them in parallel.
Polkadot can validate many parachain blocks at a time. We refer to the relay chain resources and validator time used to validate a parachain block on the relay chain as a core, similar to what was previously loosely referred to as a slot. So if the relay chain can validate 50 parachain blocks at a time, we say it has 50 cores, in analogy with a processor with 50 cores being able to execute 50 threads at a time. So parachains will be able to obtain more than one core at the same time for execution, this allows parachain with high throughput to be able to get transactions executed faster.
Core assignment
Currently, on Polkadot prospective projects apply for slots by participating in an auction. Once they win the auction they become a parachain. The auction determines how much tokens need to be locked. Polkadot allows the use of a single core, so one parachain block per relay chain block, for lease periods the auction covered which can be from 6 months to 2 years.
Most recently, agile coretime is being implemented which allows for a more flexible assignment of cores. Coretime refers to the right to use a core on the relay chain. The new changes (more information in the RFC and FAQ) will allow purchase of one or more cores for shorter periods of time such as one month, one hour, or even one block, through on-chain purchase or from a secondary market for coretime.
Elastic Scaling
These two changes, multiple cores per parachain and agile coretime, come together as follows to enable elastic scaling: a parachain can lease extra cores on short notice for a short time and use them to get parachain blocks validated at a faster rate and execute more transactions. Elastic scaling is useful to various entities in the blockchain space. Here we review the benefits of it from their perspectives:
For service providers: they can serve more customers (application developers) which is better business-wise for them and increases their popularity.
For applications: many applications have bursty core-time usage. Applications can save costs by only paying for core-time according to how much they need at any time and not have to choose between high cost and low performance, which will impact the quality of their application for end-users and benefit their popularity. Moreover, when applications start off they may have much less users and with elastic scaling they can adjust how much core-time they pay for depending on their users. It is hard to estimate how much core-time an application is going to need in the next six months to two years up front. If the service is providing rigid scaling, they either have to get lots of core-time in the beginning and pay a high price or end up with issues such as being slow and loose end-users once they become popular. What many applications tend to do is acquire more core-time than they need which raises the price for all parties interested in core-time and raises the bar for entry for application developers. Elastic scaling allows them to only pay for core-time when needed and reduces the price for everyone. In case of a wrong estimation at the time of acquiring core-time, elastic scaling allows applications to load balance and, using agile coretimeâs secondary markets, re-sell any core-times they wonât need in future.
Letâs dive into a couple of examples of applications to demonstrate that most end-users applications do bursty activity periods where they need a large amount of core-time as opposed to a constant amount. Any application that has auctions would be a great example of an application that has bursty activity periods. Other examples would be messaging/betting/social media or any application that has human end-users, depending on the end-users geographic location, which for the majority of applications is not evenly distributed across time zones. A large study on messaging between students shows that most messaging is higher towards the evening and night [1]. This is because humans are creatures of habit. For example, a messaging application that is popular in Japan is going to have a moderate amount of messaging during the day, bursts of messages in the evening, and very few from 1 am to 6 am Japan time.
For end users: They donât have to choose between low cost and good performance (or in worst case halting of the service) when choosing what applications they want to use.
Comparison to other scaling models
Alternative scaling models are very high throughput chains where throughput as much as 2000-3000 transactions per second (of non-protocol related transactions, aka end-user transaction) has been reported. It is not clear how they might grow when the demand gets higher than these numbers. Even if this number may be tenfold or twenty-fold higher. To put this into perspective. Only a couple of major credit cards need to process about 20-30 fold of this number of transactions per second. If we want blockchains to be capable of handling transactions beyond that we need to have a plan to scale further. For example, for IoT applications that will become mainstream sooner or later with a mass amount of global users. Blockchains are excellent for collecting data from IoT devices in terms of preventing abuse and providing privacy, however scaling to these numbers would not be nearly enough. Elastic scaling allows Polkadot to optimise the use of its cores and enables parachains to become high throughput chains themselves at minimum cost.
Another alternative is having rollups which solves the scalability problem better. However, the current solutions being either optimistic or zero knowledge based, suffer from weaker security or having to do heavy computation for nodes respectively. In rollups the execution of blocks is delegated to outside the set of validators. As such, the bulk of the computation and storage is off-chain. In optimistic rollups, it is assumed that the off-chain blocks are valid and that there is a fraud-proving scheme to detect cases where blocks are not computed correctly. Even though in principle âany partyâ can attempt to check and detect invalid blocks, it is not clear how such schemes ensure provable security from a formal standpoint, since it is not specified how to ensure that the blocks are in fact checked. In zero-knowledge rollups, a cryptographic proof of validity for a batch of transactions is published towards the on-chain validators, who can verify it. Producing the proofs of validity, however, is computationally expensive (e.g., 50,000 times slower than natively execution) and this may lead to centralization of proving. In comparison, parachains enjoy high security (in comparison to optimistic rollups) and low execution cost and better decentralisation (in comparison to zero knowledge rollups).
References
[1] âA large scale study of text-messaging useâ, Agathe Battestini, Vidya Setlur, Timothy Sohn, Proceedings of the 12th Conference on Human-Computer Interaction with Mobile Devices and Services, Mobile HCI 2010, Lisbon, Portugal, September 7-10, 2010.
Bonus: What else to look forward to after Elastic Scaling?
CoreJam is a more far reaching and general extension of Polkadotâs core model than asynchronous backing and elastic scaling. Polkadot can validate more than just chains. For example, smart contracts on parachains have the limitation that while calls between contracts on a chain are synchronous and fast, cross-chain calls would always be slow and asynchronous, which leads to a difficult choice of which chain to be on and so which contracts are easy to interoperate with. The CorePlay idea, that will be possible on CoreJam, is that the same smart contract can be scheduled with different smart contracts as demand for faster calls allows.