- Carter Jack Feldman
ZK + PARTH Bonus: Calculating how many users are needed to achieve 100,000 TPS
In this post, we will derive a formula which calculates the number of users that need to participate in a QED block to attain 100,000 TPS.
In our previous blog post, we showed that the TPS of QED running on a 2-to-1 configuration can be calculated as:
In reality, QED uses a 4-to-1 proof configuration, where each decentralized proving job recursively verifiers 4 proofs and 4 delta merkle proofs for performance reasons, so the actual equation we can use to model our TPS is:
is the number of users participating in a block
is the average number of transactions each participating user performs during the block
is the time it takes to recursively verify 2 proofs and associated delta merkle proofs (proving time for each job performed by the decentralized proving network)
is the time it takes to send a proof to a decentralized proof miner (~30kb)
The only downside of using a 4-to-1 configuration is that our proving time is slightly longer, notably ~500ms on consumer hardware instead of 380ms in the 2-to-1 configuration.
Calculating the numbers user required to hit 100,000 TPS
Using our formula, if we wanted to see how many users would need to participate in a block to attain a TPS of 100,000, we would need to solve the equation below for :
To find the inverse, let's first clean up our equation a bit, we will say represents our desired TPS:
Let's clean things up a bit, substituting using the change of base rule for logarithms:
Multiplying by on both sides we get:
We want to solve for , so remember our goal is to find some function such that where is our desired TPS, so our target equation should start with . To get isolated we need to find a function such that , that way we can say that:
And since is defined such that :
Or in other words:
Now we just have to find a function such that .
To help us find such a function let's let , therefore it follows that , so now we have simplified our original problem to finding the inverse of .
Let's first define to equal :
We can then multiply both sides by to get:
Raising to the power of both sides we get:
Simplifying, we get:
Let's now multiply both sides by :
Simplifying, we get:
Now let's set , and replace with in our equation:
It turns out that there is a function called the Lambert W function (referred to as ) which has the property that:
Let's apply Lambert's W function to both sides of our equation:
Using the properties we know about Lambert's W function we can further simplify to:
Since , we can rewrite this as:
Since , we can further rewrite our equation as:
If we multiply both sides by , we now have an expression for 🎉:
Hence, we now have a function which meets the desired requirements of :
And since we already showed that:
We now can now write a formula for the number of users that need to submit proofs in a block to attain a certain TPS on QED:
To keep our math simple moving forward, let's set the constant to equal :
Therefore, can be rewritten as:
Let's use some experimental values from QED's internal testnet to calculate the number of users we need to attain 100,000 TPS on QED.
The proving time required to recursively verify 4 proofs and 4 corresponding delta merkle proofs that link to the nearest common ancestor merkle cap is ~500ms, so
The proof size is ~30kb, so lets say it takes 100ms to send over the network to any where around the world (it fits in a single TCP packet, so think of this as "ping" time)
Let's say each user submits an average of 3 transactions per block, so
To keep our math simple, let's first solve for
So can be written as:
Approximating for , we get:
To evaluate the Lambert W function, we can use Wolfram Alpha:
Hence, we arrive at the result that a block must have 174,096 users participating in a block to hit 100,000 TPS!
Let's check with our original equation just to make sure:
Plugging in , we get the correct answer 🎉