DocsWhat is Protokit?

What is Protokit?

Protokit is a TypeScript framework for building zero-knowledge application chains (zk-appchains) on Mina. It lets you ship an entire application-specific rollup as a single TypeScript project, without having to hand-roll the cryptographic plumbing that normally comes with zk-rollups.

If you just want to get your hands dirty, jump straight to the Quickstart. Otherwise, read on to learn which problems Protokit solves and when you should reach for it.

The problems Protokit solves

Mina’s zkApps are an elegant way to bring zero-knowledge to smart contracts: every user proves their own state transition in the browser, and the L1 only verifies the proof. That design unlocks client-side privacy and extremely cheap verification — but it also pushes several hard problems onto the application developer:

  • Concurrency and race conditions. Because each user produces their proof locally against a snapshot of the on-chain state, two users interacting with the same contract at the same time will produce proofs against the same pre-state. Only one of them can land; the other has to retry. Anything that looks like a shared resource — an order book, a token supply, a game board — runs straight into this wall.
  • Sequential logic is awkward. Patterns such as “process this queue in order”, “charge a fee before running the method” or “only let the first N users mint” are trivial on an EVM-style chain but require careful use of Actions & Reducers on Mina, and the effort grows quickly with the complexity of the application.
  • Scaling beyond a single, simple contract. Once you want complex logic, shared state or composable public/private execution, the infrastracture you end up building is taking huge amounts of work away from your product - the thing you want to focus on.
  • No batteries-included infrastructure. Wallet integration, a GraphQL API, an indexer, deterministic tests, a local dev network, CI-friendly mock proofs, L1 deposits and withdrawals — all of that has to be built and wired together before you can ship.

A concrete example

Imagine you want to build a simple guest book: users “check in” with a rating between 1 and 5, and the app records who checked in and when.

As a single Mina zkApp, this looks deceptively easy until two users try to check in at the same time. Both build a proof against the same state root, both submit, one of them gets rejected. To make it work reliably you end up dispatching actions, writing a reducer, and manually folding the queue of check-ins into the contract’s state — all while keeping everything inside a zero-knowledge circuit.

With Protokit, the same feature is a short TypeScript module:

@runtimeModule()
export class GuestBook extends RuntimeModule {
  @state() public checkIns = StateMap.from(PublicKey, CheckIn);
 
  @runtimeMethod()
  public async checkIn(rating: UInt64) {
    assert(rating.lessThanOrEqual(UInt64.from(5)), "Maximum rating can be 5");
 
    const guest = this.transaction.sender.value;
    const createdAt = UInt64.Safe.fromField(this.network.block.height.value);
 
    await this.checkIns.set(guest, new CheckIn({ guest, createdAt, rating }));
  }
}

You write ordinary TypeScript; Protokit takes care of:

  • ordering transactions in a sequencer so users don’t compete over the same state
  • making that state available to users and all other infrastructure
  • turning the method into a recursive zero-knowledge circuit
  • producing a proof of all execution
  • (optionally) settling that proof on the Mina L1

The rest of the docs — runtime, protocol, sequencer, settlement — are simply knobs on top of this core idea.

How Protokit fits in

The easiest way to place Protokit on the map is to compare it with the existing Mina toolchain:

If you are building…Reach for…
A single zk smart contract, client-side proofs, no shared stateo1js
A large application with many users interacting, shared state and sequential logicProtokit

Protokit is to zk-rollups what o1js is to zk smart contracts: an SDK. Under the hood it still uses o1js for all provable code, which means every Protokit appchain is a zk-rollup by construction, every transaction produces a proof, and the whole chain can settle trustlessly to Mina for shared L1 security.

Because proofs on the client side are optional, Protokit also supports opt-in privacy: a user can generate a zk-proof in the browser and pass it into a runtime method as an argument, without revealing the underlying inputs to the sequencer.

When should you use Protokit?

Protokit is a good fit when you recognise at least one of the following:

  • Many users touch the same state. DEXes, games, auctions, social apps, leaderboards.
  • You need sequential or ordered logic that is painful to express with actions and reducers alone.
  • You want a high degree of customization — custom block times, custom fees, your own mempool, your own indexer — without giving up Mina’s security or writing a ton of coordination infrastructure.
  • You want trustless bridging between Mina L1 and your app, out of the box (see Settlement and Bridging).
  • You care about privacy and want to accept client-generated zk-proofs as first-class inputs to your app logic.

Protokit is probably not the right tool if your entire application fits into a single zkApp with no shared state and no sequencing requirements — in that case, plain o1js will be simpler and lighter.

What you get out of the box

Protokit is a set of modules that orchestrate together into a highly customizable appchain. Out of the box you get:

Modular Runtime API

Write idiomatic business logic in TypeScript, composed of reusable modules.

Provable protocol

The customizable protocol layer turns your runtime into recursive zero-knowledge proofs.

Sequencer

A production-grade sequencer with a mempool, block production, a GraphQL API, and an indexer - ready to run locally or in production.

L1 settlement & bridging

Trustless anchoring to Mina, with deposits and withdrawals between L1 and your appchain

Fast dev loop

Mock proofs for quick iteration and CI-friendly tests; flip a single configuration flag to switch to real proofs when you’re ready to go to production.

Easy scaffolding with starter-kit

Starter-kit lets you dive straight in by offering a pre-configured project that has everything from early development to production launch.

Where to go next

  • Quickstart — clone the starter kit and run your first appchain in a few minutes.
  • Architecture — the mental model behind runtime, protocol, and sequencer.
  • Runtime — writing your application’s business logic.
  • Settlement & Bridging — anchoring your appchain to Mina.
  • FAQ — short answers to the questions we get most often.