# A Framework for Efficient STARKs

## Combining probabilistic proofs and hash functions

This is the fifth and final post in our STARK Math series.

In our first post we introduced the notion of inclusive accountability, and its importance for permissionless blockchains. We also explained why the scalability properties of STARKs enable achieving this notion. We recommend the reader to read this first post before proceeding.

In our second, third, and fourth posts we dove into the mathematical theory behind STARKs. We explained how to transform computational statements into polynomial constraints. We explained how to reduce checking polynomial constraints to checking low-degreeness. And we described an efficient test for low-degreeness. Below we do not assume familiarity with these posts, except for a single section that explains how protocols described in these posts can be viewed as a certain type of probabilistic proof (whose details do not matter in this post).

In this post we conclude the series, by revisiting the notion of a STARK and then explaining how to construct a STARK from **probabilistic proofs** and **cryptographic hash functions**.

## Our goal: scalable transparent arguments

We wish to construct a STARK, which is a cryptographic proof (aka an โargumentโ) that is both *scalable* and *transparent*. Our first post describes this goal in detail, which we now summarize.

We consider cryptographic proofs for Computational Integrity (CI) statements. This means that, for a given program *๐*, input *x*, output *y*, and time bound *T*, we wish to produce a proof string ๐ attesting to the statement

*โ๐*(*x*) outputs *y* within *T* computation stepsโ.

No (efficient) procedure should be able to produce valid-looking proofs for false statements (e.g., claiming *๐*(*x*)=1 when instead *๐*(*x*)=0). More general CI statements are possible, where *๐* additionally takes a private auxiliary input, but we ignore this in this post.

STARKs are cryptographic proofs that satisfy the following desirable properties.

**Scalability:**the time needed to produce ๐ is*T*ยทpolylog(*T*), whereas the time needed to validate ๐ is only polylog(*T*); in particular, the length of ๐ is polylog(*T*). In other words, producing proofs is not much more expensive than just running the original computation, and validating proofs is**exponentially faster**than running the original computation. Proofs are**exponentially shorter**than the size of the original computation.**Transparency:**the global parameters of the cryptographic proof system, used to produce and validate proofs, have**no trapdoors**. This is in contrast to proof systems that rely on a trusted party to sample public parameters based on*secret*information, which can be used as a โtrapdoorโ to compromise the security of the proof system.

By the end of this post, you will have an informal understanding of where the properties of scalability and transparency come from.

We briefly note here that STARKs only make use of lightweight symmetric cryptography (cryptographic hash functions), which makes them **fast** and (plausibly) **post-quantum secure**. This is in contrast to many other cryptographic proofs, whose security relies on public-key cryptography that is both expensive and insecure against quantum adversaries.

## Roadmap for this post

Known STARK constructions combine two ingredients:

- long proofs that can be verified via random, and inexpensive, local checks; and
- a cryptographic hash function such as SHA-256 or Keccak.

Informally, the first component gives a STARK its scalability, while the second component gives a STARK its transparency (without impeding scalability). In the next few sections we elaborate on the above blueprint.

- First, we describe the
*Micali construction*, a method to construct cryptographic proofs that follows the above blueprint. The proof systems that underlie this construction are known as*probabilistically-checkable proofs*(PCPs). We describe this construction for pedagogical reasons: it is an elegant special case of the construction that we use. - Second, we explain why the Micali construction provides transparency and scalability.
- Third, we describe the notion of
*Interactive Oracle Proofs*(IOPs), which generalizes PCPs and enables designing much more efficient protocols. We also explain how the arithmetization and low-degree testing protocols in prior posts are IOPs. - Finally, we mention the
*BCS construction*, an extension of the Micali construction that uses the more general notion of IOPs instead of PCPs.**Efficient STARKs, including those that we use, are obtained via the BCS construction**.

## Cryptographic proofs from PCPs, via the Micali construction

In this section we introduce *probabilistically-checkable proofs* (PCPs), a type of proof system that involves a **random local check to a long proof**. Then we explain how a PCP can be combined with lightweight cryptography to obtain a STARK. This construction comes from a paper of Silvio Micali (building on prior work of Joe Kilian).

A *probabilistically-checkable proof* (PCP) is a **protocol** between a PCP prover and a PCP verifier that enables establishing the correctness of Computational Integrity (CI) statements via a **random local check to a long proof**. Given a CI statement (*๐*,*x*,*y*,*T*), the PCP prover produces a proof string ๐ฟ that โencodesโ the computation trace of the CI statement. While the proof ๐ฟ is longer than the T-step computation trace (๐ฟโs length is quasilinear in T), ๐ฟ has the remarkable feature that it can be validated via a probabilistic test that reads only a small part of ๐ฟ. Namely, given the same CI statement (*A*,*x*,*y*,*T*), the PCP verifier can validate ๐ฟ by randomly reading *a small number* of locations of ๐ฟ and then running an inexpensive โlocal checkโ on the read values. (The number of read locations can be a small constant, like 3, independent of T!) If the CI statement is true then the verifier always accepts. If instead the CI statement is false, then the verifier rejects with high probability, *regardless* of how the proof string ๐ฟ was chosen. See Figure 2 for a diagram.

Recall that our goal is to produce proofs ๐ that are short and fast to validate. This is quite different from PCPs, which instead involve inexpensive local checks to long proofs ๐ฟ. So how do we go from ๐ฟ to ๐?

A natural idea that may come to mind is to have the prover **pre-sample** a local view of ๐ฟ, on behalf of the verifier, and then send this local view as the proof ๐. In more detail, the prover *simulates* a random local check of the PCP verifier on the long proof ๐ฟ and then includes in a proof ๐ only locations of ๐ฟ read via this local check; the prover also includes in ๐ the randomness ๐ used for the PCP verifier. (Note that ๐ is short because the number of read locations of ๐ฟ is small.) The intuition of pre-sampling is that, in order to validate ๐, one could run the PCP verifier with the very same randomness ๐, which would cause reading the very same locations of ๐ฟ, which were included in ๐. This appealing idea, however, is flawed. First, a cheating prover may include in ๐ a choice of โrandomnessโ ๐ that, in fact, is not random. Second, a cheating prover may choose answers to the PCP verifier queries that *depend* on ๐ in order to pass the PCP verifierโs local check. This is possible because the security of a PCP relies on ๐ฟ being *immutable*, i.e., fixed before the random local check of the verifier is chosen.

The above problems can be addressed by using any cryptographic hash function H such as SHA-256 (modeled as a random oracle), to realize a **secure pre-sampling**. Here โsecureโ means that the prover will be able to convince the verifier that the information included in the short proof ๐ is an โhonestโ random local check that was ran on some long proof ๐ฟ.

Informally, as depicted in Figure 3, the prover is expected to use the hash function H to commit to the long proof ๐ฟ via a Merkle tree, and then derive the randomness ๐ by using H to hash the root of the Merkle tree. This ensures that the randomness ๐ is โrandom-likeโ (since ๐ is an output of the hash function H) and also ensures that ๐ is chosen *after* the prover has committed to ๐ฟ. Now the prover can do pre-sampling as described above, namely, it simulates a random local check of the PCP verifier on randomness ๐, to determine which locations of ๐ฟ should be included in ๐. Finally, the prover โdecommitsโ to the chosen locations, by including in ๐ an authentication path for each chosen location (the authentication path for a location consists of the siblings of nodes on the path from the location to the root). The authentication paths demonstrate that the claimed values of ๐ฟ are consistent with the Merkle root, and in particular were *not* chosen by the prover *after* the randomness ๐ was derived from the root. Overall, the short proof ๐ will only include the claimed root of the Merkle tree, the claimed values of ๐ฟ for the selected locations, and authentication paths for each of these values (relative to the root). One can then validate ๐ by checking all the authentication paths for the claimed values against the root, re-deriving the randomness ๐ from the root, and checking that the PCP verifier accepts the claimed values when run with the randomness ๐.ยน

To summarize, we have used the hash function H to realize a โsecure pre-samplingโ that enables including in the short proof ๐ a single random local check of the long proof ๐ฟ.

[1]: This โjustificationโ for why secure pre-sampling works is just intuition, and obtaining a formal proof of security requires some work. For example, a malicious prover could try to commit to many different proofs ๐ฟ in search for a โfavorableโ choice of randomness ๐, and then include this favorable choice in ๐. A proof of security would have to establish that such provers, and indeed any efficient prover, will fail with high probability.

## Transparency comes from the cryptography

An important feature of the Micali construction is that the only cryptography needed for producing or validating a short proof ๐ is a cryptographic hash function H (e.g., SHA-256 or Keccak). The choice of H is thus the only โglobal parameterโ that all users of the proof system need to know, and this choice can be made via *public* information. This means that cryptographic proofs obtained via the Micali construction are **transparent**.

The foregoing is in contrast to other cryptographic proofs wherein producing or validating proofs requires using global parameters that are produced based on *secret* information. For those familiar with cryptographic proofs based on pairings, a typical example of global parameters is

(G, ๐ยทG, ๐ยฒยทG, ๐ยณยทG, โฆ)

where G is a group element and ๐ is a *secret* scalar. Such global parameters must be sampled by a trusted party, or via a multi-party ceremony because users should not know the โtrapdoorโ ๐. Indeed, knowing ๐ would enable producing valid-looking proofs for false statements.

## Scalability comes from the probabilistic proof

Another important feature of the Micali construction is that the time to produce/validate the short proof ๐ is close to the time to produce/validate the long proof ๐ฟ. This is simply because the needed cryptographic operations are inexpensive when compared to the PCP operations. We thus learn that efficiency in the Micali construction is essentially determined by the efficiency of the underlying PCP. In particular, **if the PCP is scalable** (producing ๐ฟ takes time quasilinear in T whereas validating ๐ฟ is exponentially faster) **then the Micali construction yields a scalable cryptographic proof**. Constructions of scalable PCPs are known (see this paper).

Unfortunately, the costs of PCPs remain very high, which makes them unfit for practical use. Because of this, implementations of STARKs are not based on PCPs via the Micali construction. Instead, they are based on another type of probabilistic proof, for which one can achieve scalability, with good concrete costs and even with zero knowledge. We discuss this next.

## IOPs: a new notion of probabilistic proof

Efficient STARKs are based on a type of probabilistic proof system known as *interactive oracle proofs* (IOPs), which was introduced in 2015. Informally, a prover and a verifier engage in an interactive protocol where in each round the verifier sends some randomness ๐แตข to the prover, and the prover replies with a long proof ๐ฟแตข. At the end of the interaction, the verifier performs a random local check on *all* the long proofs (๐ฟโ,๐ฟโ,โฆ) sent by the prover throughout the interaction. See Figure 4 for a diagram. Note that a PCP is simply a โnon-interactive IOPโ, and thus is a restricted case.

In the last few years, researchers have developed numerous design principles for constructing highly-efficient IOPs: [BCGV16], [BCGRS16], [BB+16], [BBGR16], [BCFGRS16], [BBHR17], [BBHR18], [BCRSVW18], [BKS19], [BGKS19]. The IOP protocol that we use in our STARK constructions is most closely related to [BBHR18].

## Prior posts describe an efficient IOP

We now explain how our prior posts on arithmetization and low-degree testing actually described an efficient IOP. In Figure 5 we provide a diagram of this IOP. The first phase of the protocol is **arithmetization**, which transforms the given CI statement (*๐*,*x*,*y*,*T*) into a problem that involves establishing degree bounds on certain polynomials. Second phase is **low-degree testing**, which solves this latter problem. We summarize the protocolโs workflow.

**Arithmetization** (blue area in Figure 5)**.** The prover and verifier transform the program *๐* into a collection of polynomial constraints, as described in our post Arithmetization I. In addition, the prover runs the computation described by (*๐*,*x*,*y*,*T*), obtaining a *T*-step computation trace.

Then, as described in our post Arithmetization II, the prover encodes this trace to obtain an encoded trace ๐ฝ, which is sent to the verifier. (Here the prover does not need to receive any randomness from the verifier before sending ๐ฝ.) After that, the verifier sends randomness ๐โ which enables both the prover and verifier to โbundleโ all the polynomial constraints into a *single* polynomial constraint, by taking their random linear combination. The prover combines this latter with the encoded trace ๐ฝ in order to obtain a composed polynomial ๐ต, which is sent to the verifier. The verifier ensures via a local consistency check that ๐ฝ and ๐ต are suitably related. At this point, if the local consistency check passes with high probability, the CI statement is true if and only if ๐ฝ and ๐ต have low-degree.

**Low-degree testing** (gray area in Figure 5)**.** The prover uses the FRI protocol (described in our low-degree testing post) to convince the verifier that ๐ฝ and ๐ต are evaluations of low-degree polynomials. This involves engaging in a protocol where in each round the verifier sends some randomness ๐แตข and the prover replies with an auxiliary proof ๐ฟแตข, and at the end of the protocol the verifier performs a random local check on ๐ฝ,๐ต and the ๐ฟแตขโs. If the FRI protocolโs verifier accepts with high probability then ๐ฝ and ๐ต have the desired degrees. If so, the verifier concludes that the CI statement (*๐*,*x*,*y*,*T*) is a true statement.

## Cryptographic proofs via the BCS construction

Efficient STARKs are obtained via the BCS construction a method that combines an IOP with a cryptographic hash function H in order to obtain a cryptographic proof. This method is an extension of the Micali construction, and it retains its features (of transparency and scalability) that we discussed above. We do not describe the BCS construction in this post, and only remark that it can be viewed as applying the Micali construction at each round of an IOP and putting each roundโs commitments in a hash chain (which keeps the rounds in order).

# Conclusion

In this post we have explained that efficient STARK constructions are obtained by combining **efficient IOPs** (a type of probabilistic proof) and **cryptographic hash functions**. The IOP confers the STARK its scalability, while the hash function confers the STARK its transparency. Different STARK constructions differ in the underlying IOPs, and we have explained how our prior posts have described the components of the IOP protocol used in our STARK construction.

This concludes our STARK Math series. We hope that it was valuable to you!

Alessandro Chiesa and Gideon Kaempfer