LithosDocs
ProtocolPayoutsTokenStatsDocs
Start mining
Documentation home
Protocol
  • Lithos Protocol
  • LFSM
    • Rollups
    • NISPs
    • Emissions
    • Mining on Lithos
    • Candidate building
    • Ergo Voting
  • LithosDex
    • Choosing a pool
    • Trading with orders
    • Providing liquidity
    • Creating a pool
    • Difficulty forwards
    • SigmaFi bonds
Run Lithos
  • Startup guide
    • Setting up an Ergo 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
    • Renting hashrate into Lithos
    • Checking your wallet
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
    • getThis wallet's lending earnings
    • getLocal mining activity
    • getCollateral market snapshot
    • getList queue boxes
    • getList the active set
    • getPermit price history
    • getYour lending status
    • postQuote joining the queue
    • postJoin the collateral queue
    • getLithosDex pool state
    • getEvery LithosDex pool
    • getOne LithosDex pool and its vault
    • getList your outstanding orders on any pool
    • postQuote a direct swap on any pool
    • postSwap directly on any pool
    • postQuote a direct deposit on any pool
    • postDeposit directly on any pool
    • postQuote a direct redemption on any pool
    • postRedeem a provision directly on any pool
    • getList your provisions on any pool
    • postClaim a provision's fees on any pool
    • postCheck a flush on any pool
    • postFlush any pool
    • getA verified pool's price history
    • getA verified pool's fee history
    • getA verified pool's recent activity
    • getA provision's fee history on a verified pool
    • postQuote a new LithosDex pool
    • postCreate a LithosDex pool
    • postQuote a swap order on any pool
    • postPlace a swap order on any pool
    • postQuote a deposit order on any pool
    • postPlace a deposit order on any pool
    • postQuote a redeem order on any pool
    • postPlace a redeem order on any pool
    • 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
    • postLook up provision NFTs
    • 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
    • getDifficulty accumulator and the next epoch's difficulty
    • getList open offers
    • postCreate an offer
    • postQuote an offer
    • postQuote filling an offer
    • postFill an offer
    • postQuote cancelling an offer
    • postCancel an offer
    • getThe whole market
    • getYour settled positions and closed offers
    • getList your positions and offers
    • postQuote settling a position
    • postSettle a position
    • getList open orders
    • postCreate an order
    • postQuote an order
    • postQuote cancelling an order
    • postCancel an order
    • postQuote filling an order
    • postFill an order
    • getList live bonds
    • postQuote repaying a bond
    • postRepay a bond
    • postQuote liquidating a bond
    • postLiquidate a bond
    • postQuote a claim
    • postClaim a settled bond
    • postLook up bond assets
    • getThis wallet in SigmaFi
    • getList configured oracle feeds
    • getCurrent oracle state and recent confirmed history
    • getWallet balances
    • getYour block rewards
    • postClaim unlocked block rewards
    • getVerified tokens
    • getArb stake
    • postReclaim the arb stake
    • 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
  • Difficulty forwards
  • Client API
  • Failure modes
Network
  • Live stats
  • Public stats API
  • Ergo Platform↗
  • SOAT Miner↗
Community
  • Telegram↗
  • X / Twitter↗
  • GitHub↗
Lithos
© 2026 Lithos Protocol. The Lithos client, its contracts and Lithos Launcher are open source under CC0.λίθος — stone
Docs/Client API/Lithos Dex

Place a swap order

post/dex/orders/swapapi_key

Lock amountIn in an order that any miner can fill for executorFee. It fills only if the owner receives at least minOutput, measured against the pool when it executes, and waits otherwise. Cancel it with POST /dex/orders/{boxId}/cancel.

Request body

LDSwapOrderExecuteRequest · application/json
  • amountInstringrequired

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

  • ergInbooleanrequired
  • minOutputstringrequired

    Least the owner receives: tokens when selling ERG, or nanoERG after executorFee when selling the token. Checked against the pool when the order fills. Required and must be positive. Decimal string.

  • executorFeestring

    nanoERG paid to whoever fills the order. 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

200The placement transaction and the order it createdLDOrderPlacementResult▶
  • outcomestringrequired

    Node submission outcome; uncertain retains the known transaction ID and input ownership.

    one ofacceptedrejecteduncertain
  • txIdstringrequired
  • ▶
    orderLDOrderrequired

    An outstanding LithosDex order owned by this wallet. Which term fields are present depends on type.

    • boxIdstringrequired

      Order box id. Pass it to POST /dex/orders/{boxId}/cancel.

    • typestringrequired
      one ofSWAPDEPOSITREDEEM
    • statusstringrequired

      PENDING: the placement is unconfirmed. OPEN: placed and waiting for a fill. FILLING: an unconfirmed transaction fills it. CANCELLING: an unconfirmed transaction cancels it. Only PENDING and OPEN orders can be cancelled.

      one ofPENDINGOPENFILLINGCANCELLING
    • placementTxIdstringrequired

      Transaction that created the order box

    • placedHeightinteger · int32

      Height the placement confirmed at. Absent while it is unconfirmed.

    • spendingTxIdstring

      The unconfirmed transaction filling or cancelling the order. Present when FILLING or CANCELLING.

    • ownerstringrequired

      Address that receives the fill, and the only key that can cancel

    • valuestringrequired

      nanoERG held by the order box. Decimal string.

    • executorFeestringrequired

      nanoERG the order pays whoever fills it. Decimal string.

    • maxMinerFeestringrequired

      Most nanoERG a fill may pay as a miner fee, out of executorFee. Decimal string.

    • ergInboolean

      SWAP only. True when selling ERG for the token.

    • tokenInstring

      A token/token SWAP only: the token sold.

    • amountInstring

      SWAP only. nanoERG or raw token units sold into the pool. Decimal string.

    • minOutputstring

      SWAP only. Least the owner receives: tokens when selling ERG, or nanoERG after executorFee when selling the token. Decimal string.

    • amountXstring

      DEPOSIT only. Most nanoERG offered to the reserves. Decimal string.

    • amountYstring

      DEPOSIT only. Raw token units offered. Decimal string.

    • minSharesstring

      DEPOSIT only. Fewest shares the order accepts. Decimal string.

    • ownerNFTstring

      REDEEM only. Ownership NFT of the provision the order closes.

    • provisionBoxIdstring

      REDEEM only. Current box of that provision. Absent when it cannot be found.

    • fillableNowbooleanrequired

      Whether the order would fill against the current pool. False when the pool cannot meet the order's minimum or refuses it; the order waits until that changes or it is cancelled. Always true while FILLING and false while CANCELLING.

  • claimedXstring

    REDEEM only. Settled ERG fees the placement claimed. Decimal string.

  • claimedYstring

    REDEEM only. Token side of claimedX. Decimal string.

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

    Error code

  • reasonstringrequired

    Error message explaining the reason of the error

  • detailstringrequirednullable

    Detailed error description

422The wallet cannot cover the order.ApiError▶
  • errorintegerrequired

    Error code

  • reasonstringrequired

    Error message explaining the reason of the error

  • detailstringrequirednullable

    Detailed error description

503Node or wallet 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

← PreviousQuote a swap orderNext →Quote a deposit order
Request
curl -X POST "http://localhost:9000/dex/orders/swap" \
  -H "api_key: $LITHOS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "amountIn": "1000000000", "ergIn": true, "minOutput": "29974258", "executorFee": "3000000", "maxMinerFee": "1000000" }'
Response
{
  "outcome": "accepted",
  "txId": "40b7d045a858d537cdbf072e46ffbb86c0c9f6b0e93c369c1ffcba76797636d7",
  "order": {
    "boxId": "5035b2e112b4f5b873dd3444c01df1e7e697807fd84fe96790eacb128e46428d",
    "type": "SWAP",
    "status": "OPEN",
    "placementTxId": "40b7d045a858d537cdbf072e46ffbb86c0c9f6b0e93c369c1ffcba76797636d7",
    "placedHeight": 484719,
    "spendingTxId": "9f3c1ab7d2e45806c91f7b3ad4e2091856cbf740e3a92d5178cc0b46e21f5d38",
    "owner": "3WwbzR34YmLRy3Z6WLON5hBBkX8Zm1gUHmC7tEXDNRJfHBqhsZr",
    "value": "1004000000",
    "executorFee": "3000000",
    "maxMinerFee": "1000000",
    "ergIn": true,
    "tokenIn": true,
    "amountIn": "1000000000",
    "minOutput": "29974258",
    "amountX": "5000000000",
    "amountY": "152000000",
    "minShares": "1170587",
    "ownerNFT": "a1f4c2e8b7d93052416fbc8e07d21935a8c4f60b2e91d7385c06a4b1f2e83d97",
    "provisionBoxId": "ce00d6e0f4fd3390c0519bb0d24824e1e6b06978163f4845a7cf2c1c7d8f1b65",
    "fillableNow": true
  },
  "claimedX": "253000000",
  "claimedY": "7690000"
}