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
  • SigmaFi
    • Borrowing
    • Lending
    • Trading bonds and shares
    • The Lithos client and panel
      • Contracts
      • zcs1 off-chain standard
      • Pricing
      • Building on the Lithos API
    • Difficulty forwards
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
    • getZC market info
    • getList asks
    • getList lend offers
    • getBid and ask curves
    • getOrder book
    • getFill history
    • getWhat a box would match
    • postSimulate a draft
    • getOpen auctions
    • getLook up an id
    • getSearch by id prefix
    • postDescribe tokens
    • getThis wallet in ZC
    • getThis wallet's ZC activity
    • postCreate an order (quote)
    • postCreate an order
    • postCreate a lend offer (quote)
    • postCreate a lend offer
    • postCreate an ask (quote)
    • postCreate an ask
    • postCreate a lot auction (quote)
    • postCreate a lot auction
    • postFill an order (quote)
    • postFill an order
    • postBuy from an ask (quote)
    • postBuy from an ask
    • postBuy a lot (quote)
    • postBuy a lot
    • postBuy a vault auction (quote)
    • postBuy a vault auction
    • postPull a settled bond (quote)
    • postPull a settled bond
    • postFractionalize a bond unit (quote)
    • postFractionalize a bond unit
    • postRepay a bond (quote)
    • postRepay a bond
    • postAdd collateral (quote)
    • postAdd collateral
    • postLiquidate a bond (quote)
    • postLiquidate a bond
    • postExtinguish a bond (quote)
    • postExtinguish a bond
    • postClaim a settled bond (quote)
    • postClaim a settled bond
    • postWrap a token (quote)
    • postWrap a token
    • postUnwrap (quote)
    • postUnwrap
    • postRun a mint (quote)
    • postRun a mint
    • postCancel a box (quote)
    • postCancel a box
    • 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
    • postResume arb after a reclaim
    • 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/Protocol/SigmaFi/For developers

Building on the Lithos API

Reading the SigmaFi book and sending SigmaFi transactions through a Lithos client's /sigmafi/zc API, with the check-then-send pattern, limits, outcomes and examples.

Advanced9 min readAssumes you can send HTTP requests and read JSON, and have read the SigmaFi overview.

Every Lithos client serves SigmaFi under /sigmafi/zc/. The client tracks every ZC box from its Ergo node, follows the zcs1 off-chain standard, and signs with its own wallet, so a script can read the book and trade without building transactions itself. This page explains how the API behaves and walks through common flows. Every field of every route is in the API reference, under SigmaFi ZC Standard.

Before you start#

You need the following:

  • A running Lithos client with sigmafi.zc.enabled = true, which ships on. With it off, every /sigmafi/zc route answers 503.
  • The client's address. The client listens on port 9000, so a local client is at http://localhost:9000.
  • For anything that signs or reads your wallet, the client's API key, sent in the api_key header. Setting the key is covered in Node connection and security.

The following need no key: every read of the book, POST /sigmafi/zc/assets, POST /sigmafi/zc/simulate and every /check preview that does not read your wallet. The following need the key: GET /sigmafi/zc/portfolio, GET /sigmafi/zc/activity, every write that sends, and the /check previews of repay, add collateral, extinguish, claim, wrap, unwrap and cancel, since each reads what your wallet holds.

Danger
The key signs with your wallet

Anyone who holds the API key can spend your client's wallet through these routes. Keep the client's port off the open internet.

Units and identifiers#

The API uses the following conventions:

ValueFormat
AmountsRaw units as integers or integer strings: nanoERG for ERG, cents for SigUSD. Responses send them as strings so no client loses precision
MarketERG or SigUSD, in a path or a body
YieldsInteger basis points per 262,800 blocks
Heights, durationsInteger block heights and block counts
Ids64 hex characters: a box id, a bond token id (the order box id), a share token id or a wrap receipt id

Every read carries at: the height, block id and indexed height its snapshot was taken at, a revision, whether the mempool is laid over the confirmed book, and cut when the book is at its size cap and left boxes out.

Reading the book#

The read routes are the following:

RouteReturns
GET /sigmafi/zc/infoThe snapshot every read answers from: the oracle, each market's contract tree hashes, template hashes and addresses, each expression's hash, the zcs1 defaults and the pinned Sigma-Finance-V2 commit
GET /sigmafi/zc/markets/{market}/asksBorrow orders and asks in one market, each with its quote now, status, checks and borrowedByMe
GET /sigmafi/zc/markets/{market}/offersLend offers with their curves, budgets, current batcher reward and status
GET /sigmafi/zc/markets/{market}/curvesThe best bid line, the ask dots and line, and market totals, computed by the batcher's own rules
GET /sigmafi/zc/markets/{market}/orderbookAsks and bids around a maturity. A bid and an ask are compared only at the same maturity
GET /sigmafi/zc/markets/{market}/fillsNew bonds and ask purchases, newest first, with values at the fill
GET /sigmafi/zc/matches/{id}For an offer, what it would buy now in the zcs1 order. For an order or ask, the offers that would take it
GET /sigmafi/zc/auctionsOpen lot auctions and share-vault auctions, with what a buyer pays now
GET /sigmafi/zc/lookup/{id}Any ZC box, bond token, share token or wrap receipt: its record, the current box of its chain, any pending spend, and its checks
GET /sigmafi/zc/search?q=Open boxes and tokens whose id starts with at least 4 hex characters
POST /sigmafi/zc/assetsUp to 50 token ids, each with its name, decimals and, for SigmaFi tokens, its proven origin
POST /sigmafi/zc/simulateRuns the zcs1 batch with a draft order, offer or ask added, or prices a wallet lend across the best sources
GET /sigmafi/zc/portfolioEvery bond unit and share token your wallet holds, with cost, mark and the actions open now, and the loans you borrow on
GET /sigmafi/zc/activityYour wallet's SigmaFi events, newest first, led by pending ones from the mempool

Lists page with limit, from 1 to 200 and 50 by default, and cursor, the next value of the last page. POST /sigmafi/zc/simulate allows 5 calls at once per caller, then 1 a second, and answers 429 past that.

Polling without waste#

Pass the last at.revision you saw as ifRevision on GET /sigmafi/zc/info. The client answers 304 when nothing any read returns has changed, the mempool included. Re-read the routes you care about only after a 200.

Fill history and wallet history#

GET /sigmafi/zc/markets/{market}/fills reads the client's own fill index, which starts at sigmafi.zc.fillsFromHeight. Its status says how far the index has read:

StatusMeaning
readyThe index has read every block the node has indexed
catching-upThe index is still reading older blocks
loadingThe index has not read its first block yet, including on a chain not yet at the start height
not-configuredfillsFromHeight is 0, so the index is off
disabledZC tracking is off
stale, unavailableA read failed. The index tries again on its next cycle

GET /sigmafi/zc/activity reads your wallet's transactions from the same start height.

Sending a transaction#

Every write is a pair of routes: .../check and the send. Both take the same body.

  1. Check. POST .../check returns a quote and signs nothing. The quote lists what you pay and receive, every fee and whether it is spent, locked, refundable or earned, every output that does not come to you, the resolved terms, the heights it is valid through, warnings, and refusals. A write that cannot run now answers 200 with its refusals filled in.
  2. Send. POST the same body to the send route. The client rebuilds the transaction from current state, checks it, signs it and sends it.

Put limits in the send body to bound what the rebuilt transaction may do. maxPay is the most it may take from you and minReceive the least it must give you, in the action's market unit, with the miner fee included for ERG. If the rebuilt transaction falls outside them, the send answers 409 and sends nothing. Copy the bounds from the quote you approved.

A send answers with txId, the first output's boxId, the minted assetId for a fill, warnings, and an outcome:

OutcomeMeaning
acceptedThe node accepted the transaction into its mempool
rejectedThe node refused it. The reason is in the response
uncertainThe node did not answer clearly. Check GET /sigmafi/zc/activity or the transaction id before sending again
heldThe write reads the box a pending oracle refresh creates, and a miner could reach the write first. Nothing was sent yet. The client retries every 30 seconds for 10 minutes, rebuilt and checked against limits each time. retriesUntil says when it stops. A held write lives in memory, so a restart drops it

The error statuses are the following:

StatusMeaning
400A malformed field, or terms the contracts refuse
403A missing or wrong api_key
404No such box or token, or not your wallet's
409A pending transaction already spends a box this needs, or the rebuild fell outside limits. Check again, then resend
422Valid but not possible now. The message is the reason /check lists in refusals
503ZC tracking is off or not seeded, or the node, its index or the wallet did not answer. Nothing was sent

The write routes#

The write routes are the following. Each has a /check twin at the same path plus /check:

RouteAction
POST /sigmafi/zc/ordersPost a borrow order
POST /sigmafi/zc/offersPost a lend offer
POST /sigmafi/zc/asksList bond units or shares for sale
POST /sigmafi/zc/lotsPost a lot auction
POST /sigmafi/zc/orders/{boxId}/fillFill an order from your wallet
POST /sigmafi/zc/asks/{boxId}/buyBuy from an ask
POST /sigmafi/zc/lots/{boxId}/buyBuy a lot at its current price
POST /sigmafi/zc/vaults/{boxId}/buyBuy an open share-vault auction
POST /sigmafi/zc/vaults/{boxId}/pullPull a settled loan into its share vault, keeping the pull fee
POST /sigmafi/zc/bonds/{assetId}/repayRepay a loan, optionally from its collateral
POST /sigmafi/zc/bonds/{assetId}/recollateralizeAdd collateral
POST /sigmafi/zc/bonds/{assetId}/liquidateLiquidate a loan the rule allows, keeping the fee reserve
POST /sigmafi/zc/bonds/{assetId}/extinguishClose your own loan with its circulating unit
POST /sigmafi/zc/bonds/{assetId}/fractionalizePut a bond unit into a share mint request
POST /sigmafi/zc/claims/{tokenId}Claim a settled loan with its unit or shares
POST /sigmafi/zc/wrapsWrap a token
POST /sigmafi/zc/wraps/{receiptId}/unwrapUnwrap a token
POST /sigmafi/zc/mints/{boxId}Run a pending share or wrap mint, keeping the mint fee
POST /sigmafi/zc/boxes/{boxId}/cancelCancel an order, offer, ask, lot or request you made

Example: posting an order#

The following body asks for a 10 ERG loan repaying 10.5 ERG at a fixed maturity about 60 days out, against 25 ERG of collateral, liquidated at a 150% oracle ratio:

order.json
json
{
  "market": "ERG",
  "principal": "10000000000",
  "repayment": "10500000000",
  "timing": { "mode": "fixed", "blocks": 43200 },
  "collateral": { "nanoErg": "25000000000", "tokens": [] },
  "rule": { "kind": "oracle", "ratioBps": 15000 }
}

The body's fields are the following:

FieldMeaning
principal, repaymentnanoERG
timingblocks from now, snapped to the 21,600-block grid. Add "exact": true to keep the height, or use { "mode": "term", "duration": ... } or a window
ruleThe oracle rule at 150%. Its oracle age defaults to 60 blocks, and the fill guard defaults to the same ratio

Preview it, then send it with the API key:

bash
curl -s -X POST http://localhost:9000/sigmafi/zc/orders/check \
  -H "Content-Type: application/json" -d @order.json
 
curl -s -X POST http://localhost:9000/sigmafi/zc/orders \
  -H "Content-Type: application/json" -H "api_key: YOUR_API_KEY" -d @order.json

The quote's terms show the snapped maturity and the expiry, fees show the 0.005 ERG expiry fee as refundable, and matchesNow shows the simulation of this order against the book: which offers would fill it now.

Example: lending to the best order#

To lend from your wallet, do the following:

  1. Read GET /sigmafi/zc/markets/ERG/asks and pick an order. Each listing's quote gives its yield and principal now, and its checks say whether the client could prove it.
  2. Call POST /sigmafi/zc/orders/{boxId}/fill/check with {}, or with maturity for a window order.
  3. Confirm the quote's paysNanoErgs and that refusals is empty.
  4. Send POST /sigmafi/zc/orders/{boxId}/fill with the same body and limits, for example {"limits": {"maxPay": "10060000000"}}.

The response's assetId is your new bond token. GET /sigmafi/zc/activity shows the fill while it is pending, and GET /sigmafi/zc/portfolio lists the unit.

Example: claiming when a loan ends#

Read GET /sigmafi/zc/portfolio. A settled holding lists a claim among its open actions. Call POST /sigmafi/zc/claims/{tokenId}/check with the bond token or share token id. For shares, a quote with requires: ["pull"] or requires: ["auction"] names what must happen first. Anyone can run the pull with POST /sigmafi/zc/vaults/{boxId}/pull, and batchers do so for the fee.

Next steps#

  • API reference: every route's request and response schema.
  • The zcs1 off-chain standard: the rules the client follows when it builds for you.
  • ZC Standard contracts: the boxes behind every record the API returns.
  • The Lithos client and panel: the panel built on these same routes.
Edit this page on GitHubsynced from 8d4d4d8
← PreviousPricingNext →Difficulty forwards
On this page
  • Before you start
  • Units and identifiers
  • Reading the book
  • Polling without waste
  • Fill history and wallet history
  • Sending a transaction
  • The write routes
  • Example: posting an order
  • Example: lending to the best order
  • Example: claiming when a loan ends
  • Next steps