LithosDocs
ProtocolPayoutsTokenStatsDocs
Start mining
Documentation home
Protocol
  • Lithos Protocol
  • LFSM
    • Rollups
    • NISPs
    • Emissions
    • Mining on Lithos
    • Candidate building
    • Ergo Voting
  • LithosDex
    • Trading with orders
    • Providing liquidity
Run Lithos
  • Startup guide
    • Setting up an Ergo testnet node
  • Configuration
    • Node connection and security
    • Stratum and difficulty
    • Block packages
    • Batching and orders
    • Collateral and emission
    • Wallet and consolidation
    • Statistics and web panels
    • Synchronization and storage
    • Tasks and dispatchers
    • Failure modes
    • Reporting issues
Client API
  • Overview
    • getLithos client information
    • getList UTXO ids for blocks
    • getUTXO ids by block height
    • getBlock info by UTXO id
    • postBlock info for multiple UTXO ids
    • getGet a block's miner set
    • getList all pool blocks
    • getGet Lithos payouts
    • getStatistics overview
    • getMining and payment totals
    • getMining statistics by hour or day
    • getEstimate Lithos hashrate
    • getNetwork difficulty by epoch
    • getThis client's own hashrate
    • getThis client's hashrate over time
    • getThis client's payouts and claims
    • getCollateral inventory
    • getLocal mining activity
    • getCollateral market snapshot
    • getList queue boxes
    • getList the active set
    • getPermit price history
    • getYour locked block rewards
    • postClaim unlocked block rewards
    • postQuote joining the queue
    • postJoin the collateral queue
    • getLithosDex pool state
    • getLithosDex fee vault state
    • getList your outstanding orders
    • postQuote a swap order
    • postPlace a swap order
    • postQuote a deposit order
    • postPlace a deposit order
    • postQuote a redeem order
    • postPlace a redeem order
    • postCancel an order
    • postQuote a swap
    • postQuote a swap by desired output
    • postExecute a swap
    • postQuote a liquidity deposit
    • postDeposit liquidity
    • postQuote a liquidity redemption
    • postRedeem liquidity
    • getList liquidity provisions
    • postClaim settled fees for a provision
    • postQuote a provision resize
    • postResize a provision
    • postCheck a pending fee flush
    • postFlush pending fees to the vault
    • getPool-wide fee history
    • getPool price history
    • getRecent pool activity
    • getFee history for one provision
    • getWallet balances and lending status
    • getGet Stratum information
    • getGet candidate settings
    • getGet difficulty commitment
    • postCommit a difficulty
    • getGet best NISP at height
Lithos

A decentralized mining pool protocol on Ergo. Miners build their own blocks; contracts pay them for proven work.

Live on Ergo mainnet
Protocol
  • How Lithos works
  • Mining on Lithos
  • NISPs
  • Emissions
  • LFSM contracts
Run Lithos
  • Startup guide
  • Configuration
  • LithosDex
  • Client API
  • Failure modes
Network
  • Live stats
  • Public stats API
  • Ergo Platform↗
  • SOAT Miner↗
Community
  • Telegram↗
  • X / Twitter↗
  • GitHub↗
Lithos
© 2026 Lithos Protocol. Open source under the MIT licence.λίθος — stone
Docs/Client API/Lithos Dex

Quote a swap order

post/dex/orders/swap/check

Quote a swap order against the current pool without placing it. The executor fee is paid on top of amountIn when selling ERG, and out of the ERG received when selling the token.

Request body

LDSwapOrderRequest · application/json
  • amountInstringrequired

    Total handed to the pool, pool fees included. The executor fee is separate. Decimal string.

  • ergInbooleanrequired

    True to sell ERG for the token, false to sell the token for ERG

  • executorFeestring

    nanoERG paid to whoever fills the order. A fill broadcast to the mempool pays its miner fee out of this. Miners skip orders paying less than they accept. Omit for the client's default. Decimal string.

  • maxMinerFeestring

    Most nanoERG a fill may pay as a miner fee, out of executorFee. Must be below executorFee. Omit for the client's default. Decimal string.

Responses

200Quote for the requested swap orderLDSwapOrderQuote▶
  • ▶
    swapLDSwapQuoterequired

    Quote for a LithosDex swap

    • ergInbooleanrequired
    • amountInstringrequired

      Total handed to the pool, fees included. Decimal string.

    • protocolFeestringrequired

      Taken out of the input and set aside for liquidity providers. Decimal string.

    • ammFeestringrequired

      The curve's own fee on the remainder; stays in the pool. Decimal string.

    • tradedInstringrequired

      What actually reaches the curve — amountIn less protocolFee. Decimal string.

    • amountOutstringrequired

      What comes back. Decimal string.

    • totalFeestringrequired

      Every fee the swap pays, on the input side. Decimal string.

    • spotBeforenumber · doublerequired

      Pre-trade price, ignoring fees and depth

    • spotAfternumber · doublerequired

      Price once the swap lands, ignoring fees

    • executionPricenumber · doublerequired

      Output per unit of input, fees and depth included

    • priceImpactnumber · doublerequired

      How far execution fell short of the pre-trade price, as a fraction

    • isExecutablebooleanrequired

      False when the pool would reject the swap — nothing reaches the curve, or the output would meet or exceed the reserve it is drawn from.

  • executorFeestringrequired

    The executor fee applied, the request's or the client's default. Decimal string.

  • maxMinerFeestringrequired

    The miner fee cap applied. Decimal string.

  • netOutputstringrequired

    What the owner receives if the order fills against the current pool: swap.amountOut, less executorFee when selling the token. Negative when the fee exceeds the output, and such an order cannot fill. Decimal string.

  • totalErgRequiredstringrequired

    nanoERG locked in the order box: ergReturned, plus amountIn and executorFee when selling ERG. Decimal string.

  • ergReturnedstringrequired

    nanoERG of totalErgRequired returned to the owner with the fill. Decimal string.

  • networkFeestringrequired

    nanoERG paid to place the order. Decimal string.

400Malformed body, a non-positive `amountIn`, or a `maxMinerFee` not below `executorFee`.ApiError▶
  • errorintegerrequired

    Error code

  • reasonstringrequired

    Error message explaining the reason of the error

  • detailstringrequirednullable

    Detailed error description

503Node unavailable. Retry.ApiError▶
  • errorintegerrequired

    Error code

  • reasonstringrequired

    Error message explaining the reason of the error

  • detailstringrequirednullable

    Detailed error description

defaultErrorApiError▶
  • errorintegerrequired

    Error code

  • reasonstringrequired

    Error message explaining the reason of the error

  • detailstringrequirednullable

    Detailed error description

← PreviousList your outstanding ordersNext →Place a swap order
Request
curl -X POST "http://localhost:9000/dex/orders/swap/check" \
  -H "Content-Type: application/json" \
  -d '{ "amountIn": "1000000000", "ergIn": true, "executorFee": "3000000", "maxMinerFee": "1000000" }'
Response
{
  "swap": {
    "ergIn": true,
    "amountIn": "1000000000",
    "protocolFee": "1500000",
    "ammFee": "1497750",
    "tradedIn": "998500000",
    "amountOut": "30124883",
    "totalFee": "2997750",
    "spotBefore": 0.0302,
    "spotAfter": 0.0301,
    "executionPrice": 0.0301,
    "priceImpact": 0.0031,
    "isExecutable": true
  },
  "executorFee": "3000000",
  "maxMinerFee": "1000000",
  "netOutput": "30124883",
  "totalErgRequired": "1004000000",
  "ergReturned": "1000000",
  "networkFee": "2000000"
}