Skip to main content
In this guide, you will set up and run an example solver that connects to the Message Bus, receives live quote requests, and automatically responds to the ones it can fill.
To become a Market Maker you will need to request an API Key through the Partner Portal and go through KYC/KYB

Getting started

1

Prerequisites

  • Node.js v20.18+ with npm
  • A NEAR mainnet account
2

Clone the Example Solver Repository

The AMM Solver example uses a simple constant-product AMM formula to price quotes
3

Configure your environment

Create your environment file from the provided example:
Open env/.env.local and fill your NEAR account credentials, the token pair you want to market-make, and your desired fee margin.
4

Get a Partner JWT

The Message Bus WebSocket endpoint (wss://solver-relay-v2.chaindefuser.com/ws) requires authentication. To get your credentials:
  1. Sign up at partners.near-intents.org
  2. Request access through the partner portal
  3. Complete KYC/KYB verification as part of the application process
Once approved, add your Partner JWT to env/.env.local:
The example solver automatically uses this token for WebSocket authentication — no code changes required.
Never commit your private key or Partner JWT to version control. The .env.local file is already in .gitignore, but double-check before pushing any changes.
5

Deposit liquidity

Your solver can only fill swaps if it has token balances inside the Verifier contract (intents.near).You need to do two things: register your solver’s public key on the contract, and deposit tokens.
1

Register your public key

Replace YOUR_PUBLIC_KEY with the public key that corresponds to the private key in your .env.local file, and SOLVER_ACCOUNT_ID with your actual NEAR account ID.
2

Deposit tokens

  • near.com - a web interface for swapping and depositing tokens
The solver needs balances for both tokens in the configured pair. For example, if you are market-making USDT/wNEAR, it needs both usdt.tether-token.near and wrap.near deposited into the contract.
6

Start the solver

Since the environment file is named .env.local, set NODE_ENV=local so the app picks it up:
On startup, the solver connects to the Message Bus WebSocket, subscribes to quote events, and begins polling the Verifier contract for current token balances every 15 seconds. Log output confirms the connection and initial reserves.
7

Verify it is working

Check the health endpoint to confirm the solver is running:
In the logs, look for:
  • Connection confirmed - successful WebSocket connection to the Message Bus
  • Quote requests - incoming swap requests being evaluated
  • Quote responses - signed quotes being sent back for pairs your solver supports
The solver only responds to requests for the configured token pair. If a request comes in for a different pair, or if reserves are too low to fill it, the solver skips it.
If quote requests are not appearing, that is normal during low-activity periods. The solver sends responses when matching requests arrive.

Next steps

Now that the solver is running, read the Example Solver guide to understand how the code works — from WebSocket connection through intent signing and settlement — and learn how to customize the pricing logic for your own strategy.
The example solver also supports Confidential Intents for solving against private liquidity. See the Confidential Intents guide to learn how to enable confidential mode.