Skip to content
BlockhashBlockhashBlock 123,868,705 Sign in Join the waitlist Dashboard

Guide

Build a token and tokenized-stock swap on Robinhood Chain, with your own fee

The Blockhash Swap API quotes and builds swaps of tokens and tokenized stocks on Robinhood Chain, routed by Mancer, with a fee of your own on each.

How is a swap routed on Robinhood Chain?

Mancer, the dex aggregator and order layer of Robinhood Chain, finds each route across the chain’s pools, and can split one swap among several.

The answer’s route names each leg: its venue, its two tokens and its share of what it spends.

Every transaction is Mancer’s calldata, handed on unchanged for your user to sign.

Blockhash signs and sends nothing.

Before transactions are served, Blockhash reads the swap’s calldata and holds it to the request: the tokens, the amount, the recipient, the floor and your fee.

The Swap API is one request, quote, after your key and the network.

The Swap API docs give each of its parameters and fields.

Request
Method
GET
Network
robinhood-mainnet
Powered by
Mancer

A price without taker, transactions with taker

Asked with no taker, the answer is a price, and transactions is null.

Asked with taker, the wallet that holds the input, it carries the transactions that wallet signs, in order: an approval where one is needed, then the swap.

Show the price while your user chooses, and ask again with the taker when they are ready to sign.

The swap reverts 10 minutes after it was built, so a quote that waited is asked again.

The sample asks what 100 USDG buys of NVDA, NVIDIA’s Robinhood token.

Mancer routed it through WETH.

BLOCKHASH_KEY="<your key>"
SWAP="https://api.blockhash.xyz/swap/v1/$BLOCKHASH_KEY/robinhood-mainnet"

curl -G "$SWAP/quote" \
  -d tokenIn=0x5fc5360d0400a0fd4f2af552add042d716f1d168 \
  -d tokenOut=0xd0601ce157db5bdc3162bbac2a2c8af5320d9eec \
  -d amountIn=100000000
{"tokenIn":"0x5fc5360d0400a0fd4f2af552add042d716f1d168",
 "tokenOut":"0xd0601ce157db5bdc3162bbac2a2c8af5320d9eec",
 "amountIn":"100000000",
 "amountOut":"657501440550916401",
 "amountInUsd":100, "amountOutUsd":99.81188632816264,
 "fees":{"mancer":{"bps":10,"token":"0x5fc5360d0400a0fd4f2af552add042d716f1d168","side":"input"},"integrator":null},
 "route":[
   {"venue":"manta","tokenIn":"0x5fc5360d0400a0fd4f2af552add042d716f1d168","tokenOut":"0x0bd7d308f8e1639fab988df18a8011f41eacad73","shareBps":10000},
   {"venue":"slipstream-c63d7338","tokenIn":"0x0bd7d308f8e1639fab988df18a8011f41eacad73","tokenOut":"0xd0601ce157db5bdc3162bbac2a2c8af5320d9eec","shareBps":10000}],
 "transactions":null,
 "warnings":[{"code":"market-note","message":"US market closed — off-hours pool spreads are wider"}],
 "poweredBy":"Mancer",
 …}

How do I add my own fee to a swap?

Add a fee of up to 100 bps (1%) with integratorFeeBps, paid inside the swap to integratorFeeRecipient.

Blockhash adds no fee of its own and takes no part of yours: Mancer’s contract, MancerIntegratorFee, pays your address.

output, the default, pays it in the token bought, at its rate of what the swap delivers.

amountOut and the floor are after it.

input pays it in the token sold: exactly its rate of amountIn, taken before the swap.

A fee on a side that is ether is paid as ether.

A recipient that refuses ether, or needs more than 30,000 gas to take it, is paid WETH.

The recipient may not be one of Mancer’s own addresses: its router, the router’s allowance target, WETH, MancerIntegratorFee, its DirectPoolExecutor, the key that sends MancerOrders’ fills.

Send the same three parameters on the price and on the quote with transactions, so the price shows what your user will receive.

fees.integrator names the rate, the recipient, the side, the token and the amount.

NameTypeWhat it meansDefault
integratorFeeBpswhole numberYour fee: 1 to 100 basis points (1%).no fee
integratorFeeRecipientaddressThe address your fee is paid to. Required with integratorFeeBps. Not the zero address, and not one of Mancer’s own addresses.
integratorFeeSide"output" or "input"Which token pays your fee.output
BLOCKHASH_KEY="<your key>"
SWAP="https://api.blockhash.xyz/swap/v1/$BLOCKHASH_KEY/robinhood-mainnet"
WALLET="<the wallet that swaps>"
FEE_TO="<your fee’s address>"

curl -G "$SWAP/quote" \
  -d tokenIn=0x5fc5360d0400a0fd4f2af552add042d716f1d168 \
  -d tokenOut=0xd0601ce157db5bdc3162bbac2a2c8af5320d9eec \
  -d amountIn=100000000 \
  -d taker=$WALLET \
  -d integratorFeeBps=25 \
  -d integratorFeeRecipient=$FEE_TO
{"amountOut":"655840503155138955",
 "minAmountOut":"652709570052181322",
 "fees":{"mancer":{"bps":10,"token":"0x5fc5360d0400a0fd4f2af552add042d716f1d168","side":"input"},
   "integrator":{"bps":25,"recipient":"0xca11bde05977b3631167028862be2a173976ca11","side":"output","token":"0xd0601ce157db5bdc3162bbac2a2c8af5320d9eec","amount":"1643710534223405"}},
 "transactions":[
   {"type":"approval","to":"0x5fc5360d0400a0fd4f2af552add042d716f1d168","data":"0x095ea7b30000000000000000000000004c16269006db0dd87e6ae3c8a014b2807aa2e388…","value":"0","gas":"85369"},
   {"type":"swap","to":"0xa62858659c83095eb5e702f0af6a7bb7f370b3e7","data":"0x85e6ff1e0000000000000000000000000000000000000000000000000000000000000020…","value":"0","gas":"979572"}],
 "simulation":{"ok":false,"block":123475470,
   "error":{"transaction":null,"reason":"insufficient-funds","message":"err: insufficient funds for gas * price + value: address [opaque] have 0 want 1707380000000 (supplied gas 85369)"},
   "native":{"needed":"42597640000000","balance":"0","covered":false}},
 …}

The sample asks the same swap with a wallet and a fee of 25 bps on the output, paid in NVDA.

It was asked with the WETH/USDG pool as the wallet: a contract that holds USDG and no ether.

So the simulation says the wallet cannot pay the gas: simulation.native.covered is false, and the answer is still a 200.

Does Mancer take a fee?

Yes, by a public schedule: its rate depends on the pair.

Mancer’s router takes it inside the swap, in the pair’s higher-ranked token: ether, then a dollar, then any other, and the input on a tie.

amountOut is after it.

fees.mancer names its rate, its token and its side.

The sample’s pair is a dollar and a stock, so Mancer’s fee was 10 bps.

PairMancer’s fee
A dollar and a dollar (USDG, USDC)Nothing
Ether or WETH and a dollar2 bps
Every other pair10 bps
Either token first seen less than 24 hours ago50 bps

How do I swap tokenized stocks on Robinhood Chain?

The Swap API quotes and builds tokenized stocks as it does any other token.

It does so for every key, from every place.

No compliance check is made.

Blockhash does not check where a request comes from, and passes nothing of where it came from on to Mancer.

Whether a stock may be offered to a user is yours to decide.

Do not show, quote or build a tokenized stock for a user in a place where it may not be offered to them.

Mancer’s public API says which tokens are stocks: each token there carries isStock, and its list of stocks needs no key.

A swap of two tokens that are not stocks can route through a stock, and its transactions can leave some of that stock with your user.

Outside US market hours, a stock’s pools quote wider spreads.

Then the answer carries the market-note warning, as the sample’s did: show it.

None of this is legal advice about any place.

curl "https://api.mancer.xyz/v1/tokens/0xd0601ce157db5bdc3162bbac2a2c8af5320d9eec"
{"address":"0xd0601ce157db5bdc3162bbac2a2c8af5320d9eec","symbol":"NVDA","decimals":18,"isStock":true,…}

# every stock, a hundred a page
curl "https://api.mancer.xyz/v1/tokens/discover?filter=stocks"

What about a launchpad’s tokens?

A token Mancer swaps through a launchpad, not its router, is answered with its price alone.

Asked with a taker, it carries no transactions, and the warning transactions-unavailable comes first.

It is charged as a quote.

What does a quote cost?

A price and a quote with transactions cost the same, 800 units, and take 50 units from the plan’s speed.

A thousand quotes cost $0.16 on Pay as you go.

What Blockhash refuses before asking Mancer is not charged.

Every refusal, and whether it is charged, is on the Swap API page.

What every other call costs is on Compute units.

A quote
800 units
Against the speed
50 units
A thousand quotes
$0.16
PageWhat it documents
Swap APIA price, or the transactions to sign, for any two tokens: powered by Mancer.
Compute unitsWhat each call costs, what is charged, and what a call takes from a plan’s speed.
ErrorsThe HTTP statuses and JSON-RPC errors the endpoint answers with, and what a client does about each.