Published on

ZK + PARTH Bonus: How Many Concurrent Users does QED need to hit 100,000 TPS

  • avatar
    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:

TPS(u)=# of TransactionsBlock Time=ktxulog4(u)(kr+knet)TPS(u)=\frac{\text{\# of Transactions}}{\text{Block Time}}=\frac{k_{\text{tx}}*u}{\log_4(u)*(k_r+k_{net})}

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:

TPS(u)=# of TransactionsBlock Time=ktxulog4(u)(kr+knet)TPS(u)=\frac{\text{\# of Transactions}}{\text{Block Time}}=\frac{k_{\text{tx}}*u}{\log_4(u)*(k_r+k_{net})}


  • uu is the number of users participating in a block

  • ktxk_{tx} is the average number of transactions each participating user performs during the block

  • krk_r 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)

  • knetk_{net} 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 uu:


To find the inverse, let's first clean up our equation a bit, we will say xx represents our desired TPS:


Let's clean things up a bit, substituting log4(u)=ln(u)ln(4)\log_4(u)=\frac{\ln(u)}{\ln(4)} using the change of base rule for logarithms:


Multiplying by kr+knetktxln(4)\frac{k_r+k_{net}}{k_{tx}\ln(4)} on both sides we get:


We want to solve for uu, so remember our goal is to find some function f(t)f(t) such that u=f(t)u=f(t) where tt is our desired TPS, so our target equation should start with u=some function of tu=\text{some function of t}. To get uu isolated we need to find a function g(x)g(x) such that g(uln(u))=ug(\frac{u}{\ln(u)})=u, that way we can say that:


And since g(x)g(x) is defined such that g(uln(u))=ug(\frac{u}{\ln(u)})=u:


Or in other words:

Users(TPS)=g(kr+knetktxln(4)TPS)\text{Users}(TPS)=g\left(\frac{k_r+k_{net}}{k_{tx}\ln(4)}\cdot TPS\right)

Now we just have to find a function g(x)g(x) such that g(uln(u))=ug(\frac{u}{\ln(u)})=u.

To help us find such a function let's let y(x)=xlnxy(x)=\frac{x}{\ln{x}}, therefore it follows that y1(x)=g(x)y^{-1}(x)=g(x), so now we have simplified our original problem to finding the inverse of y(x)y(x).


Let's first define zz to equal z=1y=lnxxz=\frac{1}{y}=\frac{\ln{x}}{x}:


We can then multiply both sides by xx to get:


Raising ee to the power of both sides we get:

ezx=elnxe^{zx}=e^{\ln x}

Simplifying, we get:


Let's now multiply both sides by zezx-z\cdot e^{-zx}:

ezx(zezx)=x(zezx)e^{zx}\cdot(-z\cdot e^{-zx})=x\cdot (-z\cdot e^{-zx})

Simplifying, we get:

z=zxezx-z=-zx\cdot e^{-zx}

Now let's set p=zxp=-zx, and replace zx-zx with pp in our equation:

z=pep-z=p\cdot e^p

It turns out that there is a function called the Lambert W function (referred to as W(x)W(x)) which has the property that:

W(xex)=xW(x\cdot e^x)=x

Let's apply Lambert's W function to both sides of our equation:

W(z)=W(pep)W(-z)=W(p\cdot e^p)

Using the properties we know about Lambert's W function we can further simplify to:


Since p=xzp=-xz, we can rewrite this as:


Since z=1yz=\frac{1}{y}, we can further rewrite our equation as:


If we multiply both sides by y-y, we now have an expression for xx 🎉:

x=yW(1y)x=-y\cdot W\left(\frac{-1}{y}\right)

Hence, we now have a function which meets the desired requirements of g(x)g(x):

g(x)=xW(1x)g(x)=-x\cdot W\left(\frac{-1}{x}\right)

And since we already showed that:

Users(TPS)=g(kr+knetktxln(4)TPS)\text{Users}(\text{TPS})=g\left(\frac{k_r+k_{net}}{k_{tx}\ln(4)}\cdot \text{TPS}\right)

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:

Users(TPS)=TPS(kr+knetktxln(4))W(1TPS(kr+knetktxln(4)))\text{Users}(\text{TPS})=-\text{TPS}\cdot\left(\frac{k_r+k_{net}}{k_{tx}\ln(4)}\right)\cdot W\left(\frac{-1}{\text{TPS}\cdot\left(\frac{k_r+k_{net}}{k_{tx}\ln(4)}\right)}\right)

To keep our math simple moving forward, let's set the constant cc to equal kr+knetktxln(4)\frac{k_r+k_{net}}{k_{tx}\ln(4)}:


Therefore, Users(TPS)\text{Users}(\text{TPS}) can be rewritten as:

Users(TPS)=TPScW(1TPSc)\text{Users}(\text{TPS})=-\text{TPS}\cdot c \cdot W\left(\frac{-1}{\text{TPS}\cdot c}\right)

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 kr=0.5k_r=0.5

  • 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 ktx=3k_{tx}=3

To keep our math simple, let's first solve for c=kr+knetktxln(4)c=\frac{k_r+k_{net}}{k_{tx}\ln(4)}


So Users(100000)\text{Users}(100000) can be written as:

Users(100000)=1000000.63ln(4)W(11000000.63ln(4))\text{Users}(100000)=-100000\cdot\frac{0.6}{3\ln(4)}\cdot W\left(\frac{-1}{100000\cdot\frac{0.6}{3\ln(4)}}\right)

Approximating for 0.63ln(4)\frac{0.6}{3\ln(4)}, we get:

Users(100000)=14426.95W(0.000069314718)\text{Users}(100000)=-14426.95\cdot W(-0.000069314718)

To evaluate the Lambert W function, we can use Wolfram Alpha:

(we round up because there is no such thing as 0.166 of a user)

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:

TPS(u)=# of TransactionsBlock Time=ktxulog4(u)(kr+knet)TPS(u)=\frac{\text{\# of Transactions}}{\text{Block Time}}=\frac{k_{\text{tx}}*u}{\log_4(u)*(k_r+k_{net})}

Plugging in u=174096u=174096, we get the correct answer 🎉

TPS(174096)=3174096log4(174096)(0.5+0.1)100000.4392383768 TPSTPS(174096)=\frac{3*174096}{\log_4(174096)*(0.5+0.1)}\approx 100000.4392383768 \text{ TPS}