Skip to main content

Overview

When integrating Multihopper into an automated or agentic workflow, the transfer lifecycle splits into two distinct halves:
  • API-managed — create, prepare, confirm-broadcast, and monitor via REST
  • Client-managed — sign and broadcast transactions to Solana (requires wallet access)
The sign and broadcast steps are intentionally handled client-side: your private key never leaves your environment.

Transfer lifecycle for agents

Steps 3 and 5 happen entirely outside the API. No private key material is sent to the server. confirm-broadcast is called twice: once immediately after keeperFundingTx (step 4), and once after the rest (step 6). This prevents double-funding if deployment is interrupted and /prepare is called again.

Transaction signing

preparedTxs contains four groups of transactions that must be signed in order. Each group uses either a VersionedTransaction (v0) or a legacy Transaction — the signing approach differs.
The server partially pre-signs VersionedTransactions with ephemeral keypairs. Your signing step must add your signature to the existing slot without overwriting the server’s partial signatures.
Any field that is null in preparedTxs is already confirmed on-chain from a previous broadcast attempt — skip it.

Python

Dependencies: pip install solders base58

TypeScript

Dependencies: npm install @solana/web3.js bs58

Broadcasting to Solana

Signed transactions must be broadcast in a strict order. Each group must reach confirmed status before the next group is sent — later transactions depend on accounts created by earlier ones.

Broadcast order

keeperFundingTx must be broadcast and confirmed first. Call confirm-broadcast with just the keeperFundingSignature immediately after — before broadcasting anything else. This is required to prevent double-funding if deployment is interrupted.
Wait for each routeInitTx to reach confirmed before broadcasting the next one. Allow an additional 3 seconds after the last routeInitTx and after orchestratorInitTx for account state to propagate across RPC nodes, especially on devnet.

Python

TypeScript


Handling expiry and resume

Solana blockhashes expire roughly 60 seconds after the /prepare call. If broadcast fails mid-way — due to expiry, an RPC error, or a process crash — call /prepare again with a new Idempotency-Key. The server inspects the chain and returns null for any group already confirmed. The signing and broadcast helpers above skip null fields automatically.
Repeat: sign the non-null fields → broadcast → confirm-broadcast. The server merges with the existing on-chain state.

Compliance & screening

On compliance-enabled networks (mainnet today) every route is screened against sanctions/risk data automatically, after deployment, by the keeper — your agent does nothing to “pass” screening. Two things to account for:
  • Budget the screening fee. A flat screening fee (currently 0.002 SOL on mainnet, a configured value) is taken from sourceOwner at deploy by the /prepare bundle and is not included in /estimate. It’s a refundable anti-abuse deposit — a clean route gets it back on verification, a flagged route forfeits it — but the wallet must hold it at deploy time on top of the transfer amount, protocol fees, account rent, and keeper funding, or the deploy can fail for insufficient lamports.
  • Expect a short verification window. After your final confirm-broadcast, the transfer sits in processing while the keeper verifies compliance, then hops begin executing. Keep polling — no action is needed. If a wallet is flagged, the transfer ends as refunded: the principal is returned and the screening fee is retained.
See Compliance & screening for the full lifecycle.

Full autonomous loop (TypeScript)


Agent context file (CLAUDE.md)

Drop the block below into your project’s CLAUDE.md (or any system prompt / context file your agent reads). It gives the agent everything it needs to call MultiHopper correctly without hallucinating endpoints or field names.

MCP server integration

When building an MCP-compatible agent (Claude, LangGraph, AutoGen), expose the API steps as individual tools and keep sign_and_broadcast as a local tool that holds wallet access. sign_and_broadcast is the only tool that requires wallet access. All other tools are pure HTTP wrappers and can be exposed without key material.

API Reference

Full endpoint documentation, error codes, and rate limits.

Webhooks

Receive real-time transfer lifecycle events instead of polling.

Security model

Trust assumptions and on-chain guarantees.

Keeper network

How keepers execute hops after broadcast.