Hushd for developers
Private OTC, as a package
The same TypeScript the desk runs on: private balances, sealed requests, atomic settlement, proofs to one named reader and private x402. Real proofs, checked on chain by NEAR.
Get the code
github.com/ArhamKhan117/HushdThen, in a clone of it
Five calls to a private trade
Build the request, open it on the desk, wait for the enclave, check the terms, settle. Proofs are made where the code runs, and the SDK never holds a NEAR key.
- Build the sealed requestpackageRequest
- Commit it, send the asksopenRfq
- Wait for the matchawaitMatch
- Check the termscheckMatchedTerms
- Settle your legsettleAsTrader
import {
awaitMatch, checkMatchedTerms, DeskApi, openRfq, packageRequest,
RelayerClient, settleAsTrader, TESTNET, type PackageDraft,
} from "@hushd/sdk";
const api = new DeskApi(TESTNET.api);
const relayer = new RelayerClient(TESTNET.api);
// 1. The request, with your limit: sealed to the enclave only.
const draft: PackageDraft = {
kind: "spot",
sell: { token: "usdc.hushd.testnet", amount: 100_000_000n },
buy: { token: "wnear.hushd.testnet", minAmount: 0n },
};
const { request, ask, refundBlinding, dealIdentity } = packageRequest(identity, TESTNET, draft);
// 2. Commit its hash on chain; each maker gets the ask, sealed to it.
const { rfqId } = await openRfq({ net: TESTNET, api, relayer, request, ask, windowMs: 45_000 });
// 3. The enclave's match, sealed to this deal's one-time address. Check it is what you asked for.
const match = await awaitMatch(api, dealIdentity, rfqId);
checkMatchedTerms(match.terms, draft);
// 4. Approve the four outputs, prove your leg; both legs settle in one pool call,
// then the note the maker paid to the one-time address moves into your balance.
await settleAsTrader({
net: TESTNET, api, wallet, refundBlinding,
dealId: match.dealId, terms: match.terms, makerAddress: match.maker_address,
});Everything the desk does, in one import
Pure TypeScript that runs in the browser and on a server, with the prover passed in so you choose where proofs are made.
Private balance
Notes only the holder can spend: add privately, send to a hushd1… address, cash out to any NEAR account.
The desk, for traders
Seal a package request to the enclave, commit it on chain, wait for the match and settle your leg.
The desk, for makers
Open the asks sealed to you, sign quotes with your quote key, and settle the deals you win.
Proofs to one reader
A payment, funds held or desk volume, for one named NEAR account until it expires. Check them the same way.
Plain-language intake
Turn a trader's words into a draft package on NEAR AI Cloud, encrypted end to end, with the TEE's signature checked.
Private x402
Pay a 402 from a private balance, or charge for your own API and check each payment on your server.
No code: an MCP server with limits
The MCP server wraps the SDK for any agent. It runs next to the agent with its own seed, proves on that machine, and refuses anything over the caps you set per payment and per day.
- Ask the desk and settle privatelyhushd_trade
- Pay a 402 resource from the private balancehushd_pay_x402
- A proof for one named readerhushd_prove
- Pay a hushd1… address privatelyhushd_send
- Pay anyone as a link they claim, no gashushd_pay_link
- The agent's private balancehushd_balance
- What it may spend, and what is left todayhushd_limits
7 of its 22 tools. All of them
An agent
Pays per call, privately
- GET
A paid resource
Agent asks
- 402
Payment required, scheme hushd
The price and a hushd1… address
Paid privately
From its own balance, inside its limits
- 200
Delivered
After the server checks the note
{
"mcpServers": {
"hushd": {
"command": "pnpm",
"args": ["--silent", "--dir", "/path/to/hushd", "mcp"],
"env": {
"HUSHD_LIMIT_PER_PAYMENT": "USDC=100,wNEAR=50",
"HUSHD_LIMIT_PER_DAY": "USDC=500,wNEAR=250"
}
}
}
}Every part, open source
The contracts, the circuits, the services, the matcher, the app and the SDK all live in one MIT repository. Start from the part closest to what you build.
Testnet only
Every contract runs on NEAR testnet, with test tokens that have no value. No Hushd contract is on mainnet.
Development keys
The circuits' keys come from one phase-2 contribution and a public beacon, not a multi-party ceremony. Nothing is audited yet.
Nothing faked
When a read fails, these pages say so and show no number. Every count on them comes from the chain.