diff --git a/STYLE_GUIDE.md b/STYLE_GUIDE.md index c6788c6..8de46a6 100644 --- a/STYLE_GUIDE.md +++ b/STYLE_GUIDE.md @@ -72,7 +72,7 @@ The Sei Giga tab comes right after the EVM tab. It covers Sei's next-generation - **Overview**: What Sei Giga is, what is live today, the developer guide, the technical specification, and what Giga changes for node operators - **Giga Testnet**: How to connect to `giga-testnet-1`, how it differs from Sei Testnet, its RPC limits, and which RPC methods it serves -The Giga testnet pages state the testnet build that they were checked against, and which values come from live calls rather than from the build's code. When the testnet is upgraded or reset, check the RPC limits and the RPC method list against the live RPC again. The same testnet values also appear in `learn/dev-chains.mdx`, `learn/faucet.mdx`, `evm/networks.mdx`, `ai/sei-skill/index.mdx`, `snippets/add-sei-button.jsx`, `skill.md`, and `scripts/generate-llms.mjs`. Update those files in the same change. +The Giga testnet pages state the testnet build that they were checked against, and which values come from live calls rather than from the build's code. When the testnet is upgraded or reset, check the RPC limits and the RPC method list against the live RPC again. The same testnet values also appear in `learn/dev-chains.mdx`, `learn/faucet.mdx`, `evm/networks.mdx`, `ai/sei-skill/index.mdx`, `snippets/add-sei-button.jsx`, `snippets/run-snippet.jsx`, `skill.md`, and `scripts/generate-llms.mjs`. Update those files in the same change. In prose, call the network "the Giga testnet", and use `giga-testnet-1` where you need its identifier. Use "Sei Giga Testnet" only as a display name: in page titles, the wallet label, and chain definitions. When the testnet gets its public name, search for both forms. diff --git a/docs.json b/docs.json index b9e6e42..7b9dbb3 100644 --- a/docs.json +++ b/docs.json @@ -294,6 +294,7 @@ "group": "Giga Testnet", "pages": [ "giga/testnet", + "giga/quickstart", "giga/rpc-limits", "giga/rpc-methods" ] diff --git a/giga/index.mdx b/giga/index.mdx index 197ce7a..84535f4 100644 --- a/giga/index.mdx +++ b/giga/index.mdx @@ -5,7 +5,8 @@ description: 'Sei Giga will be the next generation of the Sei protocol following keywords: ['sei giga', 'multi-proposer blockchain', 'autobahn consensus', 'evm layer 1', 'gigagas', 'asynchronous execution', 'parallel execution', '200000 tps', 'sub-250ms finality'] --- -import { GigaProposerComparison, GigaAsyncPipeline, GigaTxJourney, GigaRoadmapTrack } from '/snippets/giga-diagrams.jsx'; +import { GigaProposerComparison, GigaAsyncPipeline, GigaRoadmapTrack } from '/snippets/giga-diagrams.jsx'; +import { GigaAutobahnWalkthrough } from '/snippets/giga-autobahn-walkthrough.jsx'; Sei Giga will be the next generation of the Sei protocol after the Giga Upgrade. It is designed to be the first Multi-Proposer EVM Layer 1. Every validator will propose transactions at the same time. Consensus will finalize only the order of those transactions. Execution and state attestation will happen after that, off the critical path. @@ -123,9 +124,9 @@ Giga will have no traditional public mempool. The initial Autobahn flow and the - Before Sedna activates, an RPC node will route the complete signed transaction to a validator proposal lane. - After the [Sedna](/giga/specs#sedna-private-dissemination) milestone activates, ingress will distribute coded symbol bundles across selected lanes. Executors will reconstruct the transaction after the finalized symbols cross the decode threshold. The resulting privacy depends on the coding parameters and adversary assumptions described in the Sedna paper. - + -The diagram and steps below describe the initial Autobahn flow before Sedna: +The walkthrough and the steps below describe the initial Autobahn flow before Sedna: 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. @@ -203,6 +204,9 @@ Each row gives its source and date. Devnet figures are Sei Labs' internal measur Connect to `giga-testnet-1`: chain ID, RPC and WebSocket endpoints, and the faucet. + + Send and confirm your first transaction on the Giga testnet in about 10 minutes. + Every cap the Giga testnet RPC enforces, and the error that each one returns. diff --git a/giga/quickstart.mdx b/giga/quickstart.mdx new file mode 100644 index 0000000..88bfb0c --- /dev/null +++ b/giga/quickstart.mdx @@ -0,0 +1,155 @@ +--- +title: 'Send Your First Transaction on the Sei Giga Testnet' +sidebarTitle: 'First Transaction' +description: 'Create a test account, fund it from the faucet, and send and confirm your first transaction on giga-testnet-1 with viem.' +keywords: ['giga testnet quickstart', 'first transaction', 'giga-testnet-1', 'viem', 'send transaction', 'giga faucet', 'nonce', 'maxPriorityFeePerGas'] +--- + +This guide takes you from an empty folder to a confirmed transaction on `giga-testnet-1`. You create a test account, fund it from the faucet, and send 0.01 SEI to yourself with [viem](https://viem.sh). It takes about 10 minutes. + +You need Node.js 20 or later. For the network details and other tools, see [Connect to the Giga testnet](/giga/testnet). + + + + ```bash + mkdir giga-first-tx && cd giga-first-tx + npm init -y + npm install viem + npm install --save-dev tsx + ``` + + + Create `create-account.mts`: + + ```typescript title="create-account.mts" + import { generatePrivateKey, privateKeyToAccount } from 'viem/accounts'; + + const privateKey = generatePrivateKey(); + console.log(`Private key: ${privateKey}`); + console.log(`Address: ${privateKeyToAccount(privateKey).address}`); + ``` + + Run it, then put the private key that it prints in an environment variable for this terminal session: + + ```bash + npx tsx create-account.mts + export PRIVATE_KEY=0x... + ``` + + Use this key only on test networks. Anyone who has the key controls the account. + + + Open the [Giga testnet faucet](https://faucet.giga-testnet-1.platform.sei.io) and paste the address that the script printed. Complete the human verification when the faucet prompts you, then claim. Each claim sends 100 SEI. + + + Create `send.mts`: + + ```typescript title="send.mts" + import { createPublicClient, createWalletClient, defineChain, formatEther, formatGwei, http, parseEther } from 'viem'; + import { privateKeyToAccount } from 'viem/accounts'; + + const seiGigaTestnet = defineChain({ + id: 1330, + name: 'Sei Giga Testnet', + nativeCurrency: { name: 'Sei', symbol: 'SEI', decimals: 18 }, + rpcUrls: { default: { http: ['https://rpc.giga-testnet-1.platform.sei.io'] } }, + testnet: true + }); + + const account = privateKeyToAccount(process.env.PRIVATE_KEY as `0x${string}`); + // Giga testnet produces several blocks per second, so poll for the receipt often. + const publicClient = createPublicClient({ chain: seiGigaTestnet, transport: http(), pollingInterval: 250 }); + const walletClient = createWalletClient({ account, chain: seiGigaTestnet, transport: http() }); + + const balance = await publicClient.getBalance({ address: account.address }); + console.log(`Balance: ${formatEther(balance)} SEI`); + + const hash = await walletClient.sendTransaction({ to: account.address, value: parseEther('0.01') }); + console.log(`Sent: ${hash}`); + + const receipt = await publicClient.waitForTransactionReceipt({ hash }); + console.log(`Status: ${receipt.status} in block ${receipt.blockNumber}`); + console.log(`Gas used: ${receipt.gasUsed} at ${formatGwei(receipt.effectiveGasPrice)} gwei`); + ``` + + Run it: + + ```bash + npx tsx send.mts + ``` + + viem takes the priority fee from `eth_maxPriorityFeePerGas`, which returns 1 gwei. The base fee on the Giga testnet is always 0, so the priority fee is the whole gas price, and 1 gwei is the minimum that the node accepts. If you set fees yourself, keep `maxPriorityFeePerGas` at 1 gwei or more. + + + +You are done when you see a `success` status. Your hash and block number differ: + +```text +Balance: 100 SEI +Sent: 0x8f6c3e0a5b... +Status: success in block 6974102 +Gas used: 21000 at 1 gwei +``` + +## Send several transactions in a row + +On the Giga testnet, `eth_getTransactionCount` with the `pending` tag returns the committed nonce. It does not count transactions that have not reached a block yet. To send several transactions before the first one is confirmed, read the nonce once and count up in your client. Send the transactions in nonce order: the node admits each sender's transactions in order and rejects a gap with `bad nonce`. + +```typescript title="send-several.mts" +import { createPublicClient, createWalletClient, defineChain, http, parseEther, type Hash } from 'viem'; +import { privateKeyToAccount } from 'viem/accounts'; + +const seiGigaTestnet = defineChain({ + id: 1330, + name: 'Sei Giga Testnet', + nativeCurrency: { name: 'Sei', symbol: 'SEI', decimals: 18 }, + rpcUrls: { default: { http: ['https://rpc.giga-testnet-1.platform.sei.io'] } }, + testnet: true +}); + +const account = privateKeyToAccount(process.env.PRIVATE_KEY as `0x${string}`); +const publicClient = createPublicClient({ chain: seiGigaTestnet, transport: http(), pollingInterval: 250 }); +const walletClient = createWalletClient({ account, chain: seiGigaTestnet, transport: http() }); + +let nonce = await publicClient.getTransactionCount({ address: account.address }); +const hashes: Hash[] = []; +for (let i = 0; i < 3; i++) { + hashes.push(await walletClient.sendTransaction({ to: account.address, value: parseEther('0.001'), nonce: nonce++ })); +} + +const receipts = await Promise.all(hashes.map((hash) => publicClient.waitForTransactionReceipt({ hash }))); +for (const receipt of receipts) { + console.log(`${receipt.status} in block ${receipt.blockNumber}`); +} +``` + +Run it with `npx tsx send-several.mts`. You are done when all three lines say `success`. + +## Troubleshooting + +| Error | What to do | +| --- | --- | +| `invalid private key, expected hex or 32 bytes, got string` | `PRIVATE_KEY` must be `0x` followed by 64 hex characters. Some wallets export keys without the `0x` prefix, so add it if it's missing | +| `The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account` | The account has no SEI yet. Claim from the [faucet](https://faucet.giga-testnet-1.platform.sei.io), then run the script again | +| `ethereum transaction effective gas price is below 1000000000` | Your fee settings are below the 1 gwei minimum. Remove them so that viem estimates them, or set `maxPriorityFeePerGas: parseGwei('1')` | +| `bad nonce: got N, want M` | A nonce was reused or skipped. Wait for your earlier receipts, then read the nonce again with `getTransactionCount` | +| `ethereum transaction chain ID does not match 1330` | The transaction was signed for another chain. Use chain ID `1330` | + +For every RPC limit and its error, see [RPC limits](/giga/rpc-limits). + +## Next steps + + + + Fees, precompiles, preinstalled contracts, and block fields that differ from Sei Testnet. + + + Every cap the Giga testnet RPC enforces, and the error that each one returns. + + + Hardhat and Foundry settings for the Giga testnet. + + + Finality, fees, and contract patterns that make the most of Giga's parallel execution. + + diff --git a/giga/rpc-limits.mdx b/giga/rpc-limits.mdx index 64d579e..7c90d73 100644 --- a/giga/rpc-limits.mdx +++ b/giga/rpc-limits.mdx @@ -5,6 +5,8 @@ description: 'Every limit the Giga testnet RPC enforces, with its value and erro keywords: ['giga rpc limits', 'giga-testnet-1', 'eth_getlogs block range', 'json-rpc batch limit', 'eth_estimategas gas cap', 'websocket subscriptions', 'rpc errors', 'logsbloom', 'minimum gas price'] --- +import { RunSnippet } from '/snippets/run-snippet.jsx'; + The Giga testnet RPC at `https://rpc.giga-testnet-1.platform.sei.io` enforces the limits on this page. Each table gives the value and what the RPC returns when you go past it, so that your client can handle the error. @@ -59,6 +61,8 @@ Under heavy load, `eth_sendRawTransaction` can wait for room in the validator's The base fee is always 0, and blocks report `baseFeePerGas` as `0x0`. For an EIP-1559 transaction, the effective gas price is therefore its priority fee, so set `maxPriorityFeePerGas` to at least 1 gwei. `eth_maxPriorityFeePerGas` returns 1 gwei, and `eth_gasPrice` returns 1.1 gwei, 10% above the minimum. Both suggestions would rise only if a block used more than 80% of the 100,000,000 gas that headers report. Each block admits at most 50,000,000 declared gas, so that cannot happen on `giga-testnet-1`. + + The node also refuses an unprotected legacy transaction, so the keyless deployment transactions that place Multicall3 and the CREATE2 deployers at their usual addresses cannot run on the Giga testnet. ## Logs @@ -114,7 +118,7 @@ Heavy requests, such as `debug_trace*` calls and `eth_getBlockReceipts` for many ## History -The RPC keeps a rolling window of about the latest 4.32 million blocks: a rollback window of 1,000 blocks plus a lookback window of 4,320,000 blocks. At the current rate of about five blocks per second, the window covers about 10 days. To keep a longer history, index blocks as they are produced. +The RPC keeps a rolling window of about the latest 4.32 million blocks: a rollback window of 1,000 blocks plus a lookback window of 4,320,000 blocks. The window is a fixed number of blocks, so how many days it covers depends on the block rate. To keep a longer history, index blocks as they are produced. | Request before the window | Error | | --- | --- | @@ -143,6 +147,8 @@ Some block header fields are placeholders on `giga-testnet-1`. Indexers and ligh Blocks also carry `milliTimestamp`, a field that Ethereum blocks do not have. It is the block time in milliseconds. `timestamp` is in seconds, as on Ethereum, so several blocks share each `timestamp`. + + ## Unsupported methods `eth_syncing` returns a not-supported error. `net_peerCount` and `eth_getRawTransactionByHash` do not exist. Health checks that call these methods fail, so check health with `eth_blockNumber` or `eth_chainId` instead. For the full list, see [RPC methods](/giga/rpc-methods). diff --git a/giga/rpc-methods.mdx b/giga/rpc-methods.mdx index f165255..41f18e0 100644 --- a/giga/rpc-methods.mdx +++ b/giga/rpc-methods.mdx @@ -5,12 +5,16 @@ description: 'Which JSON-RPC methods the Giga testnet serves, which return a not keywords: ['giga rpc methods', 'giga-testnet-1', 'json-rpc support', 'eth_syncing', 'net_peercount', 'eth_getrawtransactionbyhash', 'debug_traceblockbynumber'] --- +import { RunSnippet } from '/snippets/run-snippet.jsx'; + The Giga testnet RPC at `https://rpc.giga-testnet-1.platform.sei.io` serves part of the Ethereum JSON-RPC API. Each method on this page is in one of three groups: - **Served**: the method works. The [RPC limits](/giga/rpc-limits) apply. - **Not supported**: the method exists, but it always fails with code `-32000` and a message that says it is not supported. - **Missing**: the RPC does not have the method. A call fails with code `-32601` and the message `the method does not exist/is not available`. +Each group has an example call that runs from your browser against the live RPC. + This list was checked against calls to `giga-testnet-1` on November 30 and December 1, 2026, and against [`giga/evmonly/rpc`](https://github.com/sei-protocol/sei-chain/tree/7414b3c2dc3c72f65699226810685b8ccd318445/giga/evmonly/rpc) at build `7414b3c`, which the testnet runs. Every error message in the tables comes from a live call. The list can change when the testnet is upgraded or reset. @@ -29,6 +33,8 @@ The Giga testnet RPC at `https://rpc.giga-testnet-1.platform.sei.io` serves part | `net_version` | Returns `1330` | | `web3_clientVersion` | Returns `Sei//-/` | + + ### Blocks | Method | Notes | @@ -39,6 +45,8 @@ The Giga testnet RPC at `https://rpc.giga-testnet-1.platform.sei.io` serves part | `eth_getBlockTransactionCountByNumber` | | | `eth_getBlockTransactionCountByHash` | | + + ### Transactions | Method | Notes | @@ -113,6 +121,8 @@ These methods fail with code `-32000`. The `newPendingTransactions` and `syncing` subscription types also fail. `eth_subscribe` rejects them with code `-32601`. + + ## Missing methods These methods fail with code `-32601`. @@ -132,6 +142,8 @@ These methods fail with code `-32601`. | Transaction pool | `txpool_status`, `txpool_content` | | Sei extensions from Sei Mainnet and Sei Testnet | `sei_*` methods, such as `sei_getEVMAddress` and `sei_getCosmosTx` | + + ## Work around missing methods - **Health checks.** Call `eth_blockNumber` or `eth_chainId` instead of `net_peerCount`, `net_listening`, or `eth_syncing`. diff --git a/giga/testnet.mdx b/giga/testnet.mdx index be2cd81..d9f2132 100644 --- a/giga/testnet.mdx +++ b/giga/testnet.mdx @@ -6,6 +6,7 @@ keywords: ['sei giga testnet', 'giga-testnet-1', 'chain id 1330', 'giga rpc endp --- import { AddSeiButton } from '/snippets/add-sei-button.jsx'; +import { RunSnippet } from '/snippets/run-snippet.jsx'; `giga-testnet-1` is the Giga testnet. It runs [Autobahn consensus](/giga#autobahn-consensus) and Giga's EVM-only execution stack. Use it to try your contracts, dApps, and indexers on Giga. @@ -33,7 +34,11 @@ The Giga testnet is a separate chain. It is not [Sei Testnet](/learn/dev-chains# The RPC accepts requests from any origin, so browser dApps and wallets can call it directly. -To check that you can reach the RPC, request the chain ID. The result is `0x532`, which is `1330`: +To check that you can reach the RPC, request the chain ID. The result is `0x532`, which is `1330`. This call runs from your browser: + + + +From a terminal, send the same request with curl: ```bash curl -s -X POST https://rpc.giga-testnet-1.platform.sei.io \ @@ -165,6 +170,9 @@ The [Sei Testnet faucet](/learn/faucet) does not fund Giga testnet addresses. ## Next steps + + Create a test account, fund it, and send and confirm a transaction with viem. + Every cap the Giga testnet RPC enforces, and the error that each one returns. @@ -174,7 +182,4 @@ The [Sei Testnet faucet](/learn/faucet) does not fund Giga testnet addresses. What Giga changes for contracts and dApps: finality, fees, and parallel-friendly patterns. - - The architecture, the roadmap, and how Giga ships. - diff --git a/snippets/giga-autobahn-walkthrough.jsx b/snippets/giga-autobahn-walkthrough.jsx new file mode 100644 index 0000000..044697d --- /dev/null +++ b/snippets/giga-autobahn-walkthrough.jsx @@ -0,0 +1,295 @@ +// GigaAutobahnWalkthrough — a steppable, animated walk through the initial +// Autobahn transaction flow (before Sedna). It starts playing when it scrolls +// into view, loops until a reader pauses it, and pauses while it is off +// screen. Readers can also use Play, Pause, Back, Next, and the step dots. +// +// Mintlify notes: module-level declarations crash in Mintlify, so every +// constant lives inside the component. Mintlify compiles only Tailwind classes +// written literally in a className attribute, and it does not apply dark:bg-* +// or dark:border-* on snippet containers, so surfaces use translucent inline +// styles and the SVG draws with currentColor. Under prefers-reduced-motion, +// the walkthrough does not start on its own, and steps change without +// animated transitions. +// +// Usage in MDX: +// import { GigaAutobahnWalkthrough } from '/snippets/giga-autobahn-walkthrough.jsx'; +// +export const GigaAutobahnWalkthrough = () => { + 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: 'Sign the transaction', + text: 'You sign a transaction in your wallet or client library, exactly as on any EVM chain.' + }, + { + title: 'Send it to an RPC node', + text: 'An RPC node routes the complete signed transaction to a validator. There is no public mempool to wait in.' + }, + { + title: 'Batch it into a lane', + text: 'The validator appends the transaction to its next batch, called a car, and chains that car onto its own lane. Every validator extends its lane at the same time.' + }, + { + 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.' + }, + { + title: 'Commit a cut', + text: "Consensus commits a cut: the latest certified tip of every lane. Your transaction's position is now fixed. This is ordering finality." + }, + { + title: 'Merge the lanes', + text: 'Every node merges the cut into one sequence with the same deterministic rule. Lanes are sorted by their highest priority fee, the order inside each lane is kept, and duplicate transactions are dropped by hash.' + }, + { + title: 'Execute in parallel', + text: 'Nodes execute the merged sequence in parallel and produce your receipt. Execution happens after ordering, off the consensus critical path.' + }, + { + title: 'Attest the state', + text: "In a later block, a two-thirds voting-power quorum attests to the block's divergence digest. This is state attestation finality." + } + ]; + const last = steps.length - 1; + + const lanesY = [70, 130, 190, 250]; + const oldCars = [3, 2, 3, 2]; + const carW = 40; + const carH = 22; + const carX0 = 248; + const carStep = 48; + const cutX = 600; + const userLane = 1; + const mergeOrder = [2, 1, 0, 3]; + const userSlot = mergeOrder.indexOf(userLane); + const newCarX = (lane) => carX0 + oldCars[lane] * carStep; + const rowX = (slot) => 690 + slot * 46; + + 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 motion = reduced ? 'none' : 'transform 600ms cubic-bezier(0.4, 0, 0.2, 1), opacity 400ms ease'; + const fade = reduced ? 'none' : 'opacity 400ms ease'; + const shown = (visible) => ({ opacity: visible ? 1 : 0, transition: fade }); + + const dot = + step === 0 + ? { x: 46, y: 168 } + : step === 1 + ? { x: 238, y: lanesY[userLane] } + : step < 5 + ? { x: newCarX(userLane) + carW / 2, y: lanesY[userLane] } + : { x: rowX(userSlot) + carW / 2, y: 160 }; + + 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 ( +
+
+
+ + every validator streams its own lane + + = 1)}> + + + + + you + + RPC node + + {lanesY.map((y, lane) => ( + + + + {'V' + (lane + 1)} + {Array.from({ length: oldCars[lane] }).map((_, j) => ( + + ))} + = 2)}> + + + = 3)}> + + PoA + + = 4)}> + + + + = 5)} /> + + ))} + + + {[0, 2, 3].map((lane) => ( + + ))} + votes from f + 1 replicas + + + = 4)}> + + cut · ordering finality + + + = 5)}>merged order + {lanesY.map((y, lane) => { + const slot = mergeOrder.indexOf(lane); + const at = step >= 5 ? { x: rowX(slot), y: 148 } : { x: newCarX(lane), y: y - carH / 2 }; + const mine = lane === userLane; + return ( + = 5 ? 1 : 0, transition: motion }}> + = 6 ? (mine ? 0.9 : 0.3) : mine ? 0.25 : 0.12} stroke={mine ? accent : ink} strokeOpacity={mine ? 1 : 0.45} strokeWidth="1.2" style={{ transition: fade }} /> + = 6 && mine ? '#fff' : ink}>{'V' + (lane + 1)} + + ); + })} + + = 6)}> + + + receipt ✓ + + + = 7)}> + + 2/3 voting power attests the digest + state attestation finality + + + = 6 ? 0 : 1, transition: motion }}> + + + +
+ +
+
+
+ Step {step + 1} of {steps.length} +
+
{steps[step].title}
+

{steps[step].text}

+
+
+ + + +
+
+ +
+ {steps.map((item, i) => ( +
+
+
The initial Autobahn flow before Sedna, as the whitepaper describes it. Use Play and Pause, or step through with Back and Next.
+
+ ); +}; diff --git a/snippets/giga-diagrams.jsx b/snippets/giga-diagrams.jsx index 85f74da..6f11ac2 100644 --- a/snippets/giga-diagrams.jsx +++ b/snippets/giga-diagrams.jsx @@ -1,3 +1,7 @@ +// 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. + export const GigaProposerComparison = () => { const ink = 'currentColor'; const accent = 'var(--sei-maroon-50)'; @@ -76,98 +80,223 @@ export const GigaAsyncPipeline = () => { 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 rows = [ { y: 62, label: 'Ordering' }, { y: 116, label: 'Execution' }, { y: 170, label: 'Attestation' } ]; - return ( -
-
- - - - - - - {rows.map((r) => ( - - {r.label} - - - ))} - {[0, 1, 2, 3].map((i) => ( - - - order n{i > 0 ? '+' + i : ''} - - ))} - {[0, 1, 2].map((i) => ( - - - execute n{i > 0 ? '+' + i : ''} - - ))} - - attest n: 2/3 voting power signs D_n - - - ordering finality for n - - attestation for n lags by x blocks - - state attestation finality for n - - - time - -
-
Consensus will keep ordering new blocks while earlier blocks execute and their divergence digests are attested. Ordering finality will be the fast signal. State attestation will follow a bounded number of blocks later.
-
- ); -}; + 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 } + ]; -export const GigaTxJourney = () => { - const ink = 'currentColor'; - const accent = 'var(--sei-maroon-50)'; - const gold = 'var(--sei-diagram-gold, var(--sei-gold-100))'; const steps = [ - { t: 'submit', s: 'to any RPC node' }, - { t: 'lane', s: 'validator includes it' }, - { t: 'PoA', s: 'availability threshold' }, - { t: 'ordered', s: 'cut committed' }, - { t: 'executed', s: 'merged, run in parallel' }, - { t: 'attested', s: '2/3 voting-power digest' } + { + 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: '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: '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." + } ]; + 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 fade = reduced ? 'none' : 'opacity 400ms ease'; + const shown = (visible) => ({ opacity: visible ? 1 : 0, transition: fade }); + const grow = (on) => ({ + transformBox: 'fill-box', + transformOrigin: 'left center', + transform: `scaleX(${on ? 1 : 0})`, + transition: reduced ? 'none' : on ? 'transform 500ms cubic-bezier(0.4, 0, 0.2, 1)' : 'transform 250ms ease' + }); + const label = (on) => ({ opacity: on ? 1 : 0, transition: reduced ? 'none' : on ? 'opacity 300ms ease 250ms' : 'opacity 200ms 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 ( -
-
- - - - - - - {steps.map((st, i) => { - const x = 76 + i * 150; - const strong = i === 3 || i === 5; - return ( - - {i < steps.length - 1 ? : null} - - {i + 1} - {st.t} - {st.s} +
+
+
+ + + + + + + {rows.map((r) => ( + + {r.label} + - ); - })} - ordering finality - - state attestation finality - - + ))} + + {boxes.map((b) => { + const on = step >= b.at; + const color = b.kind === 'order' ? accent : b.kind === 'attest' ? gold : ink; + const mine = b.key === 'o0' || b.key === 'e0' || b.key === 'a0'; + return ( + + + + {b.label} + + ); + })} + + + ordering finality for n + = 3)}> + + attestation for n lags by x blocks + + state attestation finality for n + + + + time + +
+ +
+
+
+ Step {step + 1} of {steps.length} +
+
{steps[step].title}
+

{steps[step].text}

+
+
+ + + +
+
+ +
+ {steps.map((item, i) => ( +
-
The initial Autobahn transaction flow before Sedna. An RPC node routes the complete signed transaction to a lane, consensus fixes its order, execution produces the receipt, and attestation follows.
+
Consensus will keep ordering new blocks while earlier blocks execute and their divergence digests are attested. Ordering finality will be the fast signal. State attestation will follow a bounded number of blocks later.
); }; @@ -327,53 +456,244 @@ export const GigaAttestationFlow = () => { const ink = 'currentColor'; const accent = 'var(--sei-maroon-50)'; const gold = 'var(--sei-diagram-gold, var(--sei-gold-100))'; - const blocks = ['n-1', 'n', 'n+1', 'n+2', 'n+x']; + const hairline = 'rgba(128, 128, 128, 0.25)'; + const blocks = [ + { b: 'n-1', from: 0 }, + { b: 'n', from: 0 }, + { b: 'n+1', from: 1 }, + { b: 'n+2', from: 2 }, + { b: 'n+x', from: 4 } + ]; + const stages = [ + { x: 96, label: 'execute block n', 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 } + ]; + + 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: '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.' + }, + { + title: 'Resolve the write log', + text: 'If the block writes a key more than once, the last write wins. The digest covers the surviving writes, the receipts, and the gas accounting.' + }, + { + 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.' + }, + { + 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.' + }, + { + title: 'Contain divergence', + text: 'Signing two different digests for the same block is slashable equivocation. Divergence below one-third of voting power can be isolated. Beyond one-third, the chain is designed to halt.' + } + ]; + 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 slideIn = (visible, dx, dy, delay) => ({ + opacity: visible ? 1 : 0, + transform: visible ? 'translate(0px, 0px)' : `translate(${dx}px, ${dy}px)`, + transition: reduced ? 'none' : `transform 600ms cubic-bezier(0.4, 0, 0.2, 1) ${delay || 0}ms, opacity 400ms ease ${delay || 0}ms` + }); + const ghost = (pending) => ({ opacity: pending ? 1 : 0, transition: reduced ? 'none' : 'opacity 300ms ease' }); + const attested = step >= 4; + + 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 ( -
-
- - - - - - - - - - {blocks.map((b, i) => ( - - - block {b} - {i < blocks.length - 1 ? : null} +
+
+
+ + + + + + + + + + + {blocks.map((blk, i) => (blk.from > 0 ? : null))} + {stages.map((s) => ( + + ))} + + - ))} - ordering final - - - {[ - { x: 96, label: 'execute block n', sub: 'deterministic Apply' }, - { x: 296, label: 'write log', sub: 'last write wins' }, - { x: 496, label: 'd_n = LtHash(...)', sub: 'writes, receipts, gas' } - ].map((s, i) => ( - - - {s.label} - {s.sub} - {i < 2 ? : null} + {blocks.map((blk, i) => { + const isN = i === 1; + const later = i === 4; + return ( + = blk.from, -16, 0)}> + {i > 0 ? : null} + + block {blk.b} + + ); + })} + ordering final + state attestation final + + = 1, 0, -8)} /> + {stages.map((s, i) => ( + = s.from, -12, 0)}> + {i > 0 ? : null} + + {s.label} + {s.sub} + + ))} + = 3, -12, 0, 250)}> + + + digest D_n + compact commitment + + + + 2/3 voting power, + included in block n+x + + + = 5, 0, 10)}> + + signing two different digests for the same block is slashable equivocation; + divergence under 1/3 of voting power can be isolated; over 1/3 is designed to halt the chain + +
+ +
+
+
+ Step {step + 1} of {steps.length} +
+
{steps[step].title}
+

{steps[step].text}

+
+
+ + + +
+
+ +
+ {steps.map((item, i) => ( +
Execution results will be committed as a lattice-hash digest rather than a state root. Validators will attest to that digest a bounded number of blocks later.
@@ -383,47 +703,239 @@ export const GigaAttestationFlow = () => { export const GigaOccDiagram = () => { const ink = 'currentColor'; const accent = 'var(--sei-maroon-50)'; + const hairline = 'rgba(128, 128, 128, 0.25)'; const workers = ['worker 1', 'worker 2', 'worker 3']; + const rowY = (w) => 50 + w * 66; + const runs = [ + { id: 't1', w: 0, x: 126, len: 100, label: 't1', from: 0, delay: 0 }, + { id: 't2', w: 1, x: 126, len: 180, label: 't2 writes k', from: 0, delay: 0 }, + { id: 't3', w: 2, x: 126, len: 190, label: 't3', from: 0, delay: 0 }, + { id: 't4', w: 0, x: 236, len: 120, label: 't4 reads k', from: 1, delay: 0 }, + { id: 't5', w: 1, x: 316, len: 110, label: 't5', from: 1, delay: 280 }, + { id: 't4r', w: 0, x: 384, len: 130, label: 't4 re-executes', from: 3, delay: 0 } + ]; + + const steps = [ + { + title: 'Start in parallel', + text: "Workers start the block's transactions in parallel. Each transaction buffers its writes privately, so nothing reaches shared state yet." + }, + { + title: 'Read a value that is about to change', + text: "As workers free up, they take t4 and t5. t4 reads k while t2, which comes earlier in the block, is still running. t4 sees the value from before t2's write." + }, + { + title: 'Validate against earlier writes', + text: "Validation checks whether an earlier transaction in the block wrote to anything a later one read. t2 wrote k after t4 began, so t4's read is stale. The other transactions pass." + }, + { + title: 'Re-execute only the conflict', + text: "Only t4 rolls back and runs again, this time reading t2's value of k. Every other transaction keeps its first result." + }, + { + title: 'Commit in block order', + text: 'Results commit in block order, so the outcome is identical to sequential execution. Under sustained contention, the sei-chain scheduler retries a transaction up to 10 times, then falls back to sequential execution.' + } + ]; + 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 fade = reduced ? 'none' : 'opacity 400ms ease'; + const shown = (visible) => ({ opacity: visible ? 1 : 0, transition: fade }); + const grow = (on, run) => ({ + transformBox: 'fill-box', + transformOrigin: 'left center', + transform: `scaleX(${on ? 1 : 0})`, + transition: reduced ? 'none' : on ? `transform ${run.len * 3.5}ms linear ${run.delay}ms` : 'transform 250ms ease' + }); + const label = (on, run) => ({ opacity: on ? 1 : 0, transition: reduced ? 'none' : on ? `opacity 300ms ease ${run.delay + 150}ms` : 'opacity 200ms ease' }); + + const stale = step >= 2; + + 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 ( -
-
- - - - - - - {workers.map((w, i) => ( - - {w} - +
+
+
+ + + + + + + + + + {workers.map((w, i) => ( + + {w} + + + ))} + + {runs.map((run) => { + const on = step >= run.from; + const isStale = run.id === 't4' && stale; + const redo = run.id === 't4r'; + return ( + + + {run.label} + + ); + })} + + = 1)}> + + + + t2 is still running + + + + + conflict + validation caught the stale read + + + = 3)} /> + + = 4)}> + + + commit in block order + result identical to + sequential execution + only conflicting transactions re-run; after 10 retries the implementation falls back to sequential execution + + + time + +
+ +
+
+
+ Step {step + 1} of {steps.length} +
+
{steps[step].title}
+

{steps[step].text}

+
+
+ + + +
+
+ +
+ {steps.map((item, i) => ( +
All transactions in a block will start in parallel with private write buffers. Validation will re-execute only those whose reads collided with an earlier transaction's writes.
@@ -537,66 +1049,253 @@ export const GigaBudWindow = () => { export const GigaMergeRule = () => { const ink = 'currentColor'; const accent = 'var(--sei-maroon-50)'; - const lanesIn = [ - { v: 'V1', max: 12, txs: [{ n: 'a', t: 12 }, { n: 'e', t: 8, dup: true }] }, + const hairline = 'rgba(128, 128, 128, 0.25)'; + const lanes = [ + { v: 'V1', max: 12, txs: [{ n: 'a', t: 12 }, { n: 'e', t: 8 }] }, { v: 'V2', max: 40, txs: [{ n: 'c', t: 40 }, { n: 'd', t: 9 }] }, { v: 'V3', max: 20, txs: [{ n: 'f', t: 20 }, { n: 'e', t: 8 }] } ]; - const sorted = [1, 2, 0]; + const rank = [2, 0, 1]; + const byRank = [1, 2, 0]; + + const steps = [ + { + title: "Collect each lane's new transactions", + text: 'Every node starts from the same committed cut. Each lane contributes its new transactions, the ones that no earlier cut included, in the order its validator chained them.' + }, + { + title: 'Sort lanes by their highest tip', + text: 'Lanes sort in descending order of the highest tip among their new transactions: V2 with 40, then V3 with 20, then V1 with 12. A tie would break by replica index.' + }, + { + title: 'Keep the order inside each lane', + text: 'Whole lanes move, not single transactions. d keeps its place behind c, so it stays ahead of f even though f pays a higher tip.' + }, + { + title: 'Concatenate the lanes', + text: 'Joining the sorted lanes end to end gives one sequence: c, d, f, e, a, e.' + }, + { + title: 'Drop duplicate hashes', + text: 'e reached two lanes. Only its first occurrence, from V3, executes. The copy from V1 is dropped without executing and gets a partial tip refund.' + } + ]; + const last = steps.length - 1; + + const rowY = (row) => 46 + row * 58; + const chipX = (j) => 100 + j * 94; + const chipW = 84; + const chipH = 30; + const seqX = 572; + const seqY = (k) => 42 + k * 38; + + 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 motion = reduced ? 'none' : 'transform 600ms cubic-bezier(0.4, 0, 0.2, 1), opacity 400ms ease'; + const fade = reduced ? 'none' : 'opacity 400ms ease'; + const shown = (visible) => ({ opacity: visible ? 1 : 0, transition: fade }); + + const sorted = step >= 1; + const merged = step >= 3; + const deduped = step >= 4; + + 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 ( -
-
- - - - - - - new transactions per lane - {lanesIn.map((ln, i) => ( - - {ln.v} - max {ln.max} - {ln.txs.map((tx, j) => ( - - - {tx.n} · tip {tx.t} - - ))} - - ))} - - 1. sort lanes - by max tip - - lane order: V2, V3, V1 - {sorted.map((li, i) => ( - - {i + 1} - {lanesIn[li].txs.map((tx, j) => ( - - - {lanesIn[li].v}: {tx.n} +
+
+
+ + + + + + + new transactions per lane + max tip + executable sequence + + {lanes.map((lane, li) => ( + + + + {rank[li] + 1} - ))} + {lane.v} + {lane.txs.map((tx, j) => ( + + ))} + + {'max ' + lane.max} + + ))} + + d (tip 9) stays ahead of f (tip 20): lanes move as a whole + + + + concatenate - ))} - 2. intra-lane order preserved + dedupe by hash - - 3. dedupe - executable sequence - {['c', 'd', 'f', 'e', 'a', 'e'].map((n, i) => { - const dup = i === 5; - return ( - - - {i + 1}. {n}{dup ? ' (duplicate hash)' : ''} + {[0, 1, 2, 3, 4, 5].map((k) => ( + + + {k + 1} - ); - })} - dropped copy gets a partial tip refund - + ))} + {byRank.map((li, g) => { + const top = seqY(g * 2) + 4; + const bottom = seqY(g * 2 + 1) + chipH - 4; + return ( + + + {lanes[li].v} + + ); + })} + + {lanes.map((lane, li) => + lane.txs.map((tx, j) => { + const k = rank[li] * 2 + j; + const at = merged ? { x: seqX, y: seqY(k) } : { x: chipX(j), y: rowY(sorted ? rank[li] : li) }; + const dup = li === 0 && j === 1; + const dropped = dup && deduped; + const strong = (step === 1 && tx.t === lane.max) || (step === 2 && ((li === 1 && j === 1) || (li === 2 && j === 0))) || (deduped && li === 2 && j === 1); + return ( + + + {tx.n + ' · tip ' + tx.t} + {dup ? : null} + + ); + }) + )} + + dropped copy: partial tip refund + +
+ +
+
+
+ Step {step + 1} of {steps.length} +
+
{steps[step].title}
+

{steps[step].text}

+
+
+ + + +
+
+ +
+ {steps.map((item, i) => ( +
The merged order will be a pure function of finalized lane contents. Lanes will sort by their highest included tip, order inside each lane will not change, and the first occurrence of a hash will win.
@@ -607,39 +1306,225 @@ export const GigaFinalitySignals = () => { 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 facts = [ + { x: 200, label: 'position fixed', color: accent, from: 0 }, + { x: 376, label: 'result known', color: ink, from: 1 }, + { x: 552, label: 'quorum confirmation', color: gold, from: 2 } + ]; + + const steps = [ + { + title: 'Ordering finality', + text: 'Your transaction lands in a committed cut, so its position is final. It has not executed yet, so there is no receipt and no result to act on.' + }, + { + title: 'Execution receipt', + text: 'A node executes the ordered transaction and produces the receipt. Your dApp now knows whether it succeeded or reverted. Interactive flows can act here if their risk policy allows it.' + }, + { + title: 'State attestation finality', + text: "A bounded number of blocks later, validators with two-thirds of voting power attest to the block's divergence digest. The executed result now carries a signed quorum confirmation." + }, + { + title: 'Act on high-value flows', + text: 'Exchange deposits, bridge withdrawals, and high-value settlement should wait for state attestation finality before they act. BUD proofs anchor to the same attested digests.' + } + ]; + 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 slideIn = (visible, dx, dy) => ({ + opacity: visible ? 1 : 0, + transform: visible ? 'translate(0px, 0px)' : `translate(${dx}px, ${dy}px)`, + transition: reduced ? 'none' : 'transform 600ms cubic-bezier(0.4, 0, 0.2, 1), opacity 400ms ease' + }); + const ghost = (pending) => ({ opacity: pending ? 1 : 0, transition: reduced ? 'none' : 'opacity 300ms ease' }); + const fade = reduced ? 'none' : '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 ( -
-
- - - - - - - - transaction lands - in a committed cut - - - - ordering finality - order fixed; execution pending - - - execution produces receipt; - interactive flows evaluate risk - - - - state attestation finality - 2/3 voting-power digest, x blocks later - - - exchange deposits, bridges, - high-value settlement, BUD proofs - - ordering fixes position; execution yields the result; attestation adds a signed quorum confirmation - +
+
+
+ + + + + + + + + + + + + + transaction lands + in a committed cut + + + + ordering finality + order fixed; execution pending + + = 1, -12, 0)}> + + + execution produces receipt; + interactive flows evaluate risk + + + = 2, 0, -10)}> + + + state attestation finality + 2/3 voting-power digest, x blocks later + + + = 3, -12, 0)}> + + + exchange deposits, bridges, + high-value settlement, BUD proofs + + + what your dApp knows + {facts.map((f) => { + const on = step >= f.from; + return ( + + + + {(on ? '✓ ' : '') + f.label} + + ); + })} + +
+ +
+
+
+ Step {step + 1} of {steps.length} +
+
{steps[step].title}
+

{steps[step].text}

+
+
+ + + +
+
+ +
+ {steps.map((item, i) => ( +
Ordering finality fixes position but has no receipt yet. After execution, applications may use the receipt according to their risk policy. High-value and cross-chain flows should wait for the attested digest.
@@ -649,47 +1534,224 @@ export const GigaFinalitySignals = () => { export const GigaParallelismContrast = () => { const ink = 'currentColor'; const accent = 'var(--sei-maroon-50)'; + const hairline = 'rgba(128, 128, 128, 0.25)'; const users = [0, 1, 2, 3]; + const rowY = (i) => 64 + i * 44; + const hotPath = (i) => `M 510 ${rowY(i)} Q 580 ${rowY(i)} 620 ${118 + (i - 1.5) * 6}`; + + const steps = [ + { + title: 'Same transfers, two layouts', + text: 'Both contracts process the same four transfers in one block. On the left, each transfer writes a balance slot that no other transfer touches. On the right, every transfer also increments one shared counter.' + }, + { + title: 'First wave', + text: 'Both sides start all four transfers in parallel. On the left, the write sets do not overlap, so all four commit. On the right, all four write totalTransfers. tx1 commits, and tx2, tx3, and tx4 conflict with its write.' + }, + { + title: 'Second wave', + text: 'The left side is already done. On the right, tx2, tx3, and tx4 run again. tx2 commits, and the other two conflict with its write.' + }, + { + title: 'Third wave', + text: 'tx3 commits. tx4 conflicts again and runs once more.' + }, + { + title: 'Fourth wave', + text: 'tx4 commits. The shared counter turned one parallel wave into four, one transaction at a time. The result is still correct, but the block lost its parallelism.' + } + ]; + 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 fade = reduced ? 'none' : 'opacity 400ms ease'; + const shown = (visible) => ({ opacity: visible ? 1 : 0, transition: fade }); + + const leftDone = step >= 1; + const doneRight = (i) => step >= 1 && i <= step - 1; + const commitNow = (i) => step >= 1 && i === step - 1; + const conflictNow = (i) => step >= 1 && i >= 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 ( -
-
- - - - - - - - - - isolated state: one wave - {users.map((i) => ( - - - tx{i + 1} - - - balances[user{i + 1}] - - ))} - disjoint write sets: all four execute simultaneously +
+
+
+ + + + + + + + + + + + + isolated state: one wave + = 1)}>{step <= 1 ? 'wave 1' : 'done after wave 1'} + {users.map((i) => ( + + + + tx{i + 1} + + + + + balances[user{i + 1}] + ✓ + + ))} + disjoint write sets: all four execute simultaneously - + - hot slot: one at a time - {users.map((i) => ( - - - tx{i + 1} - - + hot slot: one at a time + = 1)}>{'wave ' + Math.max(1, step)} + {users.map((i) => ( + + + + tx{i + 1} + + + + ✓ + re-run + + ))} + + totalTransfers++ + every transaction writes this slot, + so they re-run in sequence: 1, 2, 3, 4 + conflicting write sets: parallelism lost for the block + +
+ +
+
+
+ Step {step + 1} of {steps.length} +
+
{steps[step].title}
+

{steps[step].text}

+
+
+ + + +
+
+ +
+ {steps.map((item, i) => ( +
The same four transfers, two storage layouts. Per-user slots let Block-STM commit everything in one pass. A shared counter forces retries until the transactions run one by one.
diff --git a/snippets/run-snippet.jsx b/snippets/run-snippet.jsx index d6ac7d9..f740225 100644 --- a/snippets/run-snippet.jsx +++ b/snippets/run-snippet.jsx @@ -21,6 +21,8 @@ // network="testnet" // description="Read the SEI balance of an address at the latest block." // /> +// +// `network` is "testnet" (the default), "mainnet", or "giga-testnet". export const RunSnippet = (props) => { const { method = 'eth_blockNumber', @@ -36,10 +38,12 @@ export const RunSnippet = (props) => { // --- config (kept inside the component: module-level decls crash in Mintlify) --- const ENDPOINTS = { testnet: 'https://evm-rpc-testnet.sei-apis.com', - mainnet: 'https://evm-rpc.sei-apis.com' + mainnet: 'https://evm-rpc.sei-apis.com', + 'giga-testnet': 'https://rpc.giga-testnet-1.platform.sei.io' }; const rpcUrl = endpoint || ENDPOINTS[network] || ENDPOINTS.testnet; - const networkLabel = network === 'mainnet' ? 'Sei Mainnet' : network === 'testnet' ? 'Sei Testnet' : network; + const networkLabel = + network === 'mainnet' ? 'Sei Mainnet' : network === 'testnet' ? 'Sei Testnet' : network === 'giga-testnet' ? 'Sei Giga Testnet' : network; const requestBody = { jsonrpc: '2.0', id: 1, method, params }; const requestJson = JSON.stringify(requestBody, null, 2); @@ -85,7 +89,8 @@ export const RunSnippet = (props) => { setElapsed(Math.round(performance.now() - startedAt)); } if (data && data.error) { - setErrorMsg(data.error.message || 'RPC returned an error'); + const code = typeof data.error.code === 'number' ? `[${data.error.code}] ` : ''; + setErrorMsg(code + (data.error.message || 'RPC returned an error')); setPhase('error'); return; }