.env, an in-process queue, and console output. Read Before you adapt this before pointing it at real funds.Why one account is one queue
An EVM account’s transaction nonces are strictly sequential. If noncen has not executed, nonce n + 1 cannot execute first. Two failures that look similar behave differently:
- Strict nonce admission. Under Giga, the Autobahn producer mempool admits EVM transactions in per-sender nonce order and rejects a gap with a
bad nonceerror instead of holding it for later. See Giga mode behavior. The repository’snpm run baselinecommand probes the behavior of whatever RPC path you configure rather than assuming every endpoint behaves identically. - No dependable pending view. Sei does not expose Ethereum-style pending state, and Finality and block tags tells you not to rely on a pending nonce differing from the confirmed nonce.
txpool_contentis also truncated and collapses the pending/queued distinction. So even where a node answers a pending-nonce query, it is not a foundation to rebuild an in-flight queue on.
How it works
The design combines four ingredients. Each one solves a specific part of the problem, and none is sufficient alone.ERC-4337 nonce lanes
EntryPoint v0.8 stores a UserOperation nonce as a 192-bit key plus a 64-bit sequence:sequence counter for each key. The specification calls this a two-dimensional nonce; the repository calls a key a lane.
Four rules follow from that layout:
- Operations on different lanes have no ordering relationship.
- Operations on the same lane stay strictly sequential, so the implementation allows at most one in-flight operation per lane.
- An operation that executes and reverts still consumes its lane sequence.
- An operation that never reaches a successful
handleOpstransaction consumes nothing.
LaneAccount rejects lane 0. Most SDKs pick key 0 when you do not pass one, and work that lands entirely on key 0 is a single queue again. Rejecting it turns a silent fallback into a loud validation failure. ADMIN_LANE (the maximum uint192) is reserved for integrations that need one explicitly ordered lane for administrative calls.
EIP-7702 keeps the funded address
An EIP-7702 authorization writes a delegation designator into the EOA’s code slot:LaneAccount’s code in the EOA’s context, so LaneAccount.execute reaches the target with the funded EOA as msg.sender.
LaneAccount inherits the audited Simple7702Account from the account-abstraction repository and adds a single policy check:
Gas-only relayers carry what is left of the queue
UserOperations are not transactions. Something still has to wrap them inEntryPoint.handleOps transactions and pay for them. The repository uses a pool of gas-only relayers fed by a private in-process mempool.
The sequential constraint has not disappeared; it has moved. Each relayer still has one sequential EVM nonce and keeps one outer transaction in flight at a time. What changes is the custody boundary. Relayers hold native SEI for gas and nothing else. A compromised relayer key can lose its own gas balance or rebroadcast operations the funded account already signed. It cannot create a new operation, because every UserOperation carries an EIP-712 signature from the funded account over the EntryPoint’s PackedUserOperation digest.
The private mempool matters for a different reason. The canonical ERC-4337 mempool enforces the ERC-7562 validation rules, including SAME_SENDER_MEMPOOL_COUNT = 4 for an unstaked sender. Four pending operations is a wallet number, not a throughput number. Those rules exist so competing bundlers can safely pack strangers’ operations together. Here every operation comes from one account you control, so there are no strangers to defend against. The EntryPoint still enforces everything that protects funds: the signature, per-lane nonce uniqueness, and prefund solvency.
One bundle, start to finish
Each relayer runs one asynchronous worker. The worker takes a bundle of up toMAX_OPS_PER_BUNDLE operations (never two from the same lane), and then works through a fixed sequence.
Two details carry most of the safety:
- Write-ahead ordering. The signed outer transaction is written to the journal before it is broadcast. A crash between signing and sending cannot lose or duplicate work; on restart, the exact raw bytes are rebroadcast first.
- Same-nonce replacement. If no receipt arrives within
BUNDLE_RECEIPT_TIMEOUT_MS, the worker checks earlier attempts for a receipt, bumps fees byREPLACEMENT_FEE_BUMP_PERCENT, and signs a replacement at the same relayer nonce. It never sends noncen + 1while a transaction atnmight still land, which is exactly the gap this design exists to avoid.
What fails alone and what fails together
The EntryPoint treats an account execution failure as a per-operation result: it emits a failedUserOperationEvent, charges gas, advances that lane, and continues with the next operation. A validation failure (bad signature, stale sequence, insufficient prefund) is different: it reverts the whole handleOps transaction and nothing in it is consumed.
eth_estimateGas before broadcast, so validation failures are normally caught before any gas is spent. MAX_OPS_PER_BUNDLE sets the size of the shared validation domain; keep it small when isolation matters more than amortized cost.
Why this is hard to replicate
Faster hardware and better RPC routing improve every submission strategy equally. What changes here is structural: it changes what a single funded address is allowed to do, and it does so with the same custody surface as a single wallet. The honest comparison is against a fleet of hot wallets, because that is what most teams actually run. A fleet can match the width. What it cannot match is doing so from one balance, one approval set, and one key.LANE_POOL_SIZE caps how many operations can be signed and unresolved at once; RELAYER_COUNT caps how many outer transactions are actually broadcast at once. Lanes give you a large pool of independent intents, not a large number of simultaneous transactions. The rough per-block submission width is RELAYER_COUNT × MAX_OPS_PER_BUNDLE.- One balance, many lanes. Capital, approvals, and protocol state stay on one address. Width comes from lanes, not from splitting funds. A new lane costs nothing to open and is valid at sequence
0immediately. - A custody boundary you can reason about. The only key that can create a valid operation is the funded account’s. Relayer keys can be rotated, replaced, or lost with a bounded cost measured in gas.
- A frozen nonce on the hot path. After the one-time delegation, the funded account’s EVM nonce never moves while submitting. Nothing an RPC drops or a producer rejects can strand the account.
- No third-party bundler and no per-sender cap. The private mempool removes the ERC-7562
SAME_SENDER_MEMPOOL_COUNTlimit and the dependency on someone else’s inclusion policy, while keeping every EntryPoint check that protects funds. - Crash-safe by construction. Signed operations and signed outer transactions are journaled before broadcast. Replacement reuses the relayer nonce. Restart reconciliation is deterministic and refuses to create duplicate work when the state is ambiguous.
- Built for how Sei behaves. The hot signing path performs no nonce reads, so an unreliable pending view costs nothing. Fast blocks and instant finality keep each relayer’s receipt wait short, which is what makes
RELAYER_COUNT × MAX_OPS_PER_BUNDLEa meaningful per-block width rather than a theoretical one.
Tutorial: run the reference implementation
The walkthrough below deploys the demo contracts, delegates a throwaway account, funds a relayer pool, and submits 24 operations across 32 lanes. One order is deliberately given an unfillable limit price so you can watch a revert land without disturbing its neighbors.Prerequisites
- Git with submodule support
- Foundry with
forge,anvil, andcast - Node.js 22 or newer, and npm
- For the Atlantic-2 path: a fresh throwaway key funded from the Sei faucet
Clone and verify
account-abstraction and OpenZeppelin dependencies come along:git submodule update --init --recursive.Install the Node dependencies and run every local check:0 is rejected, and that a 50-lane bundle fits in one outer transaction.Choose a target network
- Local Anvil fork (recommended first)
- Atlantic-2 testnet
TRADER_PRIVATE_KEY to account 0’s private key from the Anvil startup output, and RELAYER_MNEMONIC to the mnemonic printed by that same Anvil process. Starting relayers at index 1 keeps the funded account and relayer identities distinct; the application rejects overlapping identities.Deploy the demo contracts from the repository root using Anvil’s unlocked account:.env:ALLOW_MAINNET=1 is set explicitly. That guard prevents an accidental SEI_CHAIN_ID=1329 run. It does not guard the separate Forge deployment command, and it does not make the demo production-ready.Check the preflight
status is read-only. Run it before anything that writes:0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108, the account’s current delegation, balances, its EntryPoint deposit, each relayer’s confirmed nonce and gas balance, the lane sequences, and the venue state.Delegate the account
LANE_ACCOUNT_IMPL. It spends the account’s EVM nonce once. The command is idempotent: if the account already delegates to the configured implementation, it does nothing. If the account delegates to something else, it tells you before replacing it.Fund the relayers and the EntryPoint deposit
fund uses ordinary transactions to top each relayer up to RELAYER_FUNDING SEI and to bring the account’s EntryPoint.depositTo balance up to ENTRYPOINT_DEPOSIT SEI. The deposit is what the EntryPoint draws prefund from when it validates each operation. On a public network you can instead send SEI to relayer 0 and run npm run dispense, which waits for the balance and splits it across the pool. Use one bootstrapping path or the other, not both.Submit the run
submit process performs the complete run and exits. It runs the preflight, estimates the delegated call’s gas, reads each lane’s sequence once, signs 24 operations concurrently with no nonce RPCs, journals them, bundles them, drains the bundles through the relayer pool, and prints a report. By default, order 2 receives a limit price below the mark, so its operation reverts during execution while the neighboring lanes continue.Read the report
The output below is illustrative; your addresses, blocks, and timings will differ.account noncebefore andaccount EVM nonceafter must be identical. The funded key never entered a queue.execis read from theUserOperationEventin each receipt.revertedmeans the operation landed, consumed its lane sequence, and failed inside the call.not minedwould mean the outer transaction never landed and nothing was consumed.land#is the venue’s global landing counter. It shows the order in which operations actually executed, which has nothing to do with lane number. Lane acquisition is last-in, first-out, so a fresh 32-lane pool starts at lane32; lane numbers carry no priority.hash checkconfirms that the locally computed EIP-712 digest matchesEntryPoint.getUserOpHashfor the first operation, so client-side hashing matches consensus.
PENDING or FAILED, the command exits non-zero and leaves the journal intact. Run npm run submit again once the RPC can answer receipt and nonce queries; the process recovers or replaces at the same relayer nonce before it creates new work. Do not delete the journal and do not send the relayer’s next nonce by hand.
Optional: real swaps on Atlantic-2
The repository includes a real-target path that routes tiny native SEI and native USDC swaps through the documented DragonSwap V1 deployment on Atlantic-2. It is hard-blocked on every other chain. Get testnet USDC from the Circle faucet, then:swap:setup uses ordinary transactions to approve a limited amount of USDC and to create and seed the WSEI/USDC pair if the factory has no live pair. swap:submit alternates SEI to USDC and USDC to SEI swaps through independent lanes and reports outcomes from EntryPoint events rather than one RPC read per swap. The same knobs apply:
REVERT_ORDER_INDEX=-1 when you want to measure maximum throughput.
Optional: see the baseline you are escaping
baseline sends nonce n + 1 while deliberately skipping n, reports whether the RPC path rejected it or stranded it, then fills the gap. Compare that with a submit run where 24 operations from one account are mutually independent.
Tuning
Three knobs shape a run. They interact, so change one at a time and measure.Lane pool size: the ceiling on in-flight operations
Lane pool size: the ceiling on in-flight operations
LANE_POOL_SIZE is the hard ceiling on unresolved UserOperations in a process. Larger pools permit more concurrently unresolved intents, add startup getNonce reads (batched with bounded concurrency so a public RPC does not rate-limit you), and increase the recovery state you must understand after a failure. ORDERS must not exceed LANE_POOL_SIZE; the application rejects that configuration instead of silently submitting fewer operations.Bundle width: gas efficiency against isolation
Bundle width: gas efficiency against isolation
MAX_OPS_PER_BUNDLE trades amortized outer-transaction overhead for the size of the shared validation failure domain. A width of 1 gives maximum isolation and the highest overhead. Execution reverts stay per-operation at any width. The relayer caps signed transaction gas below the live block gas limit and rejects a bundle whose estimate cannot fit.As a reference point, on Atlantic-2 on September 3, 2026, the real-swap path sustained 77 operations per bundle; 78 hit the 12,500,000 block-gas ceiling and failed safely during simulation. Width 76 produced the best observed submission rate for that call shape, 47.7 landed swaps per second. Treat these as measurements for one call shape on one network at one point in time, not as protocol limits.Relayer count: concurrent outer transaction streams
Relayer count: concurrent outer transaction streams
RELAYER_COUNT × MAX_OPS_PER_BUNDLE per block. That is a planning heuristic, not a throughput guarantee: RPC latency, block limits, state contention, gas, and producer policy still apply. Public RPC endpoints have rate limits; use a dedicated provider or your own node for anything beyond a demo.Configuration reference
The application always loads.env from the repository root. The variables you are most likely to change:
Adapting it to your contract
The demo’sMockPerpVenue is a stand-in that reverts on slippage so a failure is observable. Swapping it for a real target is a matter of encoding a different call. LaneAccount.execute(target, value, data) forwards any call, and the target sees the funded EOA as msg.sender:
app/src/swap-submit.ts is a complete example of this against a live router, including forwarding native SEI as value.
Check these before you trust a new target:
msg.senderandtx.origin. At the target,msg.senderis the funded EOA andtx.originis the gas-paying relayer. Contracts that requiretx.origin == msg.senderare incompatible. Audit each router, approval path, callback, reentrancy assumption, and authorization rule.- Gas on Sei. Storage writes cost materially more than on Ethereum. The application estimates the delegated call live and raises
CALL_GAS_LIMITwhen the estimate plus headroom is higher, so do not copy Ethereum-sized static limits. See Gas and fees. - Storage contention. Lanes remove submission ordering, not execution conflicts. Analyze which storage slots your calls touch; see Optimizing for parallelization.
- Lane policy. One lane per in-flight intent is the simplest correct policy. If some calls must stay ordered relative to each other, put them on one lane (or on
ADMIN_LANE) rather than falling back to lane0.
Before you adapt this
The repository is explicit about what it leaves out. Before this design touches real funds, add at least:- audited account and integration contracts;
- hardware-backed or remote signing;
- a real risk engine with an idempotent intent model;
- durable, replicated queue and reconciliation storage;
- metrics, tracing, alerting, and structured logs;
- controlled deployment and delegation procedures;
- RPC redundancy and chain-specific fee policy;
- graceful shutdown and operator runbooks; and
- load, fault-injection, and live-chain recovery testing.
.env, app/.state/, signed raw transactions, and RPC URLs containing credentials as sensitive. The journal does not contain private keys, but it contains signed UserOperations and replayable raw transactions until their nonces are consumed. Clone the repository for a teammate and create fresh keys; do not copy a working directory.
Troubleshooting
RPC chain ID does not match
RPC chain ID does not match
SEI_CHAIN_ID and SEI_RPC_URL. For a local fork, pass --chain-id 1328 to Anvil. The configured chain ID is part of the EIP-712 signature domain and cannot be guessed safely.EntryPoint v0.8 … MISSING
EntryPoint v0.8 … MISSING
0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108. Confirm the chain and the fork source before deploying anything. The preflight checks for code presence, not byte-for-byte identity; verify canonical addresses independently before a real deployment.Delegation mismatch
Delegation mismatch
npm run status and compare delegated to with LANE_ACCOUNT_IMPL. Do not blindly replace an unexpected designator. Confirm the account, chain, and implementation first, then run npm run delegate deliberately.Relayer has no gas
Relayer has no gas
npm run fund, or send SEI to relayer 0 and run npm run dispense.simulation failed: AA…
simulation failed: AA…
AA24 is an invalid signature or the wrong EIP-712 chain or domain; AA25 is a stale or incorrect lane sequence; an insufficient EntryPoint prefund; or delegation to the wrong account implementation. Run npm run status and resolve the cause before widening bundles or retrying.AA95 out of gas while widening bundles
AA95 out of gas while widening bundles
MAX_OPS_PER_BUNDLE; the durable queue is repacked at the smaller width.Journal lock is owned by another process
Journal lock is owned by another process
submit and swap:submit use different journals. Stop the other process. A lock whose recorded PID is no longer alive is removed automatically on the next run.A bundle remains in pending recovery
A bundle remains in pending recovery
npm run submit again once the RPC can answer receipt and nonce queries. If the application reports partial lane consumption or a state it cannot reconcile, stop and inspect the EntryPoint events, every attempted transaction hash, the relayer’s confirmed nonce, and each lane sequence.