# Essey on Sui > A lending market on Sui testnet for people and their agents: public lending (SUI collateral, USDC loans), private loan rooms and sealed sale rooms in USDC, Sui Dollar (tUSDsui) and SUI. Everything on this site runs on Sui testnet only. Network: Sui testnet, chain id 69WiPg3DAQiwdxfncX6wYQ2siKwAe6L9BZthQea3JNMD. Sui mainnet is not available. Hand this file and https://essey.xyz/docs/for-your-agent to an agent. That page walks every supported testnet flow over the SDK, the MCP server and raw HTTP. ## Docs - Hand this to your agent: https://essey.xyz/docs/for-your-agent - Raw HTTP private flows (no Essey SDK or MCP): https://essey.xyz/docs/http/private-flows - Docs index: https://essey.xyz/docs/what-is-essey-on-sui - What we've built and where we're going (verified on testnet today; V3 private-only design, not live): https://essey.xyz/docs/roadmap - Install the SDK and MCP server: https://essey.xyz/docs/sdk/install - Quickstart: https://essey.xyz/docs/sdk/quickstart - EsseyOwner (owner side from a plain wallet key, no browser or passkey): https://essey.xyz/docs/sdk/guides/owner-client - Route reference (request and response body of every public route): https://essey.xyz/docs/api/reference - Link your own agent (one owner approval, key never leaves your machine): https://essey.xyz/docs/sdk/guides/link-your-agent - Private loan flows: https://essey.xyz/docs/sdk/guides/private-flows - Sale rooms: https://essey.xyz/docs/sdk/guides/sale-room - Sealed settlement v2 (sale_room_v2, private_room_v2) walkthrough: https://essey.xyz/docs/sdk/guides/private-flows#sealed-settlement-v2-rooms; every v2 signature: https://essey.xyz/docs/sdk/reference/sealed-settlement-v2 - Network, ids and gas rules: https://essey.xyz/docs/network - Self-serve API reference: https://essey.xyz/developers/api ## Hosted API (testnet) - Base URL: https://sui-agent-prototype-production.up.railway.app — the root path returns 404. Open https://sui-agent-prototype-production.up.railway.app/healthz or https://sui-agent-prototype-production.up.railway.app/v1/config. - Public ids and limits: GET /v1/config. Save it to a file; it is the SDK's deployment record (ESSEY_DEPLOYMENT) as is. Its `kill.on` field is true when the service has stopped building transactions. - Private-flow ids (packages, Access, PassKey, loan markets, shielded pools, Seal servers, relayer): GET /v1/private/config. Save it to a file; it is the MCP server's ESSEY_PRIVATE file as is. Its saleRoomV2 and privateLoanV2 sections are the sealed-settlement rooms (sale_room_v2 0xeeacf6d88596fedfdcd66cc6510c3c84e08d249bdb1d2b956f3c931a33feb714, private_room_v2 0x5e2dbc14e6687bb550e2f69fcdd328c21b252fdcf9c9dddce0f8aa33f37e9050, each with its SettleVerifier id): on-chain Groth16 verification of the selection, only the winner and the winning price or rate revealed. - Health: GET /healthz - Relayer for shielded transactions: https://essey-relayer-production.up.railway.app/healthz (the root path returns 404; GET /healthz lists kinds; POST /relay/sui, /relay/usdc, /relay/usdsui). Kinds: bid, withdraw, loan_offer, settle_relayed, repay, bid_v2, loan_offer_v2, settle_relayed_v2. There is no repay_v2. Every body is in https://essey.xyz/docs/api/private. Fee floors on the hosted relayer: 10000000 on /relay/sui and 10000 on /relay/usdc and /relay/usdsui. A short fee answers "fee below MIN_FEE". ## Packages (npm) - @esseyonsui/sui-sdk 0.1.12: https://www.npmjs.com/package/@esseyonsui/sui-sdk (v1 saleBidTx is the live 7-argument room::bid, the pool-bid credential is required, SUI deposits and v2 collateral come from the address balance, and the SDK has v2 cancel/expire/liquidate/claimDefault builders, recoverRoomNote, per-package abort names including ENotDue, readingFor, and suiFaucetError. There is no relayer kind repay_v2. A v2 loan repays a public coin with repayCoinV2Tx.) - @esseyonsui/sui-mcp 0.1.16: https://www.npmjs.com/package/@esseyonsui/sui-mcp (commands: essey-sui-init, essey-sui-mcp; 0.1.16 depends on sui-sdk 0.1.12. The server requires an agent key file before it starts, even to list its tools. It reads the path only from ESSEY_AGENT_KEY_FILE. That variable is required and has no default. From the project that installed the packages, `node --input-type=module -e "import { createAgentKeyFile } from '@esseyonsui/sui-sdk'; console.log(createAgentKeyFile('agent.env', 'testnet'))"` writes a mode-600 testnet file and prints the new address. Point the server at it with ESSEY_AGENT_KEY_FILE=agent.env. essey-sui-init --key writes the same kind of file when that path is missing. It keeps loanMarkets oraclePkg, feed and reader from a saved GET /v1/private/config, so essey_loan_open_v2 takes that file as-is. It accepts a numeric rateBps and bare even-length hex for sealed on the commit tools. essey_loan_repay_v2 repays a public coin. The private tools include essey_shielded_*, essey_prove_pass, essey_sale_*_v2, essey_loan_*_v2, essey_sealed_bid, essey_private_rooms, essey_owner_setup_result, essey_faucet.) - @esseyonsui/testnet-demo 0.2.3: https://www.npmjs.com/package/@esseyonsui/testnet-demo (command: essey-testnet-demo). The drivers that ran the self-service demo. The copy published as 0.2.3 depends on older SDK and MCP releases; this repository's documented packages are sui-sdk 0.1.12 and sui-mcp 0.1.16. `npm install @esseyonsui/testnet-demo && npx essey-testnet-demo make-replay-keys ./keys && npx essey-testnet-demo check`, then `sale USDC|SUI|USDSUI`, `loan USDC|USDSUI|SUI`, `public-lending`, `mcp-tools`, `loan-cancel`, `loan-default`, and the sealed-settlement v2 drivers `settle-keys`, `sale-v2`, `sale-v2-probes`, `loan-v2`, `observe-v2`; its README has the order and the funding each flow needs. Every step is logged with its digest to ./evidence. - Node 22 or newer. Install with this root package.json, then npm install. A bare `npm install @esseyonsui/sui-sdk@0.1.12 @esseyonsui/sui-mcp@0.1.16` prints three high advisories from underscore 1.13.6 (snarkjs 0.7.6 → bfj → jsonpath, GHSA-qpx9-hpmf-5gmw). The override below is the fix. snarkjs groth16.fullProve does not call bfj. ```json { "dependencies": { "@esseyonsui/sui-sdk": "0.1.12", "@esseyonsui/sui-mcp": "0.1.16" }, "overrides": { "underscore": "1.13.8" } } ``` ## Proving keys (TEST-ONLY, single-party setup) - Manifest: https://cdn.jsdelivr.net/npm/@esseyonsui/proving-keys-testonly@0.1.0/manifest.json (the npm package served file by file; `npm pack @esseyonsui/proving-keys-testonly@0.1.0` gives the same bytes) - Package: https://www.npmjs.com/package/@esseyonsui/proving-keys-testonly - Settle(16) key for the v2 rooms (sellers and borrowers settle with a proof; losing bids and offers stay sealed): https://cdn.jsdelivr.net/npm/@esseyonsui/settle-keys-testonly@0.1.0/manifest.json plus settle/settle.wasm, settle/settle.zkey, settle/vkey.json in the same folder; download and verify with the SDK's fetchSettleKeys({ baseUrl, dir }), load again later with settleProvingKeys({ dir }); settleProver({ wasm, zkey }) proves with them. Sui VK hash 4ffdaf5a4880767bdf59b01c0e42563b3887549b5de6b878d4f219b168944008, equal to VK_HASH in both v2 packages. - Fetch and verify the membership and spend keys with the SDK's fetchProofBundle({ baseUrl, dir }). It refuses any file whose sha256 differs from the manifest, and any verifying key whose Sui hash is not the deployed constant: membership af823c60f9959d902021bcf43bf5aec7884810b2c24b679344dcc0b32bbe7ed1, spend e716c637852376cfaf1461b00ffab9ff1086a5c6a9a1b772560fcf95677ea630. Given the settle manifest it refuses by name: use fetchSettleKeys. ## Test coins - SUI for gas: Essey does not host a SUI drip. POST /v1/faucet/sui returns SUI_FAUCET_EXTERNAL. Install the CLI first: `brew install sui` on macOS; Cargo from source or a release binary otherwise. https://docs.sui.io/guides/developer/getting-started/sui-install is the install page (`suiup install sui@testnet` is its recommended installer). Then `sui client faucet --url https://faucet.testnet.sui.io --address
`. Humans use https://faucet.sui.io. Mysten's HTTP route POST https://faucet.testnet.sui.io/v2/gas returns compatibility_disabled, so do not call it. A grant is about 1 SUI into the address balance, which shielded deposits and v2 collateral spend directly. On a rate limit, wait and retry that address, or use another address. The SUI pool insert fee is 0.1 SUI per deposit. A pool bid or loan offer pays it twice more (change note and refund note), so a small SUI bid needs ~0.212 SUI already in the pool (0.002 max price + 0.01 relayer fee + 0.2) plus 0.1 SUI to deposit that note. One 1 SUI drip covers a bidder's deposit, or a seller's open, attest and finish (finish and settle each reserve a 0.25 SUI gas budget, which must be in the address balance or one coin). One address running a full SUI sale and a full SUI loan also deposits ~0.55 SUI for a note large enough for both spends and repays owed plus another 0.1 SUI, which is more than one drip: request the faucet again. - tUSDsui (Sui Dollar, the headline private-loan coin): POST https://sui-agent-prototype-production.up.railway.app/v1/faucet/usdsui with body {"address":"0x..."}; 10 tUSDsui once per address per day. Amount and limits at GET /v1/faucet. - USDC: POST https://sui-agent-prototype-production.up.railway.app/v1/faucet/usdc with body {"address":"0x..."} (2 USDC, once per address per day, 5 per IP per hour, 50 per day, from a reservoir the operator refills at Circle's testnet faucet; the live reservoir balance is in GET /v1/faucet). When the reservoir holds less than one amount (available in GET /v1/faucet), the POST answers 503 RESERVOIR_EMPTY and includes refill, the Circle route; retry later or ask the operator. A multi-actor run needs a distinct address per actor per day, or Circle directly: https://faucet.circle.com network "Sui Testnet", 20 USDC per address every 2 hours, a browser form behind reCAPTCHA, made for a person (coin type 0xa1ec7fc00a6f40db9693ad1415d0c193ad3906494428cf252621037bd7117e29::usdc::USDC). - Hosted agents: maxAgentsPerUser is 3. A self-run agent counts as soon as it is claimed, before its treasury exists. Revoke an agent to free a slot, or run more agents on chain yourself (ESSEY_TREASURY / ESSEY_AGENT_CAP). The cap is not raised on testnet. - v2 private loan grace_ms is 300000 (claim_default is maturity + grace; abort 16 is ENotDue). settle window is 86400000 ms. GET /v1/private/config publishes graceMs and settleWindowMs, and loanMarkets.SUI.oraclePkg 0x373a36f16e0309ea7cb9f02715a4b60ad77626ccfa177834c4dbe392078f186e with reader pyth_oracle::read_inverse. - The v1 private loan room is deprecated: its settle publishes every losing rate. Use private_room_v2. - MCP startup: the server requires an agent key file before it starts, even to list its tools. It reads the path only from ESSEY_AGENT_KEY_FILE. That variable is required and has no default. From the project that installed the packages, `node --input-type=module -e "import { createAgentKeyFile } from '@esseyonsui/sui-sdk'; console.log(createAgentKeyFile('agent.env', 'testnet'))"` writes a mode-600 testnet file and prints the new address. Point the server at it with ESSEY_AGENT_KEY_FILE=agent.env. essey-sui-init --key writes the same kind of file when that path is missing. - MCP private rooms: the first private call can take up to a few minutes on the first download of the proving keys. Once those keys are cached it is much shorter. Call essey_shielded_scan once before opening or offering, and set offerWindowMs to at least 600000. An offer after that window aborts 8 in room::admit_offer (offer after the offer window closed). ESSEY_SHIELDED_STATE is the mode-600 seed file. ESSEY_STATE is the optional file essey_owner_setup_result writes; the server does not reload it. ESSEY_TREASURY is optional: with no treasury, only the private tools run. - essey_loans lists open loans for a borrower and a lender. includeClosed also lists closed ones; a repaid lender loan can show owed "0". essey_borrow, essey_repay and essey_refinance return loanId with ok and digest. A second repay of a repaid loan is refused before signing with borrower::release abort 2 ENoDeed (SDK and MCP); the hosted owner repay answers 404 NO_SUCH_LOAN. A borrower owner withdraw with no amount, while a loan is open, leaves cash at the open loans' owed plus the cash float and refuses LOAN_OPEN if nothing above that can be taken. essey_shielded_withdraw refuses amount <= the relayer fee with ZERO_WITHDRAW before proving. essey_shielded_recover returns the note's coin; a default is the seized collateral, and warning is set when that differs from the coin you passed. EsseyOwner.sign of claim-default allows the published Pyth package. - By design: refinancing into a higher-rate offer is allowed on chain. market poolMaxRateBps does not cap a lender's offer; only the borrower's maxRateBps does. Adding collateral counts against the SUI cap's spent24h. essey_sale_bid_v2 echoes the caller's own price in the result; that price is not on the bid, so avoid logging the result. essey_loan_offer_v2 echoes the caller's own rateBps the same way: a lender that wants its rate kept sealed keeps tool results out of its logs. The seller finishes a v2 sale, the winner claims, and a loser collects. In a v2 loan room the borrower settles and the lender recovers. - Public loan default: a self-run borrower (SDK or MCP, not the hosted desk) can take a short-term offer in the same session. Post an offer with a short termMs (for example 300000), have that borrower accept it, then collect the default after termMs + grace_ms (public loan grace_ms is 300000). A hosted borrower will not take an offer shorter than 6 hours (21600000 ms), so only that path needs a second session after the term and the grace. Liquidation needs the live Pyth price to move the loan underwater. There is no test-price market. - GraphQL for debugging: https://graphql.testnet.sui.io/graphql. The public fullnode JSON-RPC is deprecated. The SDK talks gRPC. - Call POST /v1/borrow/quote or the MCP tool essey_quote before borrowing. A size the oracle LTV refuses is EOverMarketLtv. room-open settleWindowSeconds minimum is 120. ## Gas Transactions the hosted API builds for a signed-in user are sponsored by the operator. An agent you run yourself pays its own gas from SUI at its address, in one of two modes. Address balance (`gas: "address-balance"`, the SDK's `EsseyAgent` default; `ESSEY_GAS=address-balance` for the MCP server): the transaction names no gas coin and the node takes the gas from the address balance. The public Sui testnet faucet credits that balance, not a coin object (its reply reads "sent 1 SUI to the address balance"), so faucet SUI pays in this mode as it is. Coins (`gas: "coins"`; the MCP server's default, `ESSEY_GAS=coins`): the SDK picks one SUI coin object at the address holding at least 50,000,000 MIST (one transaction's budget) and throws `NO_COINS` before signing when there is none. The faucet makes no such coin; the owner's `fundGas(chain, agentAddress, mist)` sends one. Wallet calls (`executeAsWallet`: a seller, a depositor) pick the mode themselves with `walletGasMode(client, owner, budget)`: a coin that covers the budget when the wallet holds one, else the address balance. Sale-room calls are never sponsored.