diff --git a/ai/agentic-wallets.mdx b/ai/agentic-wallets.mdx index 81649be9..6a09363b 100644 --- a/ai/agentic-wallets.mdx +++ b/ai/agentic-wallets.mdx @@ -3,6 +3,9 @@ title: 'Agentic Wallets' description: 'Build AI agents with secure, programmable wallets on Sei using Coinbase AgentKit or Privy server wallets. Includes setup guides, policy engines, and a full feature comparison.' keywords: ['agentic wallets', 'ai agents', 'coinbase agentkit', 'privy', 'server wallets', 'sei ai', 'agent wallet', 'cdp wallet', 'wallet policy engine'] --- + +import { AgenticWalletFlow } from '/snippets/agentic-wallet-diagrams.jsx'; + Agentic wallets let AI agents hold funds, sign transactions, and interact with smart contracts autonomously. They do this without exposing private keys to the agent or the LLM. This page covers the two leading solutions that work on Sei today: Coinbase AgentKit and Privy server wallets. @@ -19,12 +22,7 @@ An agentic wallet sits between your AI agent and the blockchain: 4. **TEE signs**: The private key is isolated in a Trusted Execution Environment (TEE) and signs the transaction there. The key is never exposed to the agent. 5. **Broadcast**: The signed transaction is submitted to Sei's EVM RPC. -``` -┌─────────┐ ┌───────────┐ ┌──────────────┐ ┌─────────┐ ┌──────────┐ -│ LLM / │────▶│ Wallet │────▶│ Policy │────▶│ TEE │────▶│ Sei EVM │ -│ Agent │ │ SDK │ │ Engine │ │ Signer │ │ RPC │ -└─────────┘ └───────────┘ └──────────────┘ └─────────┘ └──────────┘ -``` + ## Quick comparison diff --git a/assets/address-derivation.png b/assets/address-derivation.png deleted file mode 100644 index a27c9d95..00000000 Binary files a/assets/address-derivation.png and /dev/null differ diff --git a/assets/fonts/KaTeX_Main-Regular.woff2 b/assets/fonts/KaTeX_Main-Regular.woff2 new file mode 100644 index 00000000..eb24a7ba Binary files /dev/null and b/assets/fonts/KaTeX_Main-Regular.woff2 differ diff --git a/assets/fonts/KaTeX_Math-Italic.woff2 b/assets/fonts/KaTeX_Math-Italic.woff2 new file mode 100644 index 00000000..215c143f Binary files /dev/null and b/assets/fonts/KaTeX_Math-Italic.woff2 differ diff --git a/assets/fonts/LICENSE-KaTeX b/assets/fonts/LICENSE-KaTeX new file mode 100644 index 00000000..37c6433e --- /dev/null +++ b/assets/fonts/LICENSE-KaTeX @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2013-2020 Khan Academy and other contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/assets/interoperability.png b/assets/interoperability.png deleted file mode 100644 index 737ca5af..00000000 Binary files a/assets/interoperability.png and /dev/null differ diff --git a/assets/pointer-contracts-how-it-works.png b/assets/pointer-contracts-how-it-works.png deleted file mode 100644 index dc89fa9d..00000000 Binary files a/assets/pointer-contracts-how-it-works.png and /dev/null differ diff --git a/assets/pointer-contracts-simplified.png b/assets/pointer-contracts-simplified.png deleted file mode 100644 index be718477..00000000 Binary files a/assets/pointer-contracts-simplified.png and /dev/null differ diff --git a/assets/pointer-contracts-without.png b/assets/pointer-contracts-without.png deleted file mode 100644 index a986272b..00000000 Binary files a/assets/pointer-contracts-without.png and /dev/null differ diff --git a/giga/index.mdx b/giga/index.mdx index 84535f44..9503b900 100644 --- a/giga/index.mdx +++ b/giga/index.mdx @@ -40,7 +40,7 @@ On an internal devnet of 40 nodes across 20 regions, Giga sustained more than 5 | State proofs | Block Update Digests (BUDs). Proof cost scales with per-block updates, not total state size | | Transaction ingress | No traditional public mempool. Before Sedna, complete transactions route to validator lanes. The later [Sedna](/giga/specs#sedna-private-dissemination) milestone introduces coded symbol bundles | | EVM compatibility | Will be equivalent to Ethereum mainnet except EIP-4844 blobs, `PREVRANDAO`, the state root, the block gas limit, and the fee mechanism | -| Security model | Whitepaper model: BFT with `n = 3f + 1` replicas. Live implementation thresholds are stake-weighted. Under the stated assumptions, safety does not depend on network timing, and liveness requires network stabilization | +| Security model | Whitepaper model: BFT with $n = 3f + 1$ replicas. Live implementation thresholds are stake-weighted. Under the stated assumptions, safety does not depend on network timing, and liveness requires network stabilization | | Delivery | Phased, in-place upgrades of the live Sei network that keep the existing chain ID | ## Why does Sei Giga exist? @@ -62,7 +62,7 @@ Giga is designed to separate the work of a blockchain into four decoupled stages Giga will order transactions with [Autobahn](https://arxiv.org/abs/2401.10369), a Byzantine Fault Tolerant consensus protocol that separates data dissemination from ordering: - Each validator will continuously stream batches of transactions ("cars") into its own hash-chained lane, in parallel with every other validator. -- In the whitepaper's replica-count model, a Proof of Availability (PoA) will certify a batch after `f + 1` replica votes. Under the stated assumptions, this guarantees at least one honest holder. The implementation applies stake-weighted thresholds. +- In the whitepaper's replica-count model, a Proof of Availability (PoA) will certify a batch after $f + 1$ replica votes. Under the stated assumptions, this guarantees at least one honest holder. The implementation applies stake-weighted thresholds. - Consensus will periodically commit a cut: a snapshot of the latest certified tip of every lane. Lanes are hash-chained, so committing a tip implicitly commits everything behind it. One consensus decision can therefore finalize many blocks of data at once. - Pipelined slots are designed for an effective steady-state cadence of one committed cut per 1.5 network round trips, versus three full rounds for Tendermint. This is a throughput cadence, not a submission-to-finality guarantee. Validators will vote on compact certificates instead of downloading full blocks first. @@ -130,7 +130,7 @@ The walkthrough and the steps below describe the initial Autobahn flow before Se 1. You will send a signed transaction to an RPC node, which will route it toward a validator. Allocation will be stake-weighted. For censorship resistance, you will be able to submit the same transaction to several validators. 2. The validator will append the transaction to its next batch and chain that batch into its lane. -3. When the batch reaches the availability threshold, it will hold a Proof of Availability, and the lane tip will advance. The threshold is `f + 1` replicas in the whitepaper model and stake-weighted in the implementation. +3. When the batch reaches the availability threshold, it will hold a Proof of Availability, and the lane tip will advance. The threshold is $f + 1$ replicas in the whitepaper model and stake-weighted in the implementation. 4. Pipelined consensus will commit a cut of all lane tips. Your transaction's position will then be fixed. This is ordering finality. On the internal devnet, it arrived in under 250 ms. 5. Each executing validator or full node will merge the cut into one sequence with the deterministic tip-priority rule. It will drop duplicates by hash and execute the result in parallel. Duplicate copies will not execute and will not pay execution costs twice. 6. Validators will attest to the block's divergence digest in a later block. This is state attestation finality. diff --git a/giga/specs.mdx b/giga/specs.mdx index 0f21046e..16fe2540 100644 --- a/giga/specs.mdx +++ b/giga/specs.mdx @@ -14,11 +14,11 @@ This page specifies the Sei Giga protocol as defined in the [Giga whitepaper v2. | Property | Specification | | ------------------------- | -------------------------------------------------------------------------------------------------- | | Chain type | Permissionless Proof-of-Stake EVM Layer 1. SEI will remain the native gas, fee, and staking asset | -| Fault model | Whitepaper model: `n = 3f + 1` replicas, up to `f` faulty. The implementation weights votes by stake | +| Fault model | Whitepaper model: $n = 3f + 1$ replicas, up to $f$ faulty. The implementation weights votes by stake | | Synchrony assumption | Partial synchrony: under the stated fault and cryptographic assumptions, safety does not depend on network timing. Liveness resumes after network stabilization | | Consensus | Autobahn: per-validator data lanes with leader-driven cut-of-tips ordering | -| Data availability quorum | Whitepaper: `f + 1` replica votes (Proof of Availability). Implementation thresholds are stake-weighted | -| Ordering quorum | Whitepaper: `n - f` prepare/commit votes. Implementation thresholds are stake-weighted | +| Data availability quorum | Whitepaper: $f + 1$ replica votes (Proof of Availability). Implementation thresholds are stake-weighted | +| Ordering quorum | Whitepaper: $n - f$ prepare/commit votes. Implementation thresholds are stake-weighted | | Consensus cadence | Effective steady-state cadence of one committed cut per 1.5 network round trips under pipelining, not submission-to-finality latency | | Execution | Asynchronous, post-ordering, and deterministic, with Block-STM-style optimistic concurrency control | | State attestation | Two-thirds voting-power signatures over per-block lattice-hash divergence digests, included in a later block | @@ -32,10 +32,10 @@ This page specifies the Sei Giga protocol as defined in the [Giga whitepaper v2. ## Network and security model -The equations in the whitepaper use a replica-count model with `n = 3f + 1`, of which at most `f` replicas are Byzantine. The `sei-chain` implementation applies stake-weighted voting thresholds. When you reason about the live network, do not interpret `f` as a raw validator count. Under the whitepaper's fault and cryptographic assumptions, even an extended network delay does not allow two conflicting proposals to receive valid commit certificates. The network may pause during a disruption and resume when message delays return within the protocol's timing bounds. +The equations in the whitepaper use a replica-count model with $n = 3f + 1$, of which at most $f$ replicas are Byzantine. The `sei-chain` implementation applies stake-weighted voting thresholds. When you reason about the live network, do not interpret $f$ as a raw validator count. Under the whitepaper's fault and cryptographic assumptions, even an extended network delay does not allow two conflicting proposals to receive valid commit certificates. The network may pause during a disruption and resume when message delays return within the protocol's timing bounds. - Safety: no two conflicting proposals can both obtain a valid commit certificate in the same consensus slot. Attesting to two different divergence digests for the same finalized block will be slashable equivocation. This is because quorum intersection guarantees that at least one honest validator would have to sign both. -- Censorship resistance: when a proposal reaches the availability threshold, at least one honest replica stores its data under the stated assumptions. The threshold is `f + 1` replicas in the whitepaper model and stake-weighted in the implementation. A correct leader must then include the proposal in a future cut. This is designed to limit censorship to a finite delay. Users will also be able to submit a transaction to multiple validators at once ([deduplicated at merge](#mev-and-fee-design), with a partial tip refund). +- Censorship resistance: when a proposal reaches the availability threshold, at least one honest replica stores its data under the stated assumptions. The threshold is $f + 1$ replicas in the whitepaper model and stake-weighted in the implementation. A correct leader must then include the proposal in a future cut. This is designed to limit censorship to a finite delay. Users will also be able to submit a transaction to multiple validators at once ([deduplicated at merge](#mev-and-fee-design), with a partial tip refund). - Execution divergence: divergence below one-third of voting power can be isolated. Divergence beyond the Byzantine threshold is designed to pause the chain. - Staking: validators will continue to bond SEI and can be slashed for malicious behavior. The complete slashing schedule, reward functions, and tokenomics for Giga are deferred to future work. For today's staking parameters, see [Staking](/learn/general-staking). @@ -45,9 +45,9 @@ Sei Giga will order transactions with [Autobahn](https://arxiv.org/abs/2401.1036 ### Data dissemination: lanes and Proofs of Availability -- Every validator `r` will maintain its own lane: an append-only, hash-chained sequence of transaction batches (called cars). A proposal is the tuple `Prop = ⟨pos, batch, parentRef⟩`, signed by `r`. Here, `pos` is the lane sequence number, and `parentRef` is the hash of the previous proposal in the same lane. -- Validators that receive a proposal will verify that it extends the lane correctly and return a signed vote over its digest. When the proposer collects `f + 1` matching votes, it will assemble a Proof of Availability (PoA), a certificate that the data is retrievable. -- `f + 1` is enough because any such quorum contains at least one correct replica that held the full data when it voted. That replica serves the data until all correct replicas have it. Giga's design deliberately keeps the smaller quorum (instead of `2f + 1`) because commitment itself triggers full replication along the execution path. A larger quorum would only add certification latency. +- Every validator $r$ will maintain its own lane: an append-only, hash-chained sequence of transaction batches (called cars). A proposal is the tuple `Prop = ⟨pos, batch, parentRef⟩`, signed by $r$. Here, `pos` is the lane sequence number, and `parentRef` is the hash of the previous proposal in the same lane. +- Validators that receive a proposal will verify that it extends the lane correctly and return a signed vote over its digest. When the proposer collects $f + 1$ matching votes, it will assemble a Proof of Availability (PoA), a certificate that the data is retrievable. +- $f + 1$ is enough because any such quorum contains at least one correct replica that held the full data when it voted. That replica serves the data until all correct replicas have it. Giga's design deliberately keeps the smaller quorum (instead of $2f + 1$) because commitment itself triggers full replication along the execution path. A larger quorum would only add certification latency. - The latest proposal in a lane that holds a PoA is the lane's tip. Lanes are hash-chained, so certifying a tip implicitly attests the availability of every earlier proposal in that lane. Earlier entries do not need to be certified again. @@ -58,9 +58,9 @@ All validators will disseminate batches in parallel without waiting for consensu Consensus will periodically fix a global order by committing a cut, a vector of every lane's current certified tip: -1. Prepare. The slot's leader (chosen by stake-weighted selection, as in Tendermint) will bundle the latest certified tips into a cut proposal. Replicas will validate the PoAs and broadcast prepare votes. At `n - f` votes, these votes form a PrepareQC. -2. Commit. Replicas will exchange commit votes over the PrepareQC. In the whitepaper's replica-count model, a CommitQC formed from `n - f` votes finalizes the cut. -3. Pipelining. Slots will overlap. As soon as replicas see the Prepare message for slot `s`, they can begin slot `s + 1`. The next leader may start proposing while the previous cut is still in its commit phase. With quadratic communication and pipelining, the design targets an effective steady-state cadence of one committed cut per 1.5 network round trips. Tendermint uses three full rounds. This cadence is not a per-transaction finality guarantee. +1. Prepare. The slot's leader (chosen by stake-weighted selection, as in Tendermint) will bundle the latest certified tips into a cut proposal. Replicas will validate the PoAs and broadcast prepare votes. At $n - f$ votes, these votes form a PrepareQC. +2. Commit. Replicas will exchange commit votes over the PrepareQC. In the whitepaper's replica-count model, a CommitQC formed from $n - f$ votes finalizes the cut. +3. Pipelining. Slots will overlap. As soon as replicas see the Prepare message for slot $s$, they can begin slot $s + 1$. The next leader may start proposing while the previous cut is still in its commit phase. With quadratic communication and pipelining, the design targets an effective steady-state cadence of one committed cut per 1.5 network round trips. Tendermint uses three full rounds. This cadence is not a per-transaction finality guarantee. @@ -84,7 +84,7 @@ Giga will separate what consensus decides from what execution produces: | Finality | Definition | When it holds | | --------------------------- | -------------------------------------------------------------------------------------------------------- | ------------------------------------ | | Ordering finality | Consensus has finalized the unique total order of transactions induced by a committed cut | Sub-250 ms, measured on an internal devnet (not submission-to-receipt latency) | -| State attestation finality | A later finalized block includes a valid two-thirds voting-power attestation of the block's divergence digest | A bounded number of blocks later (lag `x` depends on execution timing) | +| State attestation finality | A later finalized block includes a valid two-thirds voting-power attestation of the block's divergence digest | A bounded number of blocks later (lag $x$ depends on execution timing) | Unless stated otherwise, latency claims in Giga materials refer to ordering finality. Under the protocol's stated fault and cryptographic assumptions, ordering finality fixes the transaction sequence. State attestation finality adds a BFT-signed confirmation of the execution results. @@ -96,13 +96,13 @@ Execution happens between these two protocol signals. A receipt becomes availabl For each finalized block, the protocol specifies the canonical transition `Apply(S_prev, context, block) → (S_new, receipts, gas, writeLog)`. Given the same pre-state, block context, ordered transactions, execution semantics, and serializable parallel schedule, conforming executors should derive byte-identical results without communicating. A transaction revert is itself an execution result and does not invalidate the rest of the block. Because of this intended determinism, execution can run off the consensus critical path. -The execution client is deliberately narrow. It processes transactions and nothing else, with no tracing or log search on the hot path. Incoming blocks are pre-processed in parallel (parsing, sender recovery, signature verification), while exactly one block executes at a time. Receipt generation and indexing happen after execution, so block `n + 1` can start while block `n` post-processes. +The execution client is deliberately narrow. It processes transactions and nothing else, with no tracing or log search on the hot path. Incoming blocks are pre-processed in parallel (parsing, sender recovery, signature verification), while exactly one block executes at a time. Receipt generation and indexing happen after execution, so block $n + 1$ can start while block $n$ post-processes. ### Parallel execution: Block-STM-style OCC Within a block, transactions execute concurrently under optimistic concurrency control (the [Block-STM](https://arxiv.org/abs/2203.06871) approach): -- A later transaction `t_j` depends on an earlier `t_i` when `t_i`'s write set overlaps `t_j`'s read or write set. The block's total order keeps this dependency relation acyclic. +- A later transaction $t_j$ depends on an earlier $t_i$ when $t_i$'s write set overlaps $t_j$'s read or write set. The block's total order keeps this dependency relation acyclic. - All transactions start to execute in parallel, and each buffers its writes privately. For each transaction, a validation phase checks whether any earlier-ordered transaction committed a write into its read or write set after it began. Conflicting transactions are rolled back and re-executed. - The committed result is provably identical to sequential execution in block order (a "valid parallel schedule"). When contention is low, most transactions commit on their first attempt. Under sustained contention, the engine may fall back to sequential execution with unchanged semantics. In `sei-chain`, the scheduler retries a transaction up to 10 times before it falls back to the sequential path. @@ -156,11 +156,11 @@ Giga's storage layer is designed for petabyte-per-year data production at full 5 ### Lattice-hash divergence digests -There will be no state root. Instead, Giga will commit to execution results with a homomorphic multiset hash (LtHash, by Lewi, Kim, Maykov, and Weis): `LH(X) = Σ h(x) mod q`. Its collision resistance rests on lattice assumptions (short integer solution style). For each block `n`: +There will be no state root. Instead, Giga will commit to execution results with a homomorphic multiset hash (LtHash, by Lewi, Kim, Maykov, and Weis): $\mathrm{LH}(X) = \sum_{x \in X} h(x) \bmod q$. Its collision resistance rests on lattice assumptions (short integer solution style). For each block $n$: -- The committed multiset `X_n` will contain one record per surviving write (after intra-block last-write-wins resolution). It will also contain one record per transaction receipt (position-bound) and one gas-accounting record. Each record will be domain-separated by type tag and height. -- The block digest is `d_n = LH(X_n)`. Validators will attest to the compact commitment `D_n = H(enc(n, d_n))`. The full vector `d_n` will be exchanged only during disputes. -- Disputes will resolve by bisection. The key space partitions into ranges whose chunk digests sum to the write component of `d_n` by construction. Divergent executors will therefore compare chunk digests and narrow the search. They will replay only the affected range to find the first divergent write, receipt, or gas discrepancy. +- The committed multiset $X_n$ will contain one record per surviving write (after intra-block last-write-wins resolution). It will also contain one record per transaction receipt (position-bound) and one gas-accounting record. Each record will be domain-separated by type tag and height. +- The block digest is $d_n = \mathrm{LH}(X_n)$. Validators will attest to the compact commitment $D_n = H(\mathrm{enc}(n, d_n))$. The full vector $d_n$ will be exchanged only during disputes. +- Disputes will resolve by bisection. The key space partitions into ranges whose chunk digests sum to the write component of $d_n$ by construction. Divergent executors will therefore compare chunk digests and narrow the search. They will replay only the affected range to find the first divergent write, receipt, or gas discrepancy. The homomorphism makes this practical. Digests update incrementally as writes commit, in any order, and no tree walk is involved. @@ -168,11 +168,11 @@ The homomorphism makes this practical. Digests update incrementally as writes co BUDs will restore externally verifiable state proofs (the role `eth_getProof` plays on Ethereum). Their cost will be proportional to per-block update volume, not total state size: -- Every state entry will carry an 8-byte last-modified height and a 1-byte serialization version. For each block `n`, the BUD `U_n` is the Merkle root over the lexicographically sorted leaves `(key, newValue, n, prevHeight)` of that block's writes. Validators will attest `U_n` on the same delayed two-thirds voting-power schedule as the divergence digest. -- A membership proof will be a Merkle path to an attested `U_n`. It will certify that `key` held `value` immediately after block `n`. It will also record when the key previously changed. Two proofs at heights `a < b` whose `b`-leaf records predecessor `a` will prove that the key was unmodified throughout `(a, b)`. -- SuperBUDs will aggregate BUDs over exponentially growing aligned windows (branching base `e` and maximum level `L_max`, both governance parameters). Provers will then cover long ranges with logarithmically many digests. The guaranteed proof window will be `η = e^L_max` blocks. Archive nodes can serve older claims, but those claims fall outside the protocol guarantee. -- Touch transactions will rewrite only a key's last-modified metadata. This will give long-untouched keys a fresh proof anchor. Deletions will leave tombstones, which anchor exclusion proofs and are garbage-collected after `η`. -- At the activation height, a one-time synthetic write log will bootstrap every existing key. The system will reach steady state after `η` blocks. BUD trees deliberately use a classical hash, because the short proof window keeps classical collision resistance sufficient. The trees will also fall under the same [post-quantum migration schedule](#post-quantum-migration) as the rest of the protocol. +- Every state entry will carry an 8-byte last-modified height and a 1-byte serialization version. For each block $n$, the BUD $U_n$ is the Merkle root over the lexicographically sorted leaves `(key, newValue, n, prevHeight)` of that block's writes. Validators will attest $U_n$ on the same delayed two-thirds voting-power schedule as the divergence digest. +- A membership proof will be a Merkle path to an attested $U_n$. It will certify that `key` held `value` immediately after block $n$. It will also record when the key previously changed. Two proofs at heights $a < b$ whose $b$-leaf records predecessor $a$ will prove that the key was unmodified throughout $(a, b)$. +- SuperBUDs will aggregate BUDs over exponentially growing aligned windows (branching base $e$ and maximum level $L_{\max}$, both governance parameters). Provers will then cover long ranges with logarithmically many digests. The guaranteed proof window will be $\eta = e^{L_{\max}}$ blocks. Archive nodes can serve older claims, but those claims fall outside the protocol guarantee. +- Touch transactions will rewrite only a key's last-modified metadata. This will give long-untouched keys a fresh proof anchor. Deletions will leave tombstones, which anchor exclusion proofs and are garbage-collected after $\eta$. +- At the activation height, a one-time synthetic write log will bootstrap every existing key. The system will reach steady state after $\eta$ blocks. BUD trees deliberately use a classical hash, because the short proof window keeps classical collision resistance sufficient. The trees will also fall under the same [post-quantum migration schedule](#post-quantum-migration) as the rest of the protocol. @@ -253,7 +253,7 @@ Giga is implemented in the open in [sei-protocol/sei-chain](https://github.com/s | FlatKV state commitment | Since v6.7, governance runs the migration from memiavl into FlatKV, which commits state with a lattice hash. Sei Mainnet's EVM state moved in October 2026 ([Proposals 126](https://seistream.app/proposals/126) and [127](https://seistream.app/proposals/127)). v6.8 added `migrate_cosmos` for the remaining modules, which has not started. FlatKV has no proof builder | | Giga SS Store | Dedicated EVM state store (`evm-ss-split`) for historical queries that targets ~150k TPS, shipped in v6.6. Opt-in for RPC nodes. See the [Giga storage migration guide](/node/giga-storage-migration) | | EVM-only executor | [`giga/evmonly`](https://github.com/sei-protocol/sei-chain/blob/main/giga/evmonly/README.md) executes raw RLP transactions with go-ethereum against an EVM-native state backend, under the Prague rules. Its Block-STM-style OCC reruns a conflicting transaction up to 10 times before it falls back to sequential execution. Autobahn nodes always run it | -| Autobahn | Implemented in `sei-tendermint/autobahn` (lanes, PoAs, prepare/commit QCs, timeout certificates). It ships in the binary and runs on `giga-testnet-1`, but stays disabled on Sei Mainnet until network activation. The committee is capped at 100 validators. The implementation uses a stake-weighted availability threshold that corresponds to the whitepaper's `f + 1` model | +| Autobahn | Implemented in `sei-tendermint/autobahn` (lanes, PoAs, prepare/commit QCs, timeout certificates). It ships in the binary and runs on `giga-testnet-1`, but stays disabled on Sei Mainnet until network activation. The committee is capped at 100 validators. The implementation uses a stake-weighted availability threshold that corresponds to the whitepaper's $f + 1$ model | | Giga app hash | The [Giga app hash specification](https://github.com/sei-protocol/sei-chain/blob/main/giga/apphash/apphash_spec.md) defines the per-block app hash that Autobahn validators agree on. It is a draft and can change before it reaches Sei Mainnet | | Operator surface | `autobahn-config-file` in `config.toml`, with a committee file generated by `seid tendermint gen-autobahn-config`. The `[giga.storage]`, `[giga.execution]`, and `[giga.rpc]` sections of `app.toml` configure the node. Consensus state persists across restarts to prevent double-signing, and HashVault halts a node before it commits a second app hash for a height | | RPC under Autobahn | The EVM-only JSON-RPC proxies `eth_sendRawTransaction` to the validator that owns the sender's shard. `eth_getTransactionCount` with `pending` returns the committed nonce. `eth_subscribe` supports `newHeads` and `logs` over WebSocket. See the [Giga testnet RPC methods](/giga/rpc-methods) | @@ -269,7 +269,7 @@ For exact keys and defaults, node operators should follow the [node configuratio | **Lane** | A validator's own append-only, hash-chained sequence of transaction batches | | **Car** | One batch of transactions in a lane (a lane entry) | | **Proposal** | Signed lane entry `⟨pos, batch, parentRef⟩` | -| **PoA (Proof of Availability)** | Certificate that proves proposal data is retrievable. The whitepaper threshold is `f + 1` replicas, and the implementation threshold is stake-weighted | +| **PoA (Proof of Availability)** | Certificate that proves proposal data is retrievable. The whitepaper threshold is $f + 1$ replicas, and the implementation threshold is stake-weighted | | **Tip** | The most recent proposal in a lane that holds a PoA | | **Cut** | The vector of all lanes' current tips committed by one consensus decision | | **Slot** | One consensus instance that commits one cut. Slots are pipelined | @@ -284,7 +284,7 @@ For exact keys and defaults, node operators should follow the [node configuratio | **BUD (Block Update Digest)** | Per-block Merkle root over that block's state updates, and the basis of Giga state proofs | | **SuperBUD** | Aggregated BUD covering an exponentially sized window of blocks | | **Touch transaction** | Transaction that refreshes a key's last-modified metadata to create a fresh proof anchor | -| **Proof window (η)** | Number of blocks over which BUD proofs are protocol-guaranteed (`η = e^L_max`, governance-set) | +| **Proof window ($\eta$)** | Number of blocks over which BUD proofs are protocol-guaranteed ($\eta = e^{L_{\max}}$, governance-set) | | **Merge rule** | Deterministic function from a committed cut to the executable transaction sequence (tip-priority order plus deduplication) | | **Socialised tips** | Epoch-pooled priority fees distributed by stake × liveness instead of to the carrying proposer | | **Distribution fee** | Fee component that prices duplicate submissions made for censorship resistance | diff --git a/learn/accounts.mdx b/learn/accounts.mdx index 1c1ad7ee..de13b239 100644 --- a/learn/accounts.mdx +++ b/learn/accounts.mdx @@ -5,6 +5,8 @@ description: "Understand how Sei's unified account system works with both EVM (0 keywords: ['sei accounts', 'dual address system', 'address association', 'EVM address', 'Cosmos address', 'wallet linking'] --- +import { AddressDerivation } from '/snippets/account-diagrams.jsx'; + Every account on Sei has a unique public key. You can use this public key to generate multiple wallet addresses, and these addresses are functionally the same. They look different, but they both point to the same destination: your @@ -16,7 +18,7 @@ define the same value, but they may be used in different contexts. - **"bech32" address**: Starts with `sei1` and is used for Cosmos functions. -![Address derivation](/assets/address-derivation.png) + Although these addresses look different, they share the same underlying account. After the two addresses are linked through association (described diff --git a/learn/dev-interoperability.mdx b/learn/dev-interoperability.mdx index dcd78fc3..297855c2 100644 --- a/learn/dev-interoperability.mdx +++ b/learn/dev-interoperability.mdx @@ -5,6 +5,8 @@ description: 'Understand how Sei enables seamless interaction between EVM and Co keywords: ['blockchain interoperability', 'EVM Cosmos bridge', 'dual address system', 'precompile contracts'] --- +import { EvmCosmWasmInterop } from '/snippets/interop-diagrams.jsx'; + **CosmWasm deployments are frozen, and IBC is disabled in both directions.** Per [Proposal 115](https://seistream.app/proposals/115), no new CosmWasm contracts can be uploaded or instantiated on Sei. Proposals [116](https://seistream.app/proposals/116), [120](https://seistream.app/proposals/120), and [121](https://seistream.app/proposals/121) disabled inbound and then outbound IBC transfers. No asset can be bridged into or out of Sei over IBC. @@ -47,5 +49,4 @@ To learn how to use EVM precompiles, see the ## Example diagram -![Interoperability](/assets/interoperability.png) -*Access to all tokens and contracts on Sei* + diff --git a/learn/pointers.mdx b/learn/pointers.mdx index 442699ae..e3269908 100644 --- a/learn/pointers.mdx +++ b/learn/pointers.mdx @@ -5,6 +5,8 @@ description: "Understand how Sei's pointer contract system enables seamless asse keywords: ['pointer contracts', 'cross-vm interoperability', 'evm cosmos bridge', 'token bridging', 'smart contract integration'] --- +import { PointerContractsAccess, PointerContractsFlow } from '/snippets/interop-diagrams.jsx'; + **Pointer contracts are primarily a legacy and migration tool.** Per [Proposal 115](https://seistream.app/proposals/115), no new CosmWasm contracts can be uploaded or instantiated on Sei. Pointer creation was retired in v6.8.0. Existing pointers keep working, but you can't create a pointer of any kind. The pointer precompile at `0x000000000000000000000000000000000000100B` reverts on every call. The `seid tx evm register-cw-pointer`, `register-evm-pointer`, and `add-erc-native-pointer` commands are removed. Governance refuses pointer proposals. @@ -17,9 +19,6 @@ environments. ## Why pointer contracts -![Without Pointer Contracts](/assets/pointer-contracts-without.png) -*A world without pointer contracts* - Wallets and clients for feature-rich protocols typically support only one execution environment. EVM wallets handle ERC-20 coins and ERC-721 NFTs. They cannot interact with Cosmos-SDK-based assets, because the token standards and @@ -30,13 +29,11 @@ interact with Ethereum-based contracts or ERC tokens. Pointer contracts solve this problem. They make either protocol interoperable, regardless of the client interface. -![With Pointer Contracts](/assets/pointer-contracts-simplified.png) -*With pointer contracts, wallets in either environment can access all tokens* + ## How pointer contracts work -![How Pointer Contracts Work](/assets/pointer-contracts-how-it-works.png) -*Pointer contracts enable interoperability* + Each smart contract can have only **one** associated pointer contract. An on-chain registry records each pointer. This prevents conflicts and gives a diff --git a/snippets/account-diagrams.jsx b/snippets/account-diagrams.jsx new file mode 100644 index 00000000..0f6590f5 --- /dev/null +++ b/snippets/account-diagrams.jsx @@ -0,0 +1,341 @@ +// AddressDerivation — a steppable, animated walk through how one secp256k1 +// key pair yields both a bech32 (sei1…) and an EVM (0x…) address, and how +// association links the two into one account. It uses the same player as the +// Giga diagrams: it starts when it scrolls into view, loops until a reader +// pauses it, pauses while off screen, and does not autoplay under +// prefers-reduced-motion. +// +// Mintlify evaluates each export in isolation, and module-level declarations +// crash, so every constant lives inside the component. +// +// Usage in MDX: +// import { AddressDerivation } from '/snippets/account-diagrams.jsx'; +// +export const AddressDerivation = () => { + const ink = 'currentColor'; + const accent = 'var(--sei-maroon-50)'; + const gold = 'var(--sei-diagram-gold, var(--sei-gold-100))'; + const hairline = 'rgba(128, 128, 128, 0.25)'; + + const steps = [ + { + title: 'Start with one key pair', + text: "Your wallet holds a secp256k1 private key. Multiplying it by the curve's generator point gives your public key. This only works one way, so the public key never reveals the private key." + }, + { + title: 'Write the public key two ways', + text: 'The same public key has two standard encodings. The compressed form is 33 bytes and starts with 0x02 or 0x03. The uncompressed form is 65 bytes and starts with 0x04.' + }, + { + title: 'Derive the Sei address', + text: 'The Cosmos derivation hashes the compressed key with SHA-256 and then RIPEMD-160, which leaves a 20-byte digest. Bech32 encoding with the sei prefix turns that digest into your sei1… address.' + }, + { + title: 'Derive the EVM address', + text: 'The Ethereum derivation drops the 0x04 byte and hashes the remaining 64 bytes with Keccak-256. The last 20 bytes of that hash, written in hex, are your 0x… address.' + }, + { + title: 'Two addresses, two accounts for now', + text: "Both addresses come from the same key, but the chain can't connect them until it knows that key. Until then, each address is a separate account with its own balance." + }, + { + title: 'Associate them', + text: <>Your first signed transaction reveals your public key to the chain. Calling associate() or associatePubKey() on the addr precompile at 0x0000000000000000000000000000000000001004 does the same. The chain then derives both addresses itself and links them into one account with one balance. + } + ]; + const last = steps.length - 1; + + const rowY = { sei: 54, evm: 228 }; + const mid = 140; + const boxX = (i) => 170 + i * 120; + const boxW = 100; + const boxH = 44; + const pillX = 650; + const pillW = 96; + const acctX = 766; + const acctW = 100; + const rows = [ + { + key: 'sei', + at: 2, + color: accent, + address: 'sei1…', + title: 'bech32 address · Cosmos derivation', + boxes: [ + { label: 'compressed', sub: '33 bytes, 0x02 or 0x03' }, + { label: 'SHA-256', sub: '32-byte hash' }, + { label: 'RIPEMD-160', sub: '20-byte digest' }, + { label: 'bech32', sub: 'sei prefix' } + ] + }, + { + key: 'evm', + at: 3, + color: gold, + address: '0x…', + title: 'EVM address · Ethereum derivation', + boxes: [ + { label: 'uncompressed', sub: '65 bytes, 0x04' }, + { label: 'drop 0x04', sub: 'keeps 64 bytes' }, + { label: 'Keccak-256', sub: '32-byte hash' }, + { label: 'last 20 bytes', sub: 'of the hash' } + ] + } + ]; + + const [step, setStep] = useState(0); + const [playing, setPlaying] = useState(false); + const [reduced, setReduced] = useState(false); + const rootRef = useRef(null); + const playingRef = useRef(false); + const auto = useRef({ armed: true, resume: false }); + playingRef.current = playing; + + useEffect(() => { + if (typeof window === 'undefined' || !window.matchMedia) return undefined; + const query = window.matchMedia('(prefers-reduced-motion: reduce)'); + const update = () => setReduced(query.matches); + update(); + if (!query.addEventListener) return undefined; + query.addEventListener('change', update); + return () => query.removeEventListener('change', update); + }, []); + + useEffect(() => { + if (!playing) return undefined; + const timer = setTimeout(() => setStep(step >= last ? 0 : step + 1), step >= last ? 3000 : step === 0 ? 800 : 2000); + return () => clearTimeout(timer); + }, [playing, step]); + + useEffect(() => { + const node = rootRef.current; + if (!node || typeof IntersectionObserver === 'undefined') return undefined; + const observer = new IntersectionObserver( + (entries) => { + const entry = entries[entries.length - 1]; + if (entry.intersectionRatio >= 0.3) { + const reduceMotion = window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches; + if ((auto.current.armed && !reduceMotion) || auto.current.resume) setPlaying(true); + auto.current = { armed: false, resume: false }; + } else if (!entry.isIntersecting && playingRef.current) { + setPlaying(false); + auto.current = { armed: false, resume: true }; + } + }, + { threshold: [0, 0.35] } + ); + observer.observe(node); + return () => observer.disconnect(); + }, []); + + const go = (next) => { + auto.current = { armed: false, resume: false }; + setPlaying(false); + setStep(Math.max(0, Math.min(last, next))); + }; + const togglePlay = () => { + auto.current = { armed: false, resume: false }; + if (playing) { + setPlaying(false); + return; + } + setStep(step >= last ? 0 : step + 1); + setPlaying(true); + }; + + const ease = 'cubic-bezier(0.4, 0, 0.2, 1)'; + const shown = (visible, delay) => ({ opacity: visible ? 1 : 0, transition: reduced ? 'none' : `opacity 400ms ease ${visible ? delay || 0 : 0}ms` }); + const ghost = (pending, delay) => ({ opacity: pending ? 1 : 0, transition: reduced ? 'none' : `opacity 300ms ease ${pending ? 0 : delay || 0}ms` }); + const slideIn = (visible, delay) => ({ + opacity: visible ? 1 : 0, + transform: visible ? 'translate(0px, 0px)' : 'translate(-10px, 0px)', + transition: reduced ? 'none' : `transform 500ms ${ease} ${visible ? delay || 0 : 0}ms, opacity 350ms ease ${visible ? delay || 0 : 0}ms` + }); + const merged = step >= 5; + const account = (dy) => ({ + opacity: step === 4 ? 1 : 0, + transform: merged ? `translate(0px, ${dy}px)` : step === 4 ? 'translate(0px, 0px)' : 'translate(-10px, 0px)', + transition: reduced ? 'none' : `transform 500ms ${ease} ${merged ? 650 : 0}ms, opacity 350ms ease ${merged ? 800 : 0}ms` + }); + const dotOuter = { + transform: `translate(${merged ? 756 : 150}px, ${mid}px)`, + opacity: step === 5 ? 1 : 0, + transition: reduced ? 'none' : `transform ${merged ? 1000 : 0}ms linear, opacity 150ms ease` + }; + const dotInner = { opacity: merged ? 0 : 1, transition: reduced ? 'none' : `opacity 250ms ease ${merged ? 900 : 0}ms` }; + + const primaryButton = { + backgroundColor: 'var(--sei-maroon-100)', + color: '#ffffff', + fontFamily: 'var(--sei-font-mono)', + fontSize: '11px', + letterSpacing: '0.04em', + textTransform: 'uppercase', + padding: '6px 14px', + borderRadius: '6px', + minWidth: '76px', + cursor: 'pointer' + }; + const secondaryButton = (disabled) => ({ + backgroundColor: 'rgba(128, 128, 128, 0.14)', + fontFamily: 'var(--sei-font-mono)', + fontSize: '11px', + letterSpacing: '0.04em', + textTransform: 'uppercase', + padding: '6px 12px', + borderRadius: '6px', + opacity: disabled ? 0.4 : 1, + cursor: disabled ? 'default' : 'pointer' + }); + + return ( +
+
+
+ + + + + + + + + + + your wallet + on chain + + + private key + kept secret + + secp256k1 + one-way + + public key + safe to share + + = 1)}> + + + + + {rows.map((row) => { + const y = rowY[row.key]; + const active = step === row.at; + return ( + + = 1)}>{row.title} + {row.boxes.map((b, i) => { + const at = i === 0 ? 1 : row.at; + const delay = i === 0 ? 150 : i * 250; + const x = boxX(i); + return ( + + + = at, delay)}> + {i > 0 ? : null} + 0 ? row.color : ink} fillOpacity={active && i > 0 ? 0.1 : 0.05} stroke={active && i > 0 ? row.color : ink} strokeOpacity={active && i > 0 ? 1 : 0.4} style={{ transition: reduced ? 'none' : 'fill 500ms ease, stroke 500ms ease, fill-opacity 500ms ease, stroke-opacity 500ms ease' }} /> + {b.label} + {b.sub} + + + ); + })} + + = row.at, 1000)}> + + + {row.address} + + + ); + })} + + + + {rows.map((row) => { + const y = rowY[row.key]; + return ( + + + + + {row.address + ' account'} + separate balance + + + + ); + })} + not linked yet + + + one account + one shared balance + either address works + + + + + association: the chain learns your public key + + first signed transaction, or associate() or associatePubKey() + + + on the addr precompile at 0x0000000000000000000000000000000000001004 + + + + + + + + +
+ +
+
+
+ Step {step + 1} of {steps.length} +
+
{steps[step].title}
+

{steps[step].text}

+
+
+ + + +
+
+ +
+ {steps.map((item, i) => ( +
+
+
The bech32 and EVM addresses are two encodings of one public key, produced by different hash functions. The chain treats them as one account once association reveals that key.
+
+ ); +}; diff --git a/snippets/agentic-wallet-diagrams.jsx b/snippets/agentic-wallet-diagrams.jsx new file mode 100644 index 00000000..a27d1e6d --- /dev/null +++ b/snippets/agentic-wallet-diagrams.jsx @@ -0,0 +1,264 @@ +// AgenticWalletFlow — a steppable, animated walk through how an agentic +// wallet turns an LLM's decision into a signed Sei transaction, including a +// request the policy engine blocks. It uses the same player as the Giga +// diagrams: it starts when it scrolls into view, loops until a reader pauses +// it, pauses while off screen, and does not autoplay under +// prefers-reduced-motion. +// +// Mintlify evaluates each export in isolation, and module-level declarations +// crash, so every constant lives inside the component. +// +// Usage in MDX: +// import { AgenticWalletFlow } from '/snippets/agentic-wallet-diagrams.jsx'; +// +export const AgenticWalletFlow = () => { + const ink = 'currentColor'; + const accent = 'var(--sei-maroon-50)'; + const gold = 'var(--sei-diagram-gold, var(--sei-gold-100))'; + const ok = 'var(--sei-diagram-ok, #1a7a00)'; + const bad = 'var(--sei-diagram-error, #c20a00)'; + const hairline = 'rgba(128, 128, 128, 0.25)'; + + const steps = [ + { + title: 'The agent decides', + text: 'The LLM picks an onchain action, such as sending 5 USDC to a 0x address, and calls a wallet tool. It never sees a private key.' + }, + { + title: 'The SDK builds the transaction', + text: 'The wallet SDK turns the intent into an unsigned EVM transaction with the recipient, amount, gas, and chain ID, which is 1329 on Sei Mainnet.' + }, + { + title: 'The policy engine checks it', + text: 'Spending limits, address allowlists, and network rules run before anything is signed.' + }, + { + title: 'The TEE signs', + text: 'The private key stays inside a Trusted Execution Environment (TEE). The signer hands back only the signed transaction.' + }, + { + title: "Broadcast to Sei's EVM RPC", + text: "The signed transaction goes to Sei's EVM RPC like any other transaction." + }, + { + title: 'A request the policy blocks', + text: 'If the agent asks for more than its spending limit allows, the policy engine rejects the request. Nothing reaches the signer, so nothing is signed.' + } + ]; + const last = steps.length - 1; + + const stages = [ + { label: 'LLM / agent', sub: 'decides what to do' }, + { label: 'Wallet SDK', sub: 'builds the transaction' }, + { label: 'Policy engine', sub: 'checks the rules' }, + { label: 'TEE signer', sub: 'holds the key' }, + { label: 'Sei EVM RPC', sub: 'broadcasts it' } + ]; + const stageX = (i) => 30 + i * 172; + const stageW = 132; + const centerX = (i) => stageX(i) + stageW / 2; + const boxY = 74; + const boxH = 56; + const cardW = 112; + + const [step, setStep] = useState(0); + const [playing, setPlaying] = useState(false); + const [reduced, setReduced] = useState(false); + const rootRef = useRef(null); + const playingRef = useRef(false); + const auto = useRef({ armed: true, resume: false }); + playingRef.current = playing; + + useEffect(() => { + if (typeof window === 'undefined' || !window.matchMedia) return undefined; + const query = window.matchMedia('(prefers-reduced-motion: reduce)'); + const update = () => setReduced(query.matches); + update(); + if (!query.addEventListener) return undefined; + query.addEventListener('change', update); + return () => query.removeEventListener('change', update); + }, []); + + useEffect(() => { + if (!playing) return undefined; + const timer = setTimeout(() => setStep(step >= last ? 0 : step + 1), step >= last ? 3000 : step === 0 ? 800 : 2000); + return () => clearTimeout(timer); + }, [playing, step]); + + useEffect(() => { + const node = rootRef.current; + if (!node || typeof IntersectionObserver === 'undefined') return undefined; + const observer = new IntersectionObserver( + (entries) => { + const entry = entries[entries.length - 1]; + if (entry.intersectionRatio >= 0.3) { + const reduceMotion = window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches; + if ((auto.current.armed && !reduceMotion) || auto.current.resume) setPlaying(true); + auto.current = { armed: false, resume: false }; + } else if (!entry.isIntersecting && playingRef.current) { + setPlaying(false); + auto.current = { armed: false, resume: true }; + } + }, + { threshold: [0, 0.35] } + ); + observer.observe(node); + return () => observer.disconnect(); + }, []); + + const go = (next) => { + auto.current = { armed: false, resume: false }; + setPlaying(false); + setStep(Math.max(0, Math.min(last, next))); + }; + const togglePlay = () => { + auto.current = { armed: false, resume: false }; + if (playing) { + setPlaying(false); + return; + } + setStep(step >= last ? 0 : step + 1); + setPlaying(true); + }; + + const fade = reduced ? 'none' : 'opacity 400ms ease'; + const shown = (visible, delay) => ({ opacity: visible ? 1 : 0, transition: reduced ? 'none' : `opacity 400ms ease ${visible ? delay || 0 : 0}ms` }); + const flow = (active) => (playing && active ? 'on' : undefined); + const rejected = step === 5; + const at = rejected ? 2 : Math.min(step, 4); + const card = rejected + ? { label: 'send 5,000 USDC', color: bad } + : [ + { label: 'send 5 USDC', color: accent }, + { label: 'unsigned tx', color: accent }, + { label: 'unsigned tx', color: accent }, + { label: 'signed tx', color: gold }, + { label: 'signed tx', color: gold } + ][at]; + + const primaryButton = { + backgroundColor: 'var(--sei-maroon-100)', + color: '#ffffff', + fontFamily: 'var(--sei-font-mono)', + fontSize: '11px', + letterSpacing: '0.04em', + textTransform: 'uppercase', + padding: '6px 14px', + borderRadius: '6px', + minWidth: '76px', + cursor: 'pointer' + }; + const secondaryButton = (disabled) => ({ + backgroundColor: 'rgba(128, 128, 128, 0.14)', + fontFamily: 'var(--sei-font-mono)', + fontSize: '11px', + letterSpacing: '0.04em', + textTransform: 'uppercase', + padding: '6px 12px', + borderRadius: '6px', + opacity: disabled ? 0.4 : 1, + cursor: disabled ? 'default' : 'pointer' + }); + + return ( +
+
+
+ + + + + + + + {stages.map((s, i) => { + const current = i === at; + const skipped = rejected && i > 2; + return ( + + {i > 0 ? : null} + + {s.label} + {s.sub} + + ); + })} + + + + {card.label} + + + + = 2 && !rejected, 200)}> + ✓ spending limit + ✓ allowlist + ✓ network + + + ✕ over the spending limit + rejected before signing + + + + + + + = 3 && !rejected, 200)}> + + + + + key stays inside + + ✓ submitted + + the agent works through tools and never holds the private key + +
+ +
+
+
+ Step {step + 1} of {steps.length} +
+
{steps[step].title}
+

{steps[step].text}

+
+
+ + + +
+
+ +
+ {steps.map((item, i) => ( +
+
+
The general flow. Where the key lives depends on the provider. The comparison below shows how Coinbase AgentKit and Privy isolate keys on Sei.
+
+ ); +}; diff --git a/snippets/giga-autobahn-walkthrough.jsx b/snippets/giga-autobahn-walkthrough.jsx index 044697db..e9d570ed 100644 --- a/snippets/giga-autobahn-walkthrough.jsx +++ b/snippets/giga-autobahn-walkthrough.jsx @@ -35,7 +35,7 @@ export const GigaAutobahnWalkthrough = () => { }, { title: 'Prove availability', - text: 'Validators vote that they hold the car. At the availability threshold, f + 1 replicas in the whitepaper model and stake-weighted in the implementation, the car has a Proof of Availability (PoA) and becomes the tip of its lane.' + text: <>Validators vote that they hold the car. At the availability threshold, f + 1 replicas in the whitepaper model and stake-weighted in the implementation, the car has a Proof of Availability (PoA) and becomes the tip of its lane. }, { title: 'Commit a cut', @@ -68,6 +68,19 @@ export const GigaAutobahnWalkthrough = () => { const userSlot = mergeOrder.indexOf(userLane); const newCarX = (lane) => carX0 + oldCars[lane] * carStep; const rowX = (slot) => 690 + slot * 46; + const math = 'var(--sei-font-math)'; + const tex = (expr, size, rest) => { + const drop = size * 0.24; + let low = false; + const parts = expr.match(/_\{[^}]*\}|_[A-Za-z0-9]|[A-Za-z]+|[0-9.]+|[-+=]|[^\sA-Za-z0-9_.+=-]/g).map((tok, i) => { + const sub = tok[0] === '_'; + const body = sub ? tok.replace(/^_\{?|\}$/g, '') : /^[-+=]$/.test(tok) ? '\u2005' + tok.replace('-', '\u2212') + '\u2005' : tok; + const shift = sub ? drop : low ? -drop : undefined; + low = sub; + return {body}; + }); + return <>{parts}{rest ? {rest} : null}; + }; const [step, setStep] = useState(0); const [playing, setPlaying] = useState(false); @@ -209,7 +222,7 @@ export const GigaAutobahnWalkthrough = () => { {[0, 2, 3].map((lane) => ( ))} - votes from f + 1 replicas + votes from {tex('f + 1', 9.5)} replicas = 4)}> diff --git a/snippets/giga-diagrams.jsx b/snippets/giga-diagrams.jsx index 6f11ac2a..95b5ae9a 100644 --- a/snippets/giga-diagrams.jsx +++ b/snippets/giga-diagrams.jsx @@ -1,12 +1,32 @@ // Mintlify evaluates each export in isolation and cannot render one export from // inside another, so every animated diagram in this file carries its own // playback controls and scroll-triggered autoplay instead of sharing them. +// +// For the same reason, each diagram that shows math carries its own +// tex(expr, size, rest) helper. It sets SVG math the way LaTeX does, in the +// Sei Math (Computer Modern) font: single letters italic; digits, words, and +// operators upright; `_n` or `_{max}` lowered as a subscript. `rest` +// continues in the label font, back on the baseline. Step text uses the +// sei-math class from style.css instead. export const GigaProposerComparison = () => { const ink = 'currentColor'; const accent = 'var(--sei-maroon-50)'; const box = { fill: ink, fillOpacity: 0.05, stroke: ink, strokeOpacity: 0.35, strokeWidth: 1 }; const lanes = [0, 1, 2, 3]; + const math = 'var(--sei-font-math)'; + const tex = (expr, size, rest) => { + const drop = size * 0.24; + let low = false; + const parts = expr.match(/_\{[^}]*\}|_[A-Za-z0-9]|[A-Za-z]+|[0-9.]+|[-+=]|[^\sA-Za-z0-9_.+=-]/g).map((tok, i) => { + const sub = tok[0] === '_'; + const body = sub ? tok.replace(/^_\{?|\}$/g, '') : /^[-+=]$/.test(tok) ? '\u2005' + tok.replace('-', '\u2212') + '\u2005' : tok; + const shift = sub ? drop : low ? -drop : undefined; + low = sub; + return {body}; + }); + return <>{parts}{rest ? {rest} : null}; + }; return (
@@ -34,13 +54,13 @@ export const GigaProposerComparison = () => { votes - block h + block {tex('h', 11)} one block per round {[0, 1, 2].map((i) => ( - {['h-2', 'h-1', 'h'][i]} + {tex(['h-2', 'h-1', 'h'][i], 9.5)} ))} throughput capped by one leader's bandwidth @@ -86,33 +106,46 @@ export const GigaAsyncPipeline = () => { { y: 116, label: 'Execution' }, { y: 170, label: 'Attestation' } ]; + const math = 'var(--sei-font-math)'; + const tex = (expr, size, rest) => { + const drop = size * 0.24; + let low = false; + const parts = expr.match(/_\{[^}]*\}|_[A-Za-z0-9]|[A-Za-z]+|[0-9.]+|[-+=]|[^\sA-Za-z0-9_.+=-]/g).map((tok, i) => { + const sub = tok[0] === '_'; + const body = sub ? tok.replace(/^_\{?|\}$/g, '') : /^[-+=]$/.test(tok) ? '\u2005' + tok.replace('-', '\u2212') + '\u2005' : tok; + const shift = sub ? drop : low ? -drop : undefined; + low = sub; + return {body}; + }); + return <>{parts}{rest ? {rest} : null}; + }; const boxes = [ - { key: 'o0', y: 62, x: 126, w: 118, label: 'order n', kind: 'order', at: 0 }, - { key: 'o1', y: 62, x: 294, w: 118, label: 'order n+1', kind: 'order', at: 1 }, - { key: 'o2', y: 62, x: 462, w: 118, label: 'order n+2', kind: 'order', at: 2 }, - { key: 'o3', y: 62, x: 630, w: 118, label: 'order n+3', kind: 'order', at: 3 }, - { key: 'e0', y: 116, x: 294, w: 128, label: 'execute n', kind: 'execute', at: 1 }, - { key: 'e1', y: 116, x: 462, w: 128, label: 'execute n+1', kind: 'execute', at: 2 }, - { key: 'e2', y: 116, x: 630, w: 128, label: 'execute n+2', kind: 'execute', at: 3 }, - { key: 'a0', y: 170, x: 630, w: 186, label: 'attest n: 2/3 voting power signs D_n', kind: 'attest', at: 3 } + { key: 'o0', y: 62, x: 126, w: 118, label: <>order {tex('n', 10.5)}, kind: 'order', at: 0 }, + { key: 'o1', y: 62, x: 294, w: 118, label: <>order {tex('n+1', 10.5)}, kind: 'order', at: 1 }, + { key: 'o2', y: 62, x: 462, w: 118, label: <>order {tex('n+2', 10.5)}, kind: 'order', at: 2 }, + { key: 'o3', y: 62, x: 630, w: 118, label: <>order {tex('n+3', 10.5)}, kind: 'order', at: 3 }, + { key: 'e0', y: 116, x: 294, w: 128, label: <>execute {tex('n', 10.5)}, kind: 'execute', at: 1 }, + { key: 'e1', y: 116, x: 462, w: 128, label: <>execute {tex('n+1', 10.5)}, kind: 'execute', at: 2 }, + { key: 'e2', y: 116, x: 630, w: 128, label: <>execute {tex('n+2', 10.5)}, kind: 'execute', at: 3 }, + { key: 'a0', y: 170, x: 630, w: 186, label: <>attest {tex('n', 10.5)}: 2/3 voting power signs {tex('D_n', 10.5)}, kind: 'attest', at: 3 } ]; const steps = [ { - title: 'Order block n', - text: 'Consensus fixes the order of block n. This is ordering finality for n, the fast signal. Block n has not executed yet, so there is no receipt.' + title: 'Order a block', + text: <>Consensus fixes the order of block n. This is ordering finality for n, the fast signal. Block n has not executed yet, so there is no receipt. }, { - title: 'Execute n while ordering n+1', - text: 'Execution of block n starts once its order is final. Consensus does not wait for it and orders block n+1 at the same time.' + title: 'Execute it while ordering the next', + text: <>Execution of block n starts once its order is final. Consensus does not wait for it and orders block n + 1 at the same time. }, { title: 'Keep both stages busy', text: 'Each stage works on a different block. Ordering keeps moving ahead while execution follows behind it.' }, { - title: 'Attest block n', - text: "A bounded number of blocks later, validators with two-thirds of voting power sign block n's divergence digest D_n. This is state attestation finality for n." + title: 'Attest it later', + text: <>A bounded number of blocks later, validators with two-thirds of voting power sign block n's divergence digest Dn. This is state attestation finality for n. } ]; const last = steps.length - 1; @@ -242,12 +275,12 @@ export const GigaAsyncPipeline = () => { })} - ordering finality for n + ordering finality for {tex('n', 10)} = 3)}> - attestation for n lags by x blocks + attestation for {tex('n', 9.5)} lags by {tex('x', 9.5)} blocks - state attestation finality for n + state attestation finality for {tex('n', 10)} @@ -357,6 +390,19 @@ export const GigaLanesAndCuts = () => { const accent = 'var(--sei-maroon-50)'; const box = { fill: ink, fillOpacity: 0.05, stroke: ink, strokeOpacity: 0.35, strokeWidth: 1 }; const lanes = [0, 1, 2]; + const math = 'var(--sei-font-math)'; + const tex = (expr, size, rest) => { + const drop = size * 0.24; + let low = false; + const parts = expr.match(/_\{[^}]*\}|_[A-Za-z0-9]|[A-Za-z]+|[0-9.]+|[-+=]|[^\sA-Za-z0-9_.+=-]/g).map((tok, i) => { + const sub = tok[0] === '_'; + const body = sub ? tok.replace(/^_\{?|\}$/g, '') : /^[-+=]$/.test(tok) ? '\u2005' + tok.replace('-', '\u2212') + '\u2005' : tok; + const shift = sub ? drop : low ? -drop : undefined; + low = sub; + return {body}; + }); + return <>{parts}{rest ? {rest} : null}; + }; return (
@@ -390,7 +436,7 @@ export const GigaLanesAndCuts = () => { - paper: f + 1 replicas + paper: {tex('f + 1', 10.5)} replicas stake-weighted in implementation @@ -406,7 +452,7 @@ export const GigaLanesAndCuts = () => { off the critical path
-
Each validator will chain batches into its own lane. The whitepaper uses f + 1 replica votes for availability. The implementation applies stake-weighted thresholds.
+
Each validator will chain batches into its own lane. The whitepaper uses f + 1 replica votes for availability. The implementation applies stake-weighted thresholds.
); }; @@ -415,6 +461,19 @@ export const GigaSlotPipeline = () => { const ink = 'currentColor'; const accent = 'var(--sei-maroon-50)'; const slots = [0, 1, 2]; + const math = 'var(--sei-font-math)'; + const tex = (expr, size, rest) => { + const drop = size * 0.24; + let low = false; + const parts = expr.match(/_\{[^}]*\}|_[A-Za-z0-9]|[A-Za-z]+|[0-9.]+|[-+=]|[^\sA-Za-z0-9_.+=-]/g).map((tok, i) => { + const sub = tok[0] === '_'; + const body = sub ? tok.replace(/^_\{?|\}$/g, '') : /^[-+=]$/.test(tok) ? '\u2005' + tok.replace('-', '\u2212') + '\u2005' : tok; + const shift = sub ? drop : low ? -drop : undefined; + low = sub; + return {body}; + }); + return <>{parts}{rest ? {rest} : null}; + }; return (
@@ -429,7 +488,7 @@ export const GigaSlotPipeline = () => { const y = 46 + i * 50; return ( - slot s{i > 0 ? '+' + i : ''} + slot {tex(i > 0 ? 's+' + i : 's', 11)} Prepare (PrepareQC) @@ -438,7 +497,7 @@ export const GigaSlotPipeline = () => { ); })} - next slot starts once the Prepare message for s is seen + next slot starts once the Prepare message for {tex('s', 9.5)} is seen 1 round trip @@ -447,7 +506,7 @@ export const GigaSlotPipeline = () => { steady state: one cut per 1.5 round trips
-
Slots will overlap: replicas will begin slot s+1 as soon as they see the Prepare message for slot s. The target is an effective steady-state cadence of one committed cut per 1.5 network round trips, not per-transaction latency.
+
Slots will overlap: replicas will begin slot s + 1 as soon as they see the Prepare message for slot s. The target is an effective steady-state cadence of one committed cut per 1.5 network round trips, not per-transaction latency.
); }; @@ -464,20 +523,33 @@ export const GigaAttestationFlow = () => { { b: 'n+2', from: 2 }, { b: 'n+x', from: 4 } ]; + const math = 'var(--sei-font-math)'; + const tex = (expr, size, rest) => { + const drop = size * 0.24; + let low = false; + const parts = expr.match(/_\{[^}]*\}|_[A-Za-z0-9]|[A-Za-z]+|[0-9.]+|[-+=]|[^\sA-Za-z0-9_.+=-]/g).map((tok, i) => { + const sub = tok[0] === '_'; + const body = sub ? tok.replace(/^_\{?|\}$/g, '') : /^[-+=]$/.test(tok) ? '\u2005' + tok.replace('-', '\u2212') + '\u2005' : tok; + const shift = sub ? drop : low ? -drop : undefined; + low = sub; + return {body}; + }); + return <>{parts}{rest ? {rest} : null}; + }; const stages = [ - { x: 96, label: 'execute block n', sub: 'deterministic Apply', from: 1 }, + { x: 96, label: <>execute block {tex('n', 10.5)}, sub: 'deterministic Apply', from: 1 }, { x: 296, label: 'write log', sub: 'last write wins', from: 2 }, - { x: 496, label: 'd_n = LtHash(...)', sub: 'writes, receipts, gas', from: 3 } + { x: 496, label: tex('d_n = LtHash(...)', 10.5), sub: 'writes, receipts, gas', from: 3 } ]; const steps = [ { - title: 'Order block n', - text: 'Consensus fixes the position of block n. Its order is final, but nothing in it has executed yet.' + title: 'Order the block', + text: <>Consensus fixes the position of block n. Its order is final, but nothing in it has executed yet. }, { title: 'Execute it', - text: 'Every node applies block n to the same starting state. Execution is deterministic, so conforming nodes derive the same result without communicating. Ordering meanwhile moves on to block n+1.' + text: <>Every node applies block n to the same starting state. Execution is deterministic, so conforming nodes derive the same result without communicating. Ordering meanwhile moves on to block n + 1. }, { title: 'Resolve the write log', @@ -485,11 +557,11 @@ export const GigaAttestationFlow = () => { }, { title: 'Hash it into a digest', - text: 'A lattice hash, LtHash, combines those records into d_n. Validators sign a compact commitment to it, the digest D_n.' + text: <>A lattice hash, LtHash, combines those records into dn. Validators sign a compact commitment to it, the digest Dn. }, { title: 'Attest in a later block', - text: 'Once validators with two-thirds of voting power have signed D_n, a later block, n+x, includes the attestation. This is state attestation finality for block n.' + text: <>Once validators with two-thirds of voting power have signed Dn, a later block, n + x, includes the attestation. This is state attestation finality for block n. }, { title: 'Contain divergence', @@ -606,7 +678,7 @@ export const GigaAttestationFlow = () => { {blocks.map((blk, i) => (blk.from > 0 ? : null))} {stages.map((s) => ( - + ))} @@ -618,7 +690,7 @@ export const GigaAttestationFlow = () => { = blk.from, -16, 0)}> {i > 0 ? : null} - block {blk.b} + block {tex(blk.b, 11)} ); })} @@ -627,7 +699,7 @@ export const GigaAttestationFlow = () => { = 1, 0, -8)} /> {stages.map((s, i) => ( - = s.from, -12, 0)}> + = s.from, -12, 0)}> {i > 0 ? : null} {s.label} @@ -637,13 +709,13 @@ export const GigaAttestationFlow = () => { = 3, -12, 0, 250)}> - digest D_n + digest {tex('D_n', 10.5)} compact commitment 2/3 voting power, - included in block n+x + included in block {tex('n+x', 9.5)} = 5, 0, 10)}> @@ -946,6 +1018,19 @@ export const GigaStorageArchitecture = () => { const ink = 'currentColor'; const accent = 'var(--sei-maroon-50)'; const gold = 'var(--sei-diagram-gold, var(--sei-gold-100))'; + const math = 'var(--sei-font-math)'; + const tex = (expr, size, rest) => { + const drop = size * 0.24; + let low = false; + const parts = expr.match(/_\{[^}]*\}|_[A-Za-z0-9]|[A-Za-z]+|[0-9.]+|[-+=]|[^\sA-Za-z0-9_.+=-]/g).map((tok, i) => { + const sub = tok[0] === '_'; + const body = sub ? tok.replace(/^_\{?|\}$/g, '') : /^[-+=]$/.test(tok) ? '\u2005' + tok.replace('-', '\u2212') + '\u2005' : tok; + const shift = sub ? drop : low ? -drop : undefined; + low = sub; + return {body}; + }); + return <>{parts}{rest ? {rest} : null}; + }; return (
@@ -976,14 +1061,14 @@ export const GigaStorageArchitecture = () => { commitment path - write log of block n + write log of block {tex('n', 10.5)} - lattice hash d_n (LtHash) + lattice hash {tex('d_n', 10.5, ' (LtHash)')} incremental, order-independent - D_n attested by 2/3 voting power + {tex('D_n', 10.5, ' attested by 2/3 voting power')} disputes: compare chunk digests, bisect, replay one range @@ -999,6 +1084,19 @@ export const GigaBudWindow = () => { const accent = 'var(--sei-maroon-50)'; const gold = 'var(--sei-diagram-gold, var(--sei-gold-100))'; const leaves = ['(key a, value, n, prev)', '(key b, value, n, prev)', '(key c, value, n, prev)']; + const math = 'var(--sei-font-math)'; + const tex = (expr, size, rest) => { + const drop = size * 0.24; + let low = false; + const parts = expr.match(/_\{[^}]*\}|_[A-Za-z0-9]|[A-Za-z]+|[0-9.]+|[-+=]|[^\sA-Za-z0-9_.+=-]/g).map((tok, i) => { + const sub = tok[0] === '_'; + const body = sub ? tok.replace(/^_\{?|\}$/g, '') : /^[-+=]$/.test(tok) ? '\u2005' + tok.replace('-', '\u2212') + '\u2005' : tok; + const shift = sub ? drop : low ? -drop : undefined; + low = sub; + return {body}; + }); + return <>{parts}{rest ? {rest} : null}; + }; return (
@@ -1017,13 +1115,13 @@ export const GigaBudWindow = () => { ))} this block's writes, sorted by key - root U_n + root {tex('U_n', 10.5)} - attested with D_n + attested with {tex('D_n', 10)} same 2/3 voting-power schedule - proof = Merkle path to attested U_n; + proof = Merkle path to attested {tex('U_n', 9.5, ';')} two proofs bracket an unmodified span cost scales with the block's updates @@ -1035,9 +1133,14 @@ export const GigaBudWindow = () => { {[0, 1, 2, 3].map((i) => ( ))} - SuperBUD, e blocks + SuperBUD, {tex('e', 9)} blocks - guaranteed proof window: the last e^Lmax blocks (governance-set); older claims need archive nodes + + guaranteed proof window: the last {tex('e', 9.5)} + L + max + blocks (governance-set); older claims need archive nodes + touch transactions refresh a stale key's anchor; deletions leave tombstones for exclusion proofs
@@ -1307,6 +1410,19 @@ export const GigaFinalitySignals = () => { const accent = 'var(--sei-maroon-50)'; const gold = 'var(--sei-diagram-gold, var(--sei-gold-100))'; const hairline = 'rgba(128, 128, 128, 0.25)'; + const math = 'var(--sei-font-math)'; + const tex = (expr, size, rest) => { + const drop = size * 0.24; + let low = false; + const parts = expr.match(/_\{[^}]*\}|_[A-Za-z0-9]|[A-Za-z]+|[0-9.]+|[-+=]|[^\sA-Za-z0-9_.+=-]/g).map((tok, i) => { + const sub = tok[0] === '_'; + const body = sub ? tok.replace(/^_\{?|\}$/g, '') : /^[-+=]$/.test(tok) ? '\u2005' + tok.replace('-', '\u2212') + '\u2005' : tok; + const shift = sub ? drop : low ? -drop : undefined; + low = sub; + return {body}; + }); + return <>{parts}{rest ? {rest} : null}; + }; const facts = [ { x: 200, label: 'position fixed', color: accent, from: 0 }, { x: 376, label: 'result known', color: ink, from: 1 }, @@ -1461,7 +1577,7 @@ export const GigaFinalitySignals = () => { state attestation finality - 2/3 voting-power digest, x blocks later + 2/3 voting-power digest, {tex('x', 9.5)} blocks later = 3, -12, 0)}> diff --git a/snippets/interop-diagrams.jsx b/snippets/interop-diagrams.jsx new file mode 100644 index 00000000..eef32ca5 --- /dev/null +++ b/snippets/interop-diagrams.jsx @@ -0,0 +1,730 @@ +// Animated diagrams for EVM and CosmWasm interoperability: pointer contracts +// and precompiles. They use the same player as the Giga diagrams: each starts +// when it scrolls into view, loops until a reader pauses it, pauses while off +// screen, and does not autoplay under prefers-reduced-motion. +// +// Mintlify evaluates each export in isolation and cannot render one export +// from inside another, and module-level declarations crash, so every diagram +// carries its own constants, helpers, and playback controls. +// +// Usage in MDX: +// import { PointerContractsAccess, PointerContractsFlow, EvmCosmWasmInterop } from '/snippets/interop-diagrams.jsx'; + +export const PointerContractsAccess = () => { + const ink = 'currentColor'; + const accent = 'var(--sei-maroon-50)'; + const ok = 'var(--sei-diagram-ok, #1a7a00)'; + const bad = 'var(--sei-diagram-error, #c20a00)'; + const hairline = 'rgba(128, 128, 128, 0.25)'; + + const steps = [ + { + title: 'Two environments', + text: 'EVM contracts live in the 0x address space. CosmWasm contracts and native coins live in the sei1 address space. Most wallets support only one of them.' + }, + { + title: 'Each wallet reaches its own side', + text: 'An EVM wallet calls ERC-20 and ERC-721 contracts. A Sei native wallet uses CW-20 and CW-721 contracts and native coins.' + }, + { + title: 'Neither wallet can cross', + text: 'Without pointers, an EVM wallet cannot move a CW-20 token, and a Sei native wallet cannot move an ERC-20 token. The token standards and call formats differ.' + }, + { + title: 'An ERC pointer fronts a CosmWasm token', + text: 'An ERC-20 or ERC-721 pointer contract gives a CW token or native coin an EVM interface. EVM wallets call the pointer, and it forwards each call to the original.' + }, + { + title: 'A CW pointer fronts an ERC token', + text: 'A CW-20 or CW-721 pointer contract does the reverse for an ERC token. Sei native wallets call the pointer, and it forwards each call to the ERC contract.' + }, + { + title: 'Every wallet reaches every token', + text: "Both wallets now reach both tokens, and each token's state stays in its original contract. Pointer creation was retired in v6.8.0, so this applies to existing pointers only." + } + ]; + const last = steps.length - 1; + + const [step, setStep] = useState(0); + const [playing, setPlaying] = useState(false); + const [reduced, setReduced] = useState(false); + const rootRef = useRef(null); + const playingRef = useRef(false); + const auto = useRef({ armed: true, resume: false }); + playingRef.current = playing; + + useEffect(() => { + if (typeof window === 'undefined' || !window.matchMedia) return undefined; + const query = window.matchMedia('(prefers-reduced-motion: reduce)'); + const update = () => setReduced(query.matches); + update(); + if (!query.addEventListener) return undefined; + query.addEventListener('change', update); + return () => query.removeEventListener('change', update); + }, []); + + useEffect(() => { + if (!playing) return undefined; + const timer = setTimeout(() => setStep(step >= last ? 0 : step + 1), step >= last ? 3000 : step === 0 ? 800 : 2000); + return () => clearTimeout(timer); + }, [playing, step]); + + useEffect(() => { + const node = rootRef.current; + if (!node || typeof IntersectionObserver === 'undefined') return undefined; + const observer = new IntersectionObserver( + (entries) => { + const entry = entries[entries.length - 1]; + if (entry.intersectionRatio >= 0.3) { + const reduceMotion = window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches; + if ((auto.current.armed && !reduceMotion) || auto.current.resume) setPlaying(true); + auto.current = { armed: false, resume: false }; + } else if (!entry.isIntersecting && playingRef.current) { + setPlaying(false); + auto.current = { armed: false, resume: true }; + } + }, + { threshold: [0, 0.35] } + ); + observer.observe(node); + return () => observer.disconnect(); + }, []); + + const go = (next) => { + auto.current = { armed: false, resume: false }; + setPlaying(false); + setStep(Math.max(0, Math.min(last, next))); + }; + const togglePlay = () => { + auto.current = { armed: false, resume: false }; + if (playing) { + setPlaying(false); + return; + } + setStep(step >= last ? 0 : step + 1); + setPlaying(true); + }; + + const ease = 'cubic-bezier(0.4, 0, 0.2, 1)'; + const shown = (visible, delay) => ({ opacity: visible ? 1 : 0, transition: reduced ? 'none' : `opacity 400ms ease ${visible ? delay || 0 : 0}ms` }); + const ghost = (pending) => ({ opacity: pending ? 1 : 0, transition: reduced ? 'none' : 'opacity 300ms ease' }); + const slideIn = (visible, dx) => ({ + opacity: visible ? 1 : 0, + transform: visible ? 'translate(0px, 0px)' : `translate(${dx}px, 0px)`, + transition: reduced ? 'none' : `transform 500ms ${ease}, opacity 350ms ease` + }); + const flow = (active) => (playing && active ? 'on' : undefined); + const card = (x, y, w, label, sub, tone) => ( + <> + + {label} + {sub} + + ); + const blocked = (x, y) => ( + + + + + ); + + const primaryButton = { + backgroundColor: 'var(--sei-maroon-100)', + color: '#ffffff', + fontFamily: 'var(--sei-font-mono)', + fontSize: '11px', + letterSpacing: '0.04em', + textTransform: 'uppercase', + padding: '6px 14px', + borderRadius: '6px', + minWidth: '76px', + cursor: 'pointer' + }; + const secondaryButton = (disabled) => ({ + backgroundColor: 'rgba(128, 128, 128, 0.14)', + fontFamily: 'var(--sei-font-mono)', + fontSize: '11px', + letterSpacing: '0.04em', + textTransform: 'uppercase', + padding: '6px 12px', + borderRadius: '6px', + opacity: disabled ? 0.4 : 1, + cursor: disabled ? 'default' : 'pointer' + }); + + return ( +
+
+
+ + + + + + + + + + + + + EVM · 0x address space + CosmWasm · sei1 address space + + {card(34, 129, 108, 'EVM wallet', '0x address', ink)} + {card(738, 129, 108, 'Sei native wallet', 'sei1 address', ink)} + {card(256, 62, 156, 'ERC-20 / ERC-721', 'EVM token contract', ink)} + {card(468, 196, 156, 'CW-20 / CW-721', 'or a native coin', ink)} + + + + = 1)}> + + + + + + + {blocked(440, 143)} + no CW-20 or native coin calls + + + + {blocked(440, 167)} + no ERC-20 calls + + + = 3, -10)}>{card(256, 196, 156, 'ERC-20 / ERC-721 pointer', 'fronts a CW token or coin', accent)} + = 3, 250)}> + + + + + = 4, 10)}>{card(468, 62, 156, 'CW-20 / CW-721 pointer', 'fronts an ERC token', accent)} + = 4, 250)}> + + + + + = 5, 150)}> + ✓ every token + ✓ every token + + +
+ +
+
+
+ Step {step + 1} of {steps.length} +
+
{steps[step].title}
+

{steps[step].text}

+
+
+ + + +
+
+ +
+ {steps.map((item, i) => ( +
+
+
A pointer gives a token an interface in the other environment. It holds no balances of its own and forwards every call to the original token.
+
+ ); +}; + +export const PointerContractsFlow = () => { + const ink = 'currentColor'; + const accent = 'var(--sei-maroon-50)'; + const gold = 'var(--sei-diagram-gold, var(--sei-gold-100))'; + const ok = 'var(--sei-diagram-ok, #1a7a00)'; + const hairline = 'rgba(128, 128, 128, 0.25)'; + + const steps = [ + { + title: 'Call the pointer', + text: "An EVM wallet sends an ordinary ERC-20 call, such as transfer, to the pointer's 0x address. To the wallet, the pointer is just another ERC-20 token." + }, + { + title: 'Translate the call', + text: 'The pointer rewrites the call in the format of the token it fronts. For a CW-20 token, that is a CW-20 execute message. For a native coin, it is a bank send.' + }, + { + title: 'Cross through a precompile', + text: <>A pointer for a CW-20 token calls the CosmWasm precompile at 0x0000000000000000000000000000000000001002, which executes the CW-20 contract. A pointer for a native coin calls the Bank precompile at 0x0000000000000000000000000000000000001001. + }, + { + title: 'Update the state', + text: 'The CW-20 contract updates its balances, or the Bank Module moves the coin. The pointer keeps no balances of its own, so each token has one source of truth.' + } + ]; + const last = steps.length - 1; + + const lanes = [ + { key: 'cw20', y: 72, pointer: 'fronts a CW-20 token', becomes: 'becomes a CW-20 execute message', chip: '0x…1002', bridge: 'CosmWasm precompile', target: 'CW-20 contract', targetSub: 'holds the balances', result: '✓ balances updated' }, + { key: 'native', y: 200, pointer: 'fronts a native coin', becomes: 'becomes a bank send', chip: '0x…1001', bridge: 'Bank precompile', target: 'Bank Module', targetSub: 'holds native coins', result: '✓ coin sent' } + ]; + + const [step, setStep] = useState(0); + const [playing, setPlaying] = useState(false); + const [reduced, setReduced] = useState(false); + const rootRef = useRef(null); + const playingRef = useRef(false); + const auto = useRef({ armed: true, resume: false }); + playingRef.current = playing; + + useEffect(() => { + if (typeof window === 'undefined' || !window.matchMedia) return undefined; + const query = window.matchMedia('(prefers-reduced-motion: reduce)'); + const update = () => setReduced(query.matches); + update(); + if (!query.addEventListener) return undefined; + query.addEventListener('change', update); + return () => query.removeEventListener('change', update); + }, []); + + useEffect(() => { + if (!playing) return undefined; + const timer = setTimeout(() => setStep(step >= last ? 0 : step + 1), step >= last ? 3000 : step === 0 ? 800 : 2000); + return () => clearTimeout(timer); + }, [playing, step]); + + useEffect(() => { + const node = rootRef.current; + if (!node || typeof IntersectionObserver === 'undefined') return undefined; + const observer = new IntersectionObserver( + (entries) => { + const entry = entries[entries.length - 1]; + if (entry.intersectionRatio >= 0.3) { + const reduceMotion = window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches; + if ((auto.current.armed && !reduceMotion) || auto.current.resume) setPlaying(true); + auto.current = { armed: false, resume: false }; + } else if (!entry.isIntersecting && playingRef.current) { + setPlaying(false); + auto.current = { armed: false, resume: true }; + } + }, + { threshold: [0, 0.35] } + ); + observer.observe(node); + return () => observer.disconnect(); + }, []); + + const go = (next) => { + auto.current = { armed: false, resume: false }; + setPlaying(false); + setStep(Math.max(0, Math.min(last, next))); + }; + const togglePlay = () => { + auto.current = { armed: false, resume: false }; + if (playing) { + setPlaying(false); + return; + } + setStep(step >= last ? 0 : step + 1); + setPlaying(true); + }; + + const fade = reduced ? 'none' : 'opacity 400ms ease'; + const shown = (visible, delay) => ({ opacity: visible ? 1 : 0, transition: reduced ? 'none' : `opacity 400ms ease ${visible ? delay || 0 : 0}ms` }); + const dim = (reached) => ({ opacity: reached ? 1 : 0.35, transition: fade }); + const flow = (active) => (playing && active ? 'on' : undefined); + const glow = { transition: reduced ? 'none' : 'stroke 400ms ease, stroke-width 400ms ease, fill-opacity 400ms ease' }; + + const primaryButton = { + backgroundColor: 'var(--sei-maroon-100)', + color: '#ffffff', + fontFamily: 'var(--sei-font-mono)', + fontSize: '11px', + letterSpacing: '0.04em', + textTransform: 'uppercase', + padding: '6px 14px', + borderRadius: '6px', + minWidth: '76px', + cursor: 'pointer' + }; + const secondaryButton = (disabled) => ({ + backgroundColor: 'rgba(128, 128, 128, 0.14)', + fontFamily: 'var(--sei-font-mono)', + fontSize: '11px', + letterSpacing: '0.04em', + textTransform: 'uppercase', + padding: '6px 12px', + borderRadius: '6px', + opacity: disabled ? 0.4 : 1, + cursor: disabled ? 'default' : 'pointer' + }); + + return ( +
+
+
+ + + + + + + + + + + + + + + + EVM · 0x address space + CosmWasm · sei1 address space + + + EVM wallet + sends an ERC-20 call + transfer(to, amount) + + {lanes.map((lane, li) => { + const cy = lane.y + 26; + return ( + + + + + ERC-20 pointer + {lane.pointer} + = 1)}>{lane.becomes} + + = 2)}> + = 2)} data-sei-flow={flow(step === 2)} /> + {lane.bridge} + + {lane.chip} + = 2, 250)} data-sei-flow={flow(step === 2)} /> + = 3 ? ok : ink} fillOpacity={step >= 3 ? 0.12 : 0.05} stroke={step >= 3 ? ok : ink} strokeOpacity={step >= 3 ? 1 : 0.45} strokeWidth={step >= 3 ? 1.4 : 1} style={glow} /> + {lane.target} + {lane.targetSub} + + = 3, 200)}>{lane.result} + + ); + })} + +
+ +
+
+
+ Step {step + 1} of {steps.length} +
+
{steps[step].title}
+

{steps[step].text}

+
+
+ + + +
+
+ +
+ {steps.map((item, i) => ( +
+
+
Two paths through existing ERC-20 pointers: one for a CW-20 token and one for a native coin. Pointer creation was retired in v6.8.0, but existing pointers keep working.
+
+ ); +}; + +export const EvmCosmWasmInterop = () => { + const ink = 'currentColor'; + const accent = 'var(--sei-maroon-50)'; + const gold = 'var(--sei-diagram-gold, var(--sei-gold-100))'; + const hairline = 'rgba(128, 128, 128, 0.25)'; + + const steps = [ + { + title: 'Two virtual machines', + text: 'EVM contracts live in the 0x address space. CosmWasm contracts and native coins live in the sei1 address space.' + }, + { + title: 'Each wallet calls its own side', + text: 'An EVM wallet calls ERC tokens and EVM contracts directly. A Sei native wallet does the same with CW tokens, native coins, and CosmWasm contracts.' + }, + { + title: 'Pointers bridge tokens', + text: 'An ERC pointer gives a CW token or native coin an EVM interface. A CW pointer gives an ERC token a CosmWasm interface. Each wallet can now use tokens from both sides.' + }, + { + title: 'A precompile bridges contract calls', + text: <>EVM callers reach CosmWasm through the CosmWasm precompile at 0x0000000000000000000000000000000000001002. A wallet or an EVM contract can execute or query a CosmWasm contract this way. + }, + { + title: 'CosmWasm calls back into the EVM', + text: 'A CosmWasm contract can dispatch an EVM message to call an EVM contract. Calls now flow in both directions.' + } + ]; + const last = steps.length - 1; + + const evmX = 226; + const cwX = 490; + const colW = 164; + const rowY = [56, 150, 244]; + + const [step, setStep] = useState(0); + const [playing, setPlaying] = useState(false); + const [reduced, setReduced] = useState(false); + const rootRef = useRef(null); + const playingRef = useRef(false); + const auto = useRef({ armed: true, resume: false }); + playingRef.current = playing; + + useEffect(() => { + if (typeof window === 'undefined' || !window.matchMedia) return undefined; + const query = window.matchMedia('(prefers-reduced-motion: reduce)'); + const update = () => setReduced(query.matches); + update(); + if (!query.addEventListener) return undefined; + query.addEventListener('change', update); + return () => query.removeEventListener('change', update); + }, []); + + useEffect(() => { + if (!playing) return undefined; + const timer = setTimeout(() => setStep(step >= last ? 0 : step + 1), step >= last ? 3000 : step === 0 ? 800 : 2000); + return () => clearTimeout(timer); + }, [playing, step]); + + useEffect(() => { + const node = rootRef.current; + if (!node || typeof IntersectionObserver === 'undefined') return undefined; + const observer = new IntersectionObserver( + (entries) => { + const entry = entries[entries.length - 1]; + if (entry.intersectionRatio >= 0.3) { + const reduceMotion = window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches; + if ((auto.current.armed && !reduceMotion) || auto.current.resume) setPlaying(true); + auto.current = { armed: false, resume: false }; + } else if (!entry.isIntersecting && playingRef.current) { + setPlaying(false); + auto.current = { armed: false, resume: true }; + } + }, + { threshold: [0, 0.35] } + ); + observer.observe(node); + return () => observer.disconnect(); + }, []); + + const go = (next) => { + auto.current = { armed: false, resume: false }; + setPlaying(false); + setStep(Math.max(0, Math.min(last, next))); + }; + const togglePlay = () => { + auto.current = { armed: false, resume: false }; + if (playing) { + setPlaying(false); + return; + } + setStep(step >= last ? 0 : step + 1); + setPlaying(true); + }; + + const ease = 'cubic-bezier(0.4, 0, 0.2, 1)'; + const shown = (visible, delay) => ({ opacity: visible ? 1 : 0, transition: reduced ? 'none' : `opacity 400ms ease ${visible ? delay || 0 : 0}ms` }); + const ghost = (pending) => ({ opacity: pending ? 1 : 0, transition: reduced ? 'none' : 'opacity 300ms ease' }); + const slideIn = (visible, dx) => ({ + opacity: visible ? 1 : 0, + transform: visible ? 'translate(0px, 0px)' : `translate(${dx}px, 0px)`, + transition: reduced ? 'none' : `transform 500ms ${ease}, opacity 350ms ease` + }); + const flow = (active) => (playing && active ? 'on' : undefined); + const card = (x, y, label, sub, tone) => ( + <> + + {label} + {sub} + + ); + + const primaryButton = { + backgroundColor: 'var(--sei-maroon-100)', + color: '#ffffff', + fontFamily: 'var(--sei-font-mono)', + fontSize: '11px', + letterSpacing: '0.04em', + textTransform: 'uppercase', + padding: '6px 14px', + borderRadius: '6px', + minWidth: '76px', + cursor: 'pointer' + }; + const secondaryButton = (disabled) => ({ + backgroundColor: 'rgba(128, 128, 128, 0.14)', + fontFamily: 'var(--sei-font-mono)', + fontSize: '11px', + letterSpacing: '0.04em', + textTransform: 'uppercase', + padding: '6px 12px', + borderRadius: '6px', + opacity: disabled ? 0.4 : 1, + cursor: disabled ? 'default' : 'pointer' + }); + + return ( +
+
+
+ + + + + + + + + + + + + + + + EVM · 0x address space + CosmWasm · sei1 address space + + + EVM wallet + 0x address + + Sei native wallet + sei1 address + + {card(evmX, rowY[0], 'ERC-20 / ERC-721', 'token contract', ink)} + {card(evmX, rowY[2], 'EVM contract', 'any Solidity contract', ink)} + {card(cwX, rowY[1], 'CW-20 / CW-721', 'or a native coin', ink)} + {card(cwX, rowY[2], 'CosmWasm contract', 'already deployed', ink)} + + + + = 1)}> + + + + + + + = 2, -10)}>{card(evmX, rowY[1], 'ERC-20 / ERC-721 pointer', 'fronts a CW token or coin', accent)} + = 2, 10)}>{card(cwX, rowY[0], 'CW-20 / CW-721 pointer', 'fronts an ERC token', accent)} + = 2, 250)}> + + + + + + + = 3)}> + + via precompile + + via precompile + + = 4)}> + + dispatch EVM message + + +
+ +
+
+
+ Step {step + 1} of {steps.length} +
+
{steps[step].title}
+

{steps[step].text}

+
+
+ + + +
+
+ +
+ {steps.map((item, i) => ( +
+
+
This applies to CosmWasm contracts that are already deployed. Build new contracts directly on the EVM.
+
+ ); +}; diff --git a/snippets/nonce-lane-diagrams.jsx b/snippets/nonce-lane-diagrams.jsx index c4cfda71..a43c2591 100644 --- a/snippets/nonce-lane-diagrams.jsx +++ b/snippets/nonce-lane-diagrams.jsx @@ -1,55 +1,234 @@ +// Mintlify evaluates each export in isolation and cannot render one export from +// inside another, so every animated diagram in this file carries its own +// playback controls and scroll-triggered autoplay instead of sharing them. +// NonceLaneBundleLifecycle also carries the tex() math helper described in +// giga-diagrams.jsx. + export const SequentialNonceQueue = () => { const ink = 'currentColor'; + const accent = 'var(--sei-maroon-50)'; const ok = 'var(--sei-diagram-ok, #1a7a00)'; const bad = 'var(--sei-diagram-error, #c20a00)'; const warn = 'var(--sei-diagram-warning, #b45309)'; - const nonces = [ - { n: 5, s: 'landed', c: ok }, - { n: 6, s: 'dropped, never landed', c: bad }, - { n: 7, s: 'stranded', c: warn }, - { n: 8, s: 'stranded', c: warn } + const hairline = 'rgba(128, 128, 128, 0.25)'; + + const steps = [ + { + title: 'Send in nonce order', + text: 'One account signs nonces 5 through 8 and broadcasts them in order. Nonce 5 lands.' + }, + { + title: 'One transaction never lands', + text: 'Nonce 6 is dropped. It might have been underpriced, rejected at admission, lost before broadcast, or stranded by a process crash.' + }, + { + title: 'Everything behind it waits', + text: 'Nonces 7 and 8 are signed and valid, but nothing at or above 7 can execute until 6 is filled or replaced.' + }, + { + title: 'Sei rejects instead of queueing', + text: 'On Sei under Giga, the producer mempool rejects 7 and 8 with a bad nonce error instead of queueing them. The stall is the same.' + }, + { + title: 'The usual workaround: more hot wallets', + text: 'Splitting work across hot wallets buys width. Each wallet then needs its own balance, its own approvals, and a key that can move funds.' + } ]; - return ( -
-
- - - - - - + const last = steps.length - 1; + + const [step, setStep] = useState(0); + const [playing, setPlaying] = useState(false); + const [reduced, setReduced] = useState(false); + const rootRef = useRef(null); + const playingRef = useRef(false); + const auto = useRef({ armed: true, resume: false }); + playingRef.current = playing; + + useEffect(() => { + if (typeof window === 'undefined' || !window.matchMedia) return undefined; + const query = window.matchMedia('(prefers-reduced-motion: reduce)'); + const update = () => setReduced(query.matches); + update(); + if (!query.addEventListener) return undefined; + query.addEventListener('change', update); + return () => query.removeEventListener('change', update); + }, []); + + useEffect(() => { + if (!playing) return undefined; + const timer = setTimeout(() => setStep(step >= last ? 0 : step + 1), step >= last ? 3000 : step === 0 ? 800 : 2000); + return () => clearTimeout(timer); + }, [playing, step]); + + useEffect(() => { + const node = rootRef.current; + if (!node || typeof IntersectionObserver === 'undefined') return undefined; + const observer = new IntersectionObserver( + (entries) => { + const entry = entries[entries.length - 1]; + if (entry.intersectionRatio >= 0.3) { + const reduceMotion = window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches; + if ((auto.current.armed && !reduceMotion) || auto.current.resume) setPlaying(true); + auto.current = { armed: false, resume: false }; + } else if (!entry.isIntersecting && playingRef.current) { + setPlaying(false); + auto.current = { armed: false, resume: true }; + } + }, + { threshold: [0, 0.35] } + ); + observer.observe(node); + return () => observer.disconnect(); + }, []); + + const go = (next) => { + auto.current = { armed: false, resume: false }; + setPlaying(false); + setStep(Math.max(0, Math.min(last, next))); + }; + const togglePlay = () => { + auto.current = { armed: false, resume: false }; + if (playing) { + setPlaying(false); + return; + } + setStep(step >= last ? 0 : step + 1); + setPlaying(true); + }; - One account, one queue - {nonces.map((it, i) => { - const x = 40 + i * 190; - return ( - - - nonce {it.n} - {it.s} - {i < nonces.length - 1 ? : null} - - ); - })} - nonces 7 and 8 are signed and valid, but nothing at or above 7 can execute until 6 is filled or replaced - on Sei under Giga the producer mempool rejects 7 and 8 with a bad nonce error rather than queueing them: the same stall + const ease = 'cubic-bezier(0.4, 0, 0.2, 1)'; + const paint = reduced ? 'none' : 'fill 400ms ease, stroke 400ms ease, fill-opacity 400ms ease, stroke-opacity 400ms ease'; + const shown = (visible, delay) => ({ opacity: visible ? 1 : 0, transition: reduced ? 'none' : `opacity 400ms ease ${visible ? delay || 0 : 0}ms` }); + const slideIn = (visible, delay) => ({ + opacity: visible ? 1 : 0, + transform: visible ? 'translate(0px, 0px)' : 'translate(0px, 8px)', + transition: reduced ? 'none' : `transform 500ms ${ease} ${visible ? delay : 0}ms, opacity 350ms ease ${visible ? delay : 0}ms` + }); + const nonce = (i) => { + if (i === 0) return { c: ok, s: 'landed', dashed: false }; + if (i === 1) return step >= 1 ? { c: bad, s: 'dropped, never landed', dashed: true } : { c: ink, s: 'in flight', dashed: false }; + if (step >= 3) return { c: warn, s: 'rejected: bad nonce', dashed: false }; + return step >= 2 ? { c: warn, s: 'stranded', dashed: false } : { c: ink, s: 'in flight', dashed: false }; + }; - + const primaryButton = { + backgroundColor: 'var(--sei-maroon-100)', + color: '#ffffff', + fontFamily: 'var(--sei-font-mono)', + fontSize: '11px', + letterSpacing: '0.04em', + textTransform: 'uppercase', + padding: '6px 14px', + borderRadius: '6px', + minWidth: '76px', + cursor: 'pointer' + }; + const secondaryButton = (disabled) => ({ + backgroundColor: 'rgba(128, 128, 128, 0.14)', + fontFamily: 'var(--sei-font-mono)', + fontSize: '11px', + letterSpacing: '0.04em', + textTransform: 'uppercase', + padding: '6px 12px', + borderRadius: '6px', + opacity: disabled ? 0.4 : 1, + cursor: disabled ? 'default' : 'pointer' + }); - The usual workaround: more hot wallets - {['A', 'B', 'C', 'N'].map((w, i) => { - const x = 40 + i * 190; - return ( - - - hot wallet {w} - own balance, own approvals - own key that can move funds - - ); - })} - throughput scales with wallets, and so do fragmented balances, duplicated approvals, and keys that hold funds - + return ( +
+
+
+ + + + + + + + One account, one queue + {[5, 6, 7, 8].map((n, i) => { + const x = 40 + i * 190; + const it = nonce(i); + return ( + + = 1 ? 'translate(0px, 6px)' : 'translate(0px, 0px)', transition: reduced ? 'none' : `transform 500ms ${ease}` }}> + + nonce {n} + {it.s} + + {i < 3 ? : null} + + ); + })} + = 2)}> + + + + = 2)}>nonces 7 and 8 are signed and valid, but nothing at or above 7 can execute until 6 is filled or replaced + = 3)}>on Sei under Giga the producer mempool rejects 7 and 8 with a bad nonce error rather than queueing them: the same stall + + + + = 4)}>The usual workaround: more hot wallets + {['A', 'B', 'C', 'N'].map((w, i) => { + const x = 40 + i * 190; + return ( + + + = 4, i * 150)}> + + hot wallet {w} + own balance, own approvals + own key that can move funds + + + ); + })} + = 4, 600)}>throughput scales with wallets, and so do fragmented balances, duplicated approvals, and keys that hold funds + +
+ +
+
+
+ Step {step + 1} of {steps.length} +
+
{steps[step].title}
+

{steps[step].text}

+
+
+ + + +
+
+ +
+ {steps.map((item, i) => ( +
A transaction that lands and reverts consumes its nonce and blocks nothing. A transaction that never lands leaves a gap, and every later nonce waits behind it. On Sei, a pending-nonce read comes from the mempool rather than aliasing latest. It is too unreliable to rebuild an in-flight queue from. Splitting funds across hot wallets buys width at the cost of custody surface.
@@ -59,6 +238,7 @@ export const SequentialNonceQueue = () => { export const NonceLanes = () => { const ink = 'currentColor'; const accent = 'var(--sei-maroon-50)'; + const math = 'var(--sei-font-math)'; const ok = 'var(--sei-diagram-ok, #1a7a00)'; const bad = 'var(--sei-diagram-error, #c20a00)'; const chip = (x, y, label, state, key) => { @@ -86,7 +266,12 @@ export const NonceLanes = () => { bit 0 uint192 key: the lane - any value from 1 to 2^192 - 1, chosen by the caller + + any value from 1 to 2 + 192 + {'\u2005\u2212\u20051'} + , chosen by the caller + uint64 sequence kept by the EntryPoint per lane @@ -259,61 +444,267 @@ export const NonceLaneBundleLifecycle = () => { const ok = 'var(--sei-diagram-ok, #1a7a00)'; const warn = 'var(--sei-diagram-warning, #b45309)'; const bad = 'var(--sei-diagram-error, #c20a00)'; - const steps = [ + const hairline = 'rgba(128, 128, 128, 0.25)'; + const math = 'var(--sei-font-math)'; + const tex = (expr, size, rest) => { + const drop = size * 0.24; + let low = false; + const parts = expr.match(/_\{[^}]*\}|_[A-Za-z0-9]|[A-Za-z]+|[0-9.]+|[-+=]|[^\sA-Za-z0-9_.+=-]/g).map((tok, i) => { + const sub = tok[0] === '_'; + const body = sub ? tok.replace(/^_\{?|\}$/g, '') : /^[-+=]$/.test(tok) ? '\u2005' + tok.replace('-', '\u2212') + '\u2005' : tok; + const shift = sub ? drop : low ? -drop : undefined; + low = sub; + return {body}; + }); + return <>{parts}{rest ? {rest} : null}; + }; + + const stages = [ { t: 'take bundle', s: 'from the queue' }, { t: 'simulate', s: 'eth_estimateGas' }, - { t: 'sign at nonce n', s: 'EIP-1559 outer tx' }, + { t: <>sign at nonce {tex('n', 11)}, s: 'EIP-1559 outer tx' }, { t: 'journal', s: 'bytes hit disk first' }, { t: 'broadcast', s: 'sendRawTransaction' }, { t: 'wait for receipt', s: 'poll until the timeout' }, - { t: 'settle lanes', s: 'then nonce n + 1' } + { t: 'settle lanes', s: <>then nonce {tex('n+1', 8.5)} } ]; + const steps = [ + { + title: 'Take a bundle', + text: <>The relayer's worker takes up to MAX_OPS_PER_BUNDLE signed operations from the queue, never two from the same lane. + }, + { + title: 'Simulate before spending gas', + text: <>The worker runs the bundle through eth_estimateGas first. If simulation fails, nothing is broadcast, no lane sequence is consumed, and the relayer nonce is not spent. + }, + { + title: 'Sign at the relayer nonce', + text: <>The worker signs one EIP-1559 outer transaction that calls EntryPoint.handleOps, at the relayer's current nonce n. + }, + { + title: 'Journal before broadcast', + text: 'The signed bytes are written to the journal and fsynced before they reach the network, so a crash between signing and sending cannot lose or duplicate work.' + }, + { + title: 'Broadcast and wait', + text: <>The worker broadcasts the raw transaction and polls for a receipt until BUNDLE_RECEIPT_TIMEOUT_MS runs out. + }, + { + title: 'Replace at the same nonce', + text: <>With no receipt before the timeout, the worker checks earlier attempts, bumps fees by REPLACEMENT_FEE_BUMP_PERCENT, and signs a replacement at the same nonce n. It tries up to BUNDLE_MAX_ATTEMPTS times. + }, + { + title: 'Settle, then move on', + text: <>Once a receipt lands, the worker settles each lane. Only then does it use nonce n + 1, so it never leaves a gap behind a transaction that might still land. + } + ]; + const last = steps.length - 1; + + const stageX = (i) => 30 + i * 124; + const stageW = 112; + const cardW = 104; + + const [step, setStep] = useState(0); + const [playing, setPlaying] = useState(false); + const [reduced, setReduced] = useState(false); + const rootRef = useRef(null); + const playingRef = useRef(false); + const auto = useRef({ armed: true, resume: false }); + playingRef.current = playing; + + useEffect(() => { + if (typeof window === 'undefined' || !window.matchMedia) return undefined; + const query = window.matchMedia('(prefers-reduced-motion: reduce)'); + const update = () => setReduced(query.matches); + update(); + if (!query.addEventListener) return undefined; + query.addEventListener('change', update); + return () => query.removeEventListener('change', update); + }, []); + + useEffect(() => { + if (!playing) return undefined; + const timer = setTimeout(() => setStep(step >= last ? 0 : step + 1), step >= last ? 3000 : step === 0 ? 800 : 2000); + return () => clearTimeout(timer); + }, [playing, step]); + + useEffect(() => { + const node = rootRef.current; + if (!node || typeof IntersectionObserver === 'undefined') return undefined; + const observer = new IntersectionObserver( + (entries) => { + const entry = entries[entries.length - 1]; + if (entry.intersectionRatio >= 0.3) { + const reduceMotion = window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches; + if ((auto.current.armed && !reduceMotion) || auto.current.resume) setPlaying(true); + auto.current = { armed: false, resume: false }; + } else if (!entry.isIntersecting && playingRef.current) { + setPlaying(false); + auto.current = { armed: false, resume: true }; + } + }, + { threshold: [0, 0.35] } + ); + observer.observe(node); + return () => observer.disconnect(); + }, []); + + const go = (next) => { + auto.current = { armed: false, resume: false }; + setPlaying(false); + setStep(Math.max(0, Math.min(last, next))); + }; + const togglePlay = () => { + auto.current = { armed: false, resume: false }; + if (playing) { + setPlaying(false); + return; + } + setStep(step >= last ? 0 : step + 1); + setPlaying(true); + }; + + const paint = reduced ? 'none' : 'fill 400ms ease, stroke 400ms ease, fill-opacity 400ms ease, stroke-opacity 400ms ease'; + const branch = (from, active) => ({ opacity: step < from ? 0 : active ? 1 : 0.45, transition: reduced ? 'none' : 'opacity 400ms ease' }); + const replacing = step === 5; + const at = [0, 1, 2, 3, 5, 2, 6][step]; + const lit = (i) => (step === 4 ? i === 4 || i === 5 : i === at); + const tone = replacing ? warn : step === last ? ok : accent; + const card = [ + <>bundle, + <>bundle, + <>tx at {tex('n', 9.5)}, + <>tx at {tex('n', 9.5)}, + <>tx at {tex('n', 9.5)}, + <>replacement at {tex('n', 9.5)}, + <>settled ✓ + ][step]; + + const primaryButton = { + backgroundColor: 'var(--sei-maroon-100)', + color: '#ffffff', + fontFamily: 'var(--sei-font-mono)', + fontSize: '11px', + letterSpacing: '0.04em', + textTransform: 'uppercase', + padding: '6px 14px', + borderRadius: '6px', + minWidth: '76px', + cursor: 'pointer' + }; + const secondaryButton = (disabled) => ({ + backgroundColor: 'rgba(128, 128, 128, 0.14)', + fontFamily: 'var(--sei-font-mono)', + fontSize: '11px', + letterSpacing: '0.04em', + textTransform: 'uppercase', + padding: '6px 12px', + borderRadius: '6px', + opacity: disabled ? 0.4 : 1, + cursor: disabled ? 'default' : 'pointer' + }); + return ( -
-
- - - - - - - - - - - - +
+
+
+ + + + + + + + + + + + + + {stages.map((st, i) => { + const x = stageX(i); + const on = lit(i); + const color = on ? tone : ink; + return ( + + + {st.t} + {st.s} + {i < stages.length - 1 ? : null} + + ); + })} + + + + {card} + + - One relayer worker, one bundle at a time - {steps.map((st, i) => { - const x = 30 + i * 124; - const last = i === steps.length - 1; - return ( - - - {st.t} - {st.s} - {i < steps.length - 1 ? : null} - - ); - })} + + + + simulation fails (AA24, AA25, prefund, AA95) + nothing is broadcast, no lane sequence is consumed, + and the relayer nonce is not spent + - - - simulation fails (AA24, AA25, prefund, AA95) - nothing is broadcast, no lane sequence is consumed, - and the relayer nonce is not spent - - - - no receipt before the timeout - check every earlier attempt for a receipt, bump fees by REPLACEMENT_FEE_BUMP_PERCENT, - sign a replacement at the same nonce n, journal it, rebroadcast (up to BUNDLE_MAX_ATTEMPTS) - - - the worker never sends nonce n + 1 while a transaction at n might still land - on restart, the last exact raw transaction is rebroadcast first, then reconciled against lane sequences and the relayer's confirmed nonce - + + + + no receipt before the timeout + check every earlier attempt for a receipt, bump fees by REPLACEMENT_FEE_BUMP_PERCENT, + sign a replacement at the same nonce {tex('n', 9.5)}, journal it, rebroadcast (up to BUNDLE_MAX_ATTEMPTS) + + + + = last ? 1 : 0.35, transition: reduced ? 'none' : 'opacity 400ms ease' }}> + the worker never sends nonce {tex('n+1', 10.5)} while a transaction at {tex('n', 10.5)} might still land + + on restart, the last exact raw transaction is rebroadcast first, then reconciled against lane sequences and the relayer's confirmed nonce + +
+ +
+
+
+ Step {step + 1} of {steps.length} +
+
{steps[step].title}
+

{steps[step].text}

+
+
+ + + +
+
+ +
+ {steps.map((item, i) => ( +
Write-ahead ordering is deliberate. The signed outer transaction is journaled before it reaches the network, so a crash between signing and broadcast cannot lose or duplicate work. Replacement always reuses the relayer nonce, which is why a stuck bundle cannot create a nonce gap.
diff --git a/style.css b/style.css index 130f8ccb..11d15944 100644 --- a/style.css +++ b/style.css @@ -98,6 +98,26 @@ font-display: swap; } +/* Sei Math — LaTeX (Computer Modern) faces for math in diagram snippets. + KaTeX's MIT-licensed fonts, self-hosted in assets/fonts so diagrams don't + depend on Mintlify's KaTeX CDN. As in LaTeX, variables take the italic face + and digits and operators stay upright. */ +@font-face { + font-family: "Sei Math"; + src: url("/assets/fonts/KaTeX_Main-Regular.woff2") format("woff2"); + font-weight: 400; + font-style: normal; + font-display: swap; +} + +@font-face { + font-family: "Sei Math"; + src: url("/assets/fonts/KaTeX_Math-Italic.woff2") format("woff2"); + font-weight: 400; + font-style: italic; + font-display: swap; +} + /* -------------------------------------------------------------------------- Design tokens -------------------------------------------------------------------------- */ @@ -149,6 +169,9 @@ --sei-font-mono: "ABC Repro Mono", "SF Mono", Monaco, "Cascadia Mono", "Roboto Mono", Menlo, Courier, monospace; + --sei-font-math: + "Sei Math", KaTeX_Main, "Latin Modern Math", "STIX Two Math", "Cambria Math", + "Times New Roman", serif; /* Radii (sharp Sei aesthetic) */ --sei-radius-sm: 2px; @@ -256,6 +279,50 @@ h2, color: var(--sei-gold-25); } +/* -------------------------------------------------------------------------- + Inline math in snippet copy — use with `className="sei-math"` + Dn, or + n for a lone variable. Sized up like KaTeX + so Computer Modern's smaller x-height matches the surrounding text. + -------------------------------------------------------------------------- */ + +.sei-math { + font-family: var(--sei-font-math); + font-size: 1.2em; + font-style: normal; + font-weight: 400; + line-height: 1; + white-space: nowrap; +} + +.sei-math var, +var.sei-math { + font-style: italic; +} + +/* -------------------------------------------------------------------------- + Diagram flow — marching dashes along the active path of an animated + diagram. Set data-sei-flow="on" on an SVG line or path only while the + diagram is playing, so Pause stops every moving part. + -------------------------------------------------------------------------- */ + +[data-sei-flow="on"] { + stroke-dasharray: 5 4; + animation: sei-flow 900ms linear infinite; +} + +@keyframes sei-flow { + to { + stroke-dashoffset: -18; + } +} + +@media (prefers-reduced-motion: reduce) { + [data-sei-flow="on"] { + animation: none; + } +} + /* -------------------------------------------------------------------------- CARDS — sharp corners, maroon hover Mintlify renders as `.card` (div or a). The icon is a CSS-mask svg