intent-solver is the
open-source reference solver (MIT). One deployment serves every route:
Lightning, onchain, and asset exchange. It receives quote requests over a
Nostr relay and fills the swaps that users fund. Every connection it makes is
outbound, so it needs no open ports.
This page uses release
v0.4.0. The
.env.sample
file and the
runbook
describe every setting.
Before You Start
- Node.js 22.6 or later (up to 26), and pnpm 10 or later
- The
EMULATOR_URLvalue: the solver refuses to start without it. For mainnet, email [email protected] for it. The mutinynet URL is public - Docker with Compose, if you run the solver in a container
Install
Clone the release, build it, and create your.env from the sample:
.env.
Configure
This configuration runs the smallest solver. It connects to Arkade, takes quote requests from a Nostr relay, and fills asset swaps from its Arkade wallet. It needs no LND node, so it turns off the Lightning and onchain routes that.env.sample turns on. Set these lines in .env, and delete the
LN_BACKEND=lnd line from the sample: while it is there, the solver asks for
LND. To test on mutinynet, a Bitcoin test network, use the Mutinynet tab.
ADMIN_HOST.
The solver keeps its Arkade wallet and its swap database in .data. Set
DB_DIR to move them. Back up this directory often. If the database row of
a funded swap is lost, the solver can no longer claim or refund that swap.
Start the Solver
- From source
- Docker Compose
pnpm cli rebuilds before it runs, so build output comes first. The
solver runs in the foreground. In production, run it under a supervisor
that restarts it, such as systemd with Restart=always.Check That It Runs
When the solver connects to the relay, it logs a line like this one. The key at the end is the solver’s public key, which its card lists asdiscovery_pubkey.
docker compose ps also reports the container as
healthy while the relay connection is up.
Open the Wallet page of the admin console for the solver’s Arkade address.
Send BTC, and each asset you sell, to that address.
Choose Routes
Every route charges nothing until you set a fee. Restart the solver after you change.env, and test each route with small amounts before you add
production inventory.
On mainnet, each Lightning or onchain swap is currently between 500 and
50,000 sats. MAX_SWAP_SATS and the _MIN_SATS and _MAX_SATS settings of
each route can narrow this range, but not widen it.
Assets
Asset exchange swaps BTC for an asset, with both sides settling through Arkade. It needs nothing beyond the base setup. The solver serves each market over RFQ: a wallet asks for a quote over your relay, and the solver answers with a signed quote. Each market is a row in the admin console.- Open the console at
http://127.0.0.1:8788, go to Pricing, and select Add market. - Keep base as
BTC, set quote to the 68-character asset id, and set symbol to a short name such asUSDT. RFQ needs the symbol. - Set the decimals of each side. BTC has 8.
- Set the feed url, which returns the price of one BTC in the asset, and the price path, a JSON pointer to the price in the feed’s reply. Leave the path blank for a Binance or CoinGecko URL: the console derives it.
- Set fee bps, your spread in basis points.
- Set the min and max of each direction, in the smallest unit of what the
solver pays out. A max of
0closes that direction. - Leave serves rfq checked, and set carrier mode (see Carrier sats).
- Select Keep in draft, then Apply. The console fetches the feed before it stores the row.
.env change. Edit or remove it from the
same page.
Fills pay out of the solver’s Arkade wallet. Hold the asset for wallets that
buy it, and BTC for wallets that sell it.
Carrier sats
An asset never moves alone: it rides on a small BTC output, the carrier, worth the operator’s dust amount. By default the solver pays the carrier out of its margin on every asset it sends. The carrier sats line of the market form shows the amount and who pays it. To charge the carrier instead, set carrier mode on the market:pricednets the carrier out of whichever side supplies it, and states it in the quote ascarrier_sats.offpays it out of margin.inheritfollows price the RFQ carrier, the deployment-wide default in the Deployment limits & carrier default panel of Pricing. It is off until you check it.
Lightning
LN_SEND pays Lightning invoices for wallets. LN_RECEIVE accepts Lightning
payments for them.
Lightning needs an LND node. Connect LND first,
then turn the routes back on. Leave one at false to serve only the other
direction.
.env
.env
LN_SEND_FEE_FLAT_SATS or LN_RECEIVE_FEE_FLAT_SATS. Since v0.4.0, the
solver card and the solver’s bids carry the flat fee as fee_flat, so a
Lightning route with a flat fee still publishes a card and bids on published
requests.
On mainnet, Lightning receive runs only with
LN_RECEIVE_ACCEPT_UNILATERAL_GAP=true. Without it, the solver refuses every
receive quote with recourse_window_unservable. The setting accepts a bounded
risk. If the operator is unavailable or censors for longer than its unilateral
exit delay, and the deadline of the incoming Lightning payment has passed, a
user can take both sides of a swap. LN_RECEIVE_MAX_SATS bounds that loss
per swap, and on mainnet the solver refuses to start without it.
.env
- Sends pay the invoice from the channels of LND, so LND needs outbound liquidity.
- Receives take the payment into LND, so LND needs inbound liquidity. The solver then pays the user from its Arkade wallet.
Onchain
ONCHAIN_SEND pays Bitcoin addresses for wallets.
The onchain route needs an LND node, even without Lightning. The solver
pays out of the onchain wallet of LND. Connect LND
first, then turn the route back on:
.env
.env
.env
_FEE_BPSis the spread, in basis points._FEE_FLAT_SATSis a fixed charge per swap._FEE_CAP_SATSturns on live pricing: the solver charges the transaction size times a sampled fee rate, up to the cap. The flat charge then applies only when no fee estimate is available._FEE_MIN_SATSsets the least a fill costs. The solver refuses to start if you set it without the cap.
Get Discovered
A running solver does not make you findable. Wallets learn about you from a solver card: hand it out privately, publish your own registry, or list in the public one. To publish the card on Nostr, setSOLVER_NAME first (see
Publish the Card on Nostr).
Get Discovered
Generate your solver card and choose how wallets find you.
Arkade Intents Protocol
The index of the focused Intents reference pages.
Appendix: Connect LND
The Lightning and onchain routes all run through one LND node. Asset exchange never uses it, so set this up only when you add one of those routes..env
LND_SOCKET is the gRPC address of LND. For the certificate and the macaroon,
set either the file path (LND_CERT_PATH, LND_MACAROON_PATH) or the file
content as base64 (LND_CERT, LND_MACAROON). The solver refuses to start if
you set both forms of one.
With Docker Compose, the container cannot read files on the host. Set
LND_CERT and LND_MACAROON as base64 instead of the _PATH forms, and set
LND_SOCKET to an address the container can reach.
Restart the solver, then run the status check. It prints the LND and Arkade
balances, the Arkade address, and the swap limits, then exits. It fails on a
solver without LND.
- From source
- Docker Compose