From bfe078db90d534a0c31397e99d6960ffc85c76b6 Mon Sep 17 00:00:00 2001 From: alexander-sei Date: Fri, 26 Jun 2026 15:44:07 +0200 Subject: [PATCH 1/2] docs: add live SSTORE gas widget backed by verified on-chain probe MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds SstoreGasLive (snippets/sstore-gas-live.jsx), embedded in the SSTORE Gas Cost section of differences-with-ethereum. It reads the cost live via eth_call from SstoreGasProbe — a tiny Sourcify-verified contract whose functions measure a throwaway SSTORE with the GAS opcode (state discarded, no gas spent), so the displayed number always reflects the current governance parameter (KeySeiSstoreSetGasEIP2200) and can never go stale. Verified deployments (exact_match on Sourcify, visible on Seiscan): - mainnet (pacific-1 / 1329): 0xeeB428bcf499D0A1c401f123F64BFf754a5de57A - testnet (atlantic-2 / 1328): 0xE5A35b2457E1C3cfF2F6527fAA32DE0B2a8e28E0 Shows the SSTORE_SET parameter (~72,000) and the cold first-write cost (~74,100 = param + EIP-2929 cold access), with a mainnet/testnet toggle and a link to the verified contract. The contract source lives on-chain via Sourcify, not in this repo. Co-Authored-By: Claude Opus 4.8 --- evm/differences-with-ethereum.mdx | 7 ++ snippets/sstore-gas-live.jsx | 139 ++++++++++++++++++++++++++++++ 2 files changed, 146 insertions(+) create mode 100644 snippets/sstore-gas-live.jsx diff --git a/evm/differences-with-ethereum.mdx b/evm/differences-with-ethereum.mdx index cb1e3c8..e5f5871 100644 --- a/evm/differences-with-ethereum.mdx +++ b/evm/differences-with-ethereum.mdx @@ -4,6 +4,9 @@ sidebarTitle: 'Divergence from Ethereum' description: "A comparison of Sei EVM and Ethereum, highlighting Sei's advantages in blocktime, throughput, finality, and execution environment, as well as technical differences in opcodes, state storage, and other features." keywords: ['Sei EVM', 'Ethereum comparison', 'blockchain differences', 'EVM compatibility', 'blockchain performance'] --- + +import { SstoreGasLive } from '/snippets/sstore-gas-live.jsx'; + While Sei features full EVM compatibility, there are some distinctions between Sei's EVM and Ethereum itself: @@ -183,6 +186,10 @@ This provides flexibility to tune storage costs based on EVM state size and netw Currently, the `SSTORE` gas cost is set to the non-standard value of **72,000 gas**, and this is the same on both mainnet (`pacific-1`) and testnet (`atlantic-2`) — it does not vary by network. It was set by governance [Proposal #109](https://www.mintscan.io/sei/proposals/109) ("Update EVM SSTORE set gas to 72000"), which changed the `evm` module parameter `KeySeiSstoreSetGasEIP2200` to `72000`. +The values below are read **live** from the Sei EVM — they reflect the parameter as it is set right now, so they stay correct even if governance changes it later: + + + To confirm the real cost yourself, use a live `eth_estimateGas` call against a Sei RPC. Note that a Foundry `forge test --gas-report --fork-url ` report forks chain *state* but applies revm's standard EVM gas schedule, so it reports the Ethereum cost (~22,100) rather than Sei's — it is useful for relative profiling of your own logic, not for the absolute storage-write cost. Since `SSTORE` is a governance-controlled parameter, this value may change in the future through a governance proposal. diff --git a/snippets/sstore-gas-live.jsx b/snippets/sstore-gas-live.jsx new file mode 100644 index 0000000..cc9604e --- /dev/null +++ b/snippets/sstore-gas-live.jsx @@ -0,0 +1,139 @@ +export const SstoreGasLive = ({ network = 'mainnet' }) => { + // Reads the live SSTORE gas cost from SstoreGasProbe — a tiny, Sourcify-verified + // contract whose functions measure a throwaway SSTORE with the GAS opcode. Called via + // eth_call (read-only, state discarded, no gas spent), so the number always reflects the + // current governance parameter (KeySeiSstoreSetGasEIP2200) and can never go stale. + const COLD = '0x50025cb2'; // coldWriteCost() -> SSTORE_SET + EIP-2929 cold access + const PARAM = '0x095f88b9'; // setParamGas() -> SSTORE_SET parameter alone (pre-warmed) + + const RPC = { + mainnet: { + url: 'https://evm-rpc.sei-apis.com', + chain: 'pacific-1', + id: 1329, + probe: '0xeeB428bcf499D0A1c401f123F64BFf754a5de57A', + explorer: 'https://seiscan.io/address/0xeeB428bcf499D0A1c401f123F64BFf754a5de57A' + }, + testnet: { + url: 'https://evm-rpc-testnet.sei-apis.com', + chain: 'atlantic-2', + id: 1328, + probe: '0xE5A35b2457E1C3cfF2F6527fAA32DE0B2a8e28E0', + explorer: 'https://testnet.seiscan.io/address/0xE5A35b2457E1C3cfF2F6527fAA32DE0B2a8e28E0' + } + }; + + const [net, setNet] = useState(network === 'testnet' ? 'testnet' : 'mainnet'); + const [data, setData] = useState(null); + const [err, setErr] = useState(null); + const [loading, setLoading] = useState(true); + + const ethCall = async (url, to, data) => { + const res = await fetch(url, { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ jsonrpc: '2.0', id: 1, method: 'eth_call', params: [{ to, data }, 'latest'] }) + }); + const json = await res.json(); + if (json.error) throw new Error(json.error.message || 'eth_call failed'); + return parseInt(json.result, 16); + }; + + const load = async (which) => { + setLoading(true); + setErr(null); + try { + const { url, probe } = RPC[which]; + const [param, cold] = await Promise.all([ethCall(url, probe, PARAM), ethCall(url, probe, COLD)]); + setData({ param, cold }); + } catch (e) { + setErr(e && e.message ? e.message : 'Failed to query RPC'); + setData(null); + } finally { + setLoading(false); + } + }; + + useEffect(() => { + load(net); + }, [net]); + + const fmt = (n) => (n == null ? '—' : n.toLocaleString('en-US')); + + const TabButton = ({ value, children }) => { + const active = net === value; + return ( + + ); + }; + + const Stat = ({ label, value, sub }) => ( +
+ + {label} + + + {loading ? '…' : value} + gas + + {sub && {sub}} +
+ ); + + return ( +
+
+ + Live SSTORE gas — measured on-chain + +
+ Mainnet + Testnet +
+
+ + {err ? ( +
+ Could not reach {RPC[net].chain} RPC: {err}{' '} + +
+ ) : ( +
+ + +
+ )} + +
+ {RPC[net].chain} ({RPC[net].id}) · read via eth_call from the verified{' '} + + SstoreGasProbe + {' '} + contract. Governance-adjustable — set by{' '} + + Proposal #109 + + . +
+
+ ); +}; From 928352d2d3123954cf042c2e2c883084c47c97cd Mon Sep 17 00:00:00 2001 From: alexander-sei Date: Fri, 26 Jun 2026 16:15:01 +0200 Subject: [PATCH 2/2] Clarify SSTORE gas doc and adjust live snippet Clarify that the SSTORE opcode gas cost is an on-chain, configurable parameter and note the current non-standard value of 72,000 gas set by governance Proposal #109 (https://www.mintscan.io/sei/proposals/109). Remove duplicated wording in the docs and update the live SSTORE gas snippet to display the governance values (subtracting the execution-frame gas: param - 8, cold - 7) so the shown stats reflect the on-chain parameter rather than frame-inclusive values. --- evm/differences-with-ethereum.mdx | 8 +++----- snippets/sstore-gas-live.jsx | 4 ++-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/evm/differences-with-ethereum.mdx b/evm/differences-with-ethereum.mdx index e5f5871..4d7b7cc 100644 --- a/evm/differences-with-ethereum.mdx +++ b/evm/differences-with-ethereum.mdx @@ -180,13 +180,11 @@ Transaction Fee = Gas Used × Gas Price ## SSTORE Gas Cost -On Sei, the `SSTORE` opcode gas cost is configurable as an on-chain parameter, meaning it can be adjusted via governance proposal without requiring a chain upgrade. +On Sei, the `SSTORE` opcode gas cost is configurable as an on-chain parameter, meaning it can be adjusted via governance proposal without requiring a chain upgrade. This provides flexibility to tune storage costs based on EVM state size and network conditions. -This provides flexibility to tune storage costs based on EVM state size and network conditions. +Currently, the `SSTORE` gas cost is set to the non-standard value of **72,000 gas**. This value is the same on both mainnet (`pacific-1`) and testnet (`atlantic-2`). It was set by governance [Proposal #109](https://www.mintscan.io/sei/proposals/109) ("Update EVM SSTORE set gas to 72000"), which changed the `evm` module parameter `KeySeiSstoreSetGasEIP2200` to `72000`. -Currently, the `SSTORE` gas cost is set to the non-standard value of **72,000 gas**, and this is the same on both mainnet (`pacific-1`) and testnet (`atlantic-2`) — it does not vary by network. It was set by governance [Proposal #109](https://www.mintscan.io/sei/proposals/109) ("Update EVM SSTORE set gas to 72000"), which changed the `evm` module parameter `KeySeiSstoreSetGasEIP2200` to `72000`. - -The values below are read **live** from the Sei EVM — they reflect the parameter as it is set right now, so they stay correct even if governance changes it later: +The values below are read **live** from the Sei EVM: diff --git a/snippets/sstore-gas-live.jsx b/snippets/sstore-gas-live.jsx index cc9604e..b5a578c 100644 --- a/snippets/sstore-gas-live.jsx +++ b/snippets/sstore-gas-live.jsx @@ -118,8 +118,8 @@ export const SstoreGasLive = ({ network = 'mainnet' }) => { ) : (
- - + +
)}