| Crates.io | kona-engine |
| lib.rs | kona-engine |
| version | 0.1.2 |
| created_at | 2025-07-21 20:08:04.425913+00 |
| updated_at | 2025-07-31 14:15:10.093453+00 |
| description | An implementation of the OP Stack engine client |
| homepage | https://github.com/op-rs/kona |
| repository | https://github.com/op-rs/kona |
| max_upload_size | |
| id | 1762604 |
| size | 306,388 |
kona-engineAn extensible implementation of the OP Stack rollup node engine client.
The kona-engine crate provides a task-based engine client for interacting with Ethereum execution layers. It implements the Engine API specification and manages the execution layer state through a priority-driven task queue system.
Engine - Main task queue processor that executes engine operations atomicallyEngineClient - HTTP client for Engine API communication with JWT authenticationEngineState - Tracks the current state of the execution layerInsertTask - Insert new payloads into the execution engineBuildTask - Build new payloads with automatic forkchoice synchronizationConsolidateTask - Consolidate unsafe payloads to advance the safe chainFinalizeTask - Finalize safe payloads on L1 confirmationSynchronizeTask - Internal task for execution layer forkchoice synchronizationThe engine implements a task-driven architecture where forkchoice synchronization is handled automatically:
BuildTask automatically performs forkchoice updates during block building, eliminating the need for explicit forkchoice management in user code.SynchronizeTask handles internal execution layer synchronization and is primarily used by other tasks rather than directly by users.use kona_engine::{Engine, EngineClient, EngineState};
use kona_genesis::RollupConfig;
use alloy_rpc_types_engine::JwtSecret;
use url::Url;
use std::sync::Arc;
# async fn example() -> Result<(), Box<dyn std::error::Error>> {
// Create an engine client
let engine_url = Url::parse("http://localhost:8551")?;
let l1_url = Url::parse("http://localhost:8545")?;
let config = Arc::new(RollupConfig::default());
let jwt = JwtSecret::from_hex("0xabcd")?;
let client = EngineClient::new_http(engine_url, l1_url, config, jwt);
// Initialize engine state
let state = EngineState::default();
// Create task queue watchers
let (state_sender, _) = tokio::sync::watch::channel(state);
let (queue_sender, _) = tokio::sync::watch::channel(0);
// Create the engine
let engine = Engine::new(state, state_sender, queue_sender);
# Ok(())
# }
The crate supports multiple Engine API versions with automatic version selection based on the rollup configuration:
Version selection follows Optimism hardfork activation times (Bedrock, Canyon, Delta, Ecotone, Isthmus).
metrics - Enable Prometheus metrics collection (optional)