This repository contains an example rollup that integrates with the Espresso Sequencer. The example rollup represents a simple key/value account store that receives ordered transactions from Espresso, executes them in the rollup VM, and publishes mock state proofs to an L1 (Ethereum) smart contract. The rollup contains a simple API for submitting transactions and querying account balances.
Espresso is built upon HotShot, a network that achieves consensus on batches of rollup transactions. At a high level, a rollup is an L1 scaling solution that performs expensive computations off chain. In the case of zkRollups, a prover periodically submits rollup state checkpoints along with batch proofs of transaction validity to the L1. The example illustrated here is a mock zkRollup. To learn more about the Espresso rollups, read our docs
Ensure docker
is installed on your system.
For linux distributions follow official instructions of your linux distribution or see the official docker instructions.
We first need to start a local Espresso Sequencer network.
git clone https://github.com/EspressoSystems/espresso-sequencer
cd espresso-sequencer
docker compose pull
docker compose up -d --wait
Once that is finished deploy the example rollup, it can be run natively.
To run natively a rust toolchain is required. We provide a nix shell to install all dependencies. Nix can be installed via the nix-installer. Once installed run the following from the root of the project:
nix develop
just dev-demo
After running just dev-demo
, you will be able to see new state event
logs after a few minutes.
submit
endpoint of the rollup API. If Alice is concerned about censorship, she can send her transaction directly to
the sequencer.Light Client
contract on L1, which verifies that consensus has been reached on the new state.Rollup State
The state of the example rollup consists of:
Executor
The executor is a service responsible for subscribing to new state posted to the L1 light client contract, applying transactions to the rollup state, and submitting mock proofs to the rollup contract. Rollups often separate the roles of executor and prover into two distinct services, but this example combines them for the sake of simplicity.
Rollup API
The rollup API is a REST API that includes a submit
and query
endpoint.
Rollup Contract
The rollup contract stores the most recent rollup state commitment. The contract updates the state commitment when it receives a valid state transition proof from the executor.
In this example, we used a few Espresso components as described below. More information can be found in the docs
The light client is a smart contract that verifies the integrity of the rollup state. The contract code can be found here
We ran an espresso network using the espresso-sequencer docker images. The network uses hotshot to achieve consensus on the rollup state. Architecture can be found here
Espresso Network uses HotShot to achieve consensus on the rollup state.