Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.optimism.io/llms.txt

Use this file to discover all available pages before exploring further.

In this section, the code examples demonstrate loading the rollup config for the given L2 Chain ID. Let’s load the Rollup Config for OP Mainnet which hash chain id 10.
extern crate kona_genesis;
extern crate kona_protocol;

use kona_registry::ROLLUP_CONFIGS;
use kona_genesis::OP_MAINNET_CHAIN_ID;

// Load a rollup config from the chain id.
let op_mainnet_config = ROLLUP_CONFIGS.get(&OP_MAINNET_CHAIN_ID).expect("infallible");

// The chain id should match the hardcoded chain id.
assert_eq!(op_mainnet_config.chain_id, OP_MAINNET_CHAIN_ID);
Available Configskona-registry dynamically provides all rollup configs from the superchain-registry for their respective chain ids. Note though, that this requires serde since it deserializes the rollup configs dynamically from json files.