In Embedded mode, the backrun runs in the same on-chain transaction as the user’s swap. There is no separate backrun transaction. The user signs once (typically a Permit2 typed-data message), and a single transaction is broadcast that the chain executes atomically. This is one of two integration modes for Capture. For an alternative where you submit a fully signed transaction to a private endpoint and nexroute appends a separate backrun transaction behind it, see RPC mode.Documentation Index
Fetch the complete documentation index at: https://docs.nexroute.io/llms.txt
Use this file to discover all available pages before exploring further.
How it differs from RPC mode
| RPC mode | Embedded mode | |
|---|---|---|
| Who dispatches the tx | partner backend (via nexroute endpoint) | the user’s wallet, or any dispatcher the partner doesn’t control |
| User signatures | one (full transaction) | one (Permit2 typed-data) |
| On-chain transactions | two (bundled) | one |
| Backrun signing | nexroute | user, via Permit2 |
| Privacy | guaranteed by nexroute relay | depends on the dispatcher’s RPC choice |
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.