go-ethereum/cmd/keeper
Guillaume Ballet b1809d13d1
cmd/keeper: use the ziren keccak precompile (#32816)
Uses the go module's `replace` directive to delegate keccak computation
to precompiles.

This is still in draft because it needs more testing. Also, it relies on
a PR that I created, that hasn't been merged yet.

_Note that this PR doesn't implement the stateful keccak state
structure, and it reverts to the current behavior. This is a bit silly
since this is what is used in the tree root computation. The runtime
doesn't currently export the sponge. I will see if I can fix that in a
further PR, but it is going to take more time. In the meantime, this is
a useful first step_
2025-10-20 11:52:02 +02:00
..
1192c3_block.rlp cmd/keeper: add the keeper zkvm guest program (#32543) 2025-09-15 19:47:41 +02:00
1192c3_witness.rlp cmd/keeper: add the keeper zkvm guest program (#32543) 2025-09-15 19:47:41 +02:00
chainconfig.go cmd/keeper: add the keeper zkvm guest program (#32543) 2025-09-15 19:47:41 +02:00
getpayload_example.go cmd/keeper: add the keeper zkvm guest program (#32543) 2025-09-15 19:47:41 +02:00
getpayload_ziren.go cmd/keeper: use the ziren keccak precompile (#32816) 2025-10-20 11:52:02 +02:00
go.mod cmd/keeper: use the ziren keccak precompile (#32816) 2025-10-20 11:52:02 +02:00
go.sum cmd/keeper: use the ziren keccak precompile (#32816) 2025-10-20 11:52:02 +02:00
main.go cmd/keeper: disable GC for zkvm execution (#32638) 2025-09-17 16:12:16 +02:00
README.md cmd/keeper: add the keeper zkvm guest program (#32543) 2025-09-15 19:47:41 +02:00
stubs.go cmd/keeper: add the keeper zkvm guest program (#32543) 2025-09-15 19:47:41 +02:00

Keeper - geth as a zkvm guest

Keeper command is a specialized tool for validating stateless execution of Ethereum blocks. It's designed to run as a zkvm guest.

Overview

The keeper reads an RLP-encoded payload containing:

  • A block to execute
  • A witness with the necessary state data
  • A chainID

It then executes the block statelessly and validates that the computed state root and receipt root match the values in the block header.

Building Keeper

The keeper uses build tags to compile platform-specific input methods and chain configurations:

Example Implementation

See getpayload_example.go for a complete example with embedded Hoodi block data:

# Build example with different chain configurations
go build -tags "example" ./cmd/keeper

Ziren zkVM Implementation

Build for the Ziren zkVM platform, which is a MIPS ISA-based zkvm:

GOOS=linux GOARCH=mipsle GOMIPS=softfloat go build -tags "ziren" ./cmd/keeper

As an example runner, refer to https://gist.github.com/gballet/7b669a99eb3ab2b593324e3a76abd23d

Creating a Custom Platform Implementation

To add support for a new platform (e.g., "myplatform"), create a new file with the appropriate build tag:

1. Create getinput_myplatform.go

//go:build myplatform

package main

import (
    "github.com/ethereum/go-ethereum/params"
    // ... other imports as needed
)

// getInput returns the RLP-encoded payload
func getInput() []byte {
    // Your platform-specific code to retrieve the RLP-encoded payload
    // This might read from:
    // - Memory-mapped I/O
    // - Hardware registers
    // - Serial port
    // - Network interface
    // - File system

    // The payload must be RLP-encoded and contain:
    // - Block with transactions
    // - Witness with parent headers and state data

    return encodedPayload
}