Skip to main content
This guide walks through implementing the data source traits that let you run kona-client, or a variation of it, on a verifiable backend of your choosing. Before starting, make sure you’re familiar with the two components being composed - the derivation pipeline and the execution engine - covered in understanding the OP Stack STF.

Backend Traits

Covered in the FPVM Backend section of the book, kona-client ships with an implementation of kona-derive and kona-executor’s data source traits which pull in data over the PreimageOracle ABI. However, running kona-client on top of a different verifiable environment, i.e. a zkVM or TEE, is also possible through custom implementations of these data source traits. op-succinct is an excellent example of both a custom backend and a custom program, implementing both kona-derive and kona-executor’s data source traits backed by sp1_lib::io in order to:
  1. Execute kona-client verbatim, proving a single block’s derivation and execution on SP-1.
  2. Derive and execute an entire Span Batch worth of L2 blocks, using kona-derive and kona-executor.
This section of the book outlines how you can do the same for a different platform.

Custom kona-derive sources

Before getting started, we need to create custom implementations of the following traits: Once these are implemented, constructing the pipeline is as simple as passing in the data sources to the PipelineBuilder. Keep in mind the requirements for validation of incoming data, depending on your platform. For example, programs targeting zkVMs must constrain that the incoming data is indeed valid, whereas fault proof programs can offload this validation to the on-chain implementation of the host.
From here, a custom derivation driver is needed to produce the desired execution payload(s). An example of this for kona-client can be found in the single proof implementation.

kona-mpt / kona-executor sources

Before getting started, we need to create custom implementations of the following traits: Once we have those, the StatelessL2BlockExecutor can be constructed like so:

Bringing it Together

Once your custom backend traits for both kona-derive and kona-executor have been implemented, your final binary may look something like that of kona-client’s. Alternatively, if you’re looking to prove a wider range of blocks, op-succinct’s range program offers a good example of running the pipeline and executor across a string of contiguous blocks.