Kate polynomial commitments

Introduction

I want to try and give an introduction to the commitment scheme introduced by Kate, Zaverucha and Goldberg 1. This post does not aim to be mathematically or cryptographically rigorous or complete – it is meant to be an introduction.

This scheme is often called Kate polynomial commitment scheme (pronounced kah-tay). As a polynomial commitment scheme, it allows a prover to compute a commitment to a polynomial, with the properties that this commitment can later be opened at any position: The prover shows that the value of the polynomial at a certain position is equal to a claimed value.

It is called a commitment, because having sent the commitment value (an elliptic curve point) to someone (the verifier), the prover cannot change the polynomial they are working with. They will only be able to provide valid proofs for one polynomial, and if they are trying to cheat, they will either fail to produce a proof or the proof will be rejected by the verifier.

Prerequisites

I highly recommend reading Vitalik Buterin’s post on elliptic curve pairings, if you aren’t familiar with finite fields, elliptic curves, and pairings.

Comparison to Merkle trees

If you’re familiar with Merkle trees, I want to try to give a bit more of an intuition on the difference between those and Kate commitments. A Merkle tree is what cryptographers call a vector commitment: Using a Merkle tree of depth , you can compute a commitment to a vector (that is, a list of elements of fixed length) . Using the familiar Merkle proofs, you can provide a proof that an element is a member of this vector at position using hashes.

We can actually make a polynomial commitment out of Merkle trees: Recall that a polynomial of degree is nothing other than a function where the are the coefficient of the polynomial.

We can easily commit to a polynomial of degree by setting and computing the Merkle root of its coefficients. Proving an evaluation means that the prover wants to show to the verifier that for some . The prover can do this by sending the verifier all the and the verifier computing that is indeed .

This is of course an extremely stupid polynomial commitment, but it will help us understand what the advantages of real polynomial commitments are. Let’s hase a look at the properties:

  1. The commitment size is a single hash (the Merkle root). A cryptographic hash of sufficient security typically needs 256 bits, i.e. 32 bytes.
  2. To prove an evaluation, the prover needs to send all the , so the proof size is linear in the degree of the polynomial, and the verifier needs to do linear work (they need to evaluate the polynomial at the place by computing ).
  3. The scheme does not hide anything about the polynomial – the prover sends the whole polynomial in the clear, coefficient by coefficient.

Now let’s look at what the Kate scheme achieves on these metrics:

  1. The commitment size is one group element of an elliptic group that admits pairings. For example, with BLS12_381, that would be 48 bytes.
  2. The proof size, independent from the size of the polynomial, is also always only one group element. Verification, also independent from the size of the polynomial, requires a two group multiplications and two pairings, no matter what the degree of the polynomial ist.
  3. The scheme mostly hides the polynomial – indeed, an infinite number of polynomials will have exactly the same Kate commitment. However, it is not perfectly hiding: If you can guess the polynomial (for example because it is very simple or in a small set of possible polynomials) you can find out which polynomial was committed to.

Additionally, it is actually possible to combine the proof for any number evaluations in one group element. These properties make the Kate scheme very attractive for zero knowledge proof systems, such as PLONK and SONIC. But they also make it very interesting for a more mundane purpose and use it as a vector commitment, which we will come to below.

On Elliptic curves and pairings

As mentioned in the prerequisites, I strongly recommend Vitalik Buterin’s post on elliptic curve pairings, it includes all the basics needed to understand this post – in particular finite fields, elliptic curves, and pairings.

Let and be two elliptic curves with a pairing . Let be the order of and , and and be generators of and . We will use a very useful shorthand notation

for any .

Trusted setup

Let’s assume we have a trusted setup, so that for some secret , the elements and are available to both prover and verifier for .

One way to get this secret setup is to have an airgapped computer compute a random number , compute all the group elements , and only send those elements (and not ) over a wire, and then burn that computer. Of course this is not a great solution because you would have to trust whoever operated that computer that they didn’t build a secret communication channel that tells them the secret .

In practice this is usually implemented via a secure multiparty computation (MPC), which allows creating these group elements by a group of computers in a way such that no single computer will know the secret , and all of them would have to collude (or be compromised) in order to reveal it.

Note one thing that is not possible: You can’t do this by just selecting a random group element (for which is unknown) and compute the other group elements from it. It is impossible to compute without knowing .

Now, elliptic curve cryptography basically tells us that it’s impossible to find out what actually is from the trusted setup group elements. It’s a number in , but the prover cannot find the actual number. They can only do certain computations with the elements that they are given. So for example, they can easily compute things like by elliptic curve multiplication, and since they can add elliptic curve points, they can also compute something like . In fact, if is a polynomial, the prover can compute

This is interesting – using this trusted setup, everyone can basically evaluate a polynomial at some secret point that nobody knows. Except they don’t get the output as a natural number, they only get the elliptic curve point , but it turns out that this is already really powerful.

Kate commitment

In the Kate commitment scheme, the element is the commitment to the polynomial .

Now you may ask the question: Could the prover (without knowing ) find another polynomial that has the same commitment, i.e. such that ? Let’s assume that this were the case. Then it would mean that , implying .

Now, is itself a polynomial. We know that it’s not constant because . It is a well-known fact that any non-constant polynomial of degree can have at most zeroes: This is because if , then is divisible by the linear factor ; since we can divide by one linear factor for each zero, and each division reduces the degree by one, so there can’t be more than .2

Since the prover doesn’t know , the only way they could achieve that is by making in as many places as possible. But since they can do that in at most places, as we’ve just proved, they are very unlikely to succeed: since is much smaller than the degree of the curve , the probability that will be one of the points they chose to make will be vanishingly tiny. To get a feeling for this probability, suppose we use the largest trusted setups currently in existense, where , and compare it to the curve order : The probability that any given polynomial that the attacker has crafted to agree with in as many points as possible – points – results in the same commitment () will only be . That is an incredibly low probability and in practice means the attacker cannot pull this off.

Multiplying polynomials

So far we have seen that we can evaluate a polynomial at a secret point , and that gives us a way to commit to one unique polynomial – in the sense that while there are many polynomials with the same commitment , they are impossible to actually compute in practice (cryptographers call this computationally binding).

However, we are still missing the ability to “open” this commitment without actually sending the whole polynomial over to the verifier. In order to do this, we need to use the pairing. Above, we noticed that we can do some linear operations with the secret elements; for example, we can compute as a commitment to , and we could also add two commitments for and to make a combined commitment for : .

What we’re missing is an ability to multiply two polynomials. If we can do that, we can use some cool properties of polynomials to achieve what we want. While elliptic curves themselves don’t allow this, luckily we can do it with pairings: We have that

where we introduce the new notation . So while we unfortunately can’t just multiply two field elements inside an elliptic curve and get their product as an elliptic curve element (this would be a property of so-called Fully Homomorphic Encryption or FHE; elliptic curves are only additively homomorphic), we can multiply two field elements if we commited to them in different curves (one in and one in ), and the output is a element.

This gets us to the core of the Kate proof: Remember what we said about linear factors earlier: A polynomial is divisible by if it has a zero at . It is easy to see that the converse is also true – if it is divisible by , then it clearly has a zero at : Being divisible by means that we can write for some polynomial , and this is clearly zero at .

Now let’s say we want to prove that . We will use the polynomial – this polynomial is clearly zero at , so we can use the knowledge about linear factors. Let be the polynomial divided by the linear factor , i.e.

which is equivalent to saying that .

Kate proofs

Now a Kate proof for the evaluation is defined as . Remember the commitment to the polynomial is defined as .

The verifier checks this proof using the following equation:

Note that the verifier can compute , because it is just a combination of the element from the trusted setup and is the point at which the polynomial is evaluated. Equally they know as the claimed value , thus they can compute as well. Now why should this check convince the verifier that , or more precisely, that the polynomial committed to by evaluated at is ?

We need to evaluate two properties: Correctness and soundness. Correctness means that, if the prover followed the steps as we defined, they can produce a proof that will check out. This is usually the easy part. Soundness is the property that they cannot produce an “incorrect” proof – they cannot trick the verifier into believing that for some .

Let’s start by writing out the equation in the pairing group:

Correctness should now be immediately apparent – this is just the equation evaluated at the random point that nobody knows.

Now, how do we know it’s sound and the prover cannot create fake proofs? Let’s think of it in terms of polynomials. If the prover wants to follow the way we sketched out to construct a proof, they have to somehow divide by . But is not zero, so they cannot perform the polynomial division, as there will always be a remainder. So this clearly doesn’t work.

So then they can try to work directly in the elliptic group: What if, for some commitment , they could compute the elliptic group element

If they could do this, they could obviously just prove anything they want. Intuitively, this is hard because you have to exponentiate by something that involves , but you don’t know anything about . To prove it rigorously, you need a cryptographic assumption about proofs with pairings, the so-called -strong SDH assumption 3.

Multiproofs

So far we have shown how to prove an evaluation of a polynomial at a single point. Note that this is already pretty amazing: You can show that some polynomial that could be any degree – say – at some point takes a certain value, by only sending a single group element (that could be bytes, for example in BLS12_381). The toy example of using Merkle trees as polynomial commitments would have needed to send elements – all the coefficients of the polynomial.

Now we will go one step further and show that you can evaluate a polynomial at any number of points and prove this, still using only one group element. In order to do this, we need to introduce another concept: The Interpolation polynomial. Let’s say we have a list of points : Then we can always find a polynomial of degree less than that goes through all of these points. One way to see this is to use Lagrange interpolation, which give an explicit formula for this polynomial :

Now let’s assume that we know goes through all these points. Then the polynomial will clearly be zero at each . This means that it is divisible by all the linear factors . We combine them all together in the so-called zero polynomial

Now, we can compute the quotient

Note that this is possible because is divisible by all the linear factors in , so it is divisible by the whole of .

We can now define the Kate multiproof for the evaluations : – note that this is still only one group element.

Now, to check this, the verifier will also have to compute the interpolation polynomial and the zero polynomial . Using this, they can compute and , and thus verify the pairing equation

By writing out the equation in the pairing group, we can easily verify it checks out the same way the single point Kate proof does:

This is actually really cool: You can prove any number of evaluation – even a million – by providing just one group element! That’s only 48 bytes to prove all these evaluations!

Kate as a vector commitment

While the Kate commitment scheme is designed as a polynomial commitment, it actually also makes a really nice vector commitment. Remember that a vector commitment commits to a vector and lets you prove that you committed to for some . We can reproduce this using the Kate commitment scheme: Let be the polynomial that for all evaluates as . We know there is such a polynomial, and we can for example compute it using Lagrange interpolation:

Now using this polynomial, we can prove any number of elements in the vector using just a single group element! Note how much more efficient (in terms of proof size) this is compared to Merkle trees: A Merkle proof would cost hashes to even just prove one element!

Further reading

We are currently exploring the use of Kate commitments in order to achieve a stateless version of Ethereum. As such, I highly recomment searching for Kate in the ethresearch forums to find interesting topics of current research.

Another great read from here is Vitalik’s introduction to PLONK, which makes heavy use of polynomial commitments and the Kate scheme is the primary way this is instantiated.

  1. https://www.iacr.org/archive/asiacrypt2010/6477178/6477178.pdf 

  2. This result is often mis-quoted as fundamental theorem of algebra. But the fundamental theorem of algebra is actually the inverse result (only valid in algebraically closed fields), that over the complex numbers, every polynomial of degree has linear factors. The simpler result here unfortunately doesn’t come with a short catchy name, despite arguable being more fundamental to Algebra. 

  3. https://www.cs.cmu.edu/~goyal/ibe.pdf