rocket-launchQuickstart

Run Fynd

Get Fynd running locally. This guide covers building, running, and tuning the solver. No code changes required.

Prerequisites

1. Build

git clone https://github.com/propeller-heads/fynd.git
cd fynd
cargo build --release

The release binary will be at target/release/fynd.

2. Set Environment Variables

export TYCHO_API_KEY=your-api-key
export RPC_URL=https://eth.llamarpc.com
export RUST_LOG=info

3. Run

See the full list of available protocolsarrow-up-right.

Once running, Fynd:

  1. Connects to Tycho's Streams and syncs all protocol states

  2. Builds routing graphs and computes derived data (spot prices, pool depths and token gas prices)

  3. Starts the HTTP API on http://localhost:3000

circle-info

Wait for the /v1/health endpoint to return healthy before sending orders.

3.1 Including RFQ Protocols

Include RFQ (Request-for-Quote) protocols alongside on-chain protocols:

Limitations:

  • RFQ protocols cannot run alone. At least one on-chain protocol is required.

Environment variables:

3.2 Check Solver Health

Returns "healthy":true when ready to receive requests.

4. Submit a solve request

Get the quote for 1 WETH -> USDC (or any pair/amount you want):

The response includes the optimal route, amounts, gas estimates, and the net output after gas costs.

4.1 - Optional request fields

Field
Description

Overrides the default solve timeout (configured via global config see configuration section).

Return early after N solver pools respond. If set to null - it will wait for all solver pools respond until timeout.

Discard routes above this gas limit

Full interface details: API Specifications

5. Configuration

Tune Fynd with the following flags:

Required

Flag
Env Var
Description

--rpc-url

RPC_URL

Ethereum RPC endpoint

--tycho-api-key

TYCHO_API_KEY

Tycho API key

Optional

Flag
Env Var
Default
Description

--tycho-url

TYCHO_URL

localhost:4242

Tycho WebSocket URL

--chain

--

Ethereum

Target chain

-p, --protocols

--

(all)

Protocols to index (comma-separated)

--http-port

HTTP_PORT

3000

API port

--min-tvl

--

10.0

Minimum pool TVL in native token (ETH)

--tvl-buffer-multiplier

--

1.1

Hysteresis buffer for TVL filtering

--order-manager-timeout-ms

--

100

Default solve timeout (ms)

--order-manager-min-responses

--

0

Early return threshold (0 = wait for all pools)

-w, --worker-pools-config

WORKER_POOLS_CONFIG

worker_pools.toml

Worker pools config file path

--blacklist-config

BLACKLIST_CONFIG

blacklist.toml

Blacklist config file path

--disable-tls

--

false

Disable TLS for Tycho connection

--min-token-quality

--

100

--gas-refresh-interval-secs

--

30

Gas price refresh interval

--reconnect-delay-secs

--

5

Reconnect delay on connection failure

Run cargo run --release -- --help for the full list.

5.1 - Worker pools file (worker_pools.toml)

Worker pools control solver thread count and routing strategies. The default config ships with two pools:

Both pools solve every incoming order in parallel. Fynd picks the best result across pools within the timeout.

Worker Pool Configuration:

Field
Default
Description

algorithm

"most_liquid"

Algorithm used for the pool

num_workers

CPU count

Number of OS threads dedicated to this pool

task_queue_capacity

1000

Maximum number of orders that can be queued simultaneously

min_hops

1

Minimum number of hops required for routing

max_hops

3

Maximum number of hops permitted for routing

timeout_ms

100

Maximum time in milliseconds allowed per order processing in this pool

Tuning tips:

  • More workers = more orders can be solved concurrently. Each worker is a dedicated OS thread, so avoid exceeding your CPU core count across all pools.

  • Lower max_hops = faster solves but may miss better multi-hop routes.

  • Higher max_hops = explores deeper routes but takes longer. Pair with a higher timeout_ms.

  • The "fast + deep" pattern (default config) gives quick responses from the 2-hop pool while the 3-hop pool searches for better routes in the background.

To use a custom config file:

5.1 Blacklist (blacklist.toml)

Exclude specific components from routing, useful for components with known simulation issues (e.g., rebasing tokens on UniswapV3 poolsarrow-up-right):

6. Logging and Monitoring

Logs

Control log verbosity with RUST_LOG:

Prometheus Metrics

Metrics are exposed at http://localhost:9898/metrics (always on). Scrape this endpoint with Prometheus or any compatible tool. Available metrics: solve duration, response counts, failure types, and pool performance.

7. Validating and Executing the Solutions

The repository includes an end-to-end example at examples/quickstart/arrow-up-right that demonstrates quoting, simulating, and executing swaps against a running solver. See Executing the solutions for the full walkthrough.

Last updated