How it differs from RPC mode
How it works
- The partner obtains aggregator swap calldata in their normal flow.
- The partner asks nexroute for a backrun via the backrun API; nexroute simulates how the swap will move the pool and returns calldata that arbitrages the resulting price.
- The user signs a Permit2 typed-data message authorising the input token movement (token, amount, spender, deadline, nonce).
- The resulting transaction is broadcast (typically by the user’s wallet). The user’s swap and the backrun execute atomically. If the backrun reverts, the user’s swap still completes.
Integration shapes
Embedded mode is a pattern, not a single integration. nexroute supports multiple shapes; pick the one that fits your stack.Wrapper contract
Partner calls a nexroute-provided contract that handles Permit2 pull, aggregator forwarding, and atomic backrun in one entrypoint.
Calldata composition
Partner receives backrun calldata and composes it into their own router, multicall, or post-hook.
When to choose Embedded mode
nexroute recommends RPC mode when feasible. Reasons:- Faster. RPC mode is one round trip from partner to nexroute, after which nexroute dispatches the tx directly via private partnerships. Embedded mode adds a separate backrun API round trip before the user signs and relies on the dispatcher’s broadcast path, which is typically slower than direct dispatch.
- Cleaner separation of concerns. The partner submits a raw signed transaction and nexroute owns the backrun end-to-end. Embedded mode pulls backrun integration into the partner’s transaction construction.
- Privacy by default. RPC mode forwards via private partnerships; Embedded mode privacy depends on whoever broadcasts.
- The user’s wallet, or any party the partner doesn’t control. RPC mode requires the partner to relay the signed transaction through nexroute’s private endpoint; if your integration ends with the user clicking submit in their wallet, that path isn’t available. Embedded mode is the way.
- The partner’s own backend or a controlled dispatcher. Use RPC mode.
Get started
Wrapper contract
Walkthrough for the wrapper-contract shape.
Calldata composition
Walkthrough for the calldata-composition shape.
Backrun API
Endpoint, request, response.
Security
Trust model and failure semantics.