Skip to content
Docs · Kerb Terms and its consumers

How to use Kerb.

Kerb measures how much of a tokenized-stock position could really be sold in X Layer pools and how long a loan must survive before the next deep market, and posts both as credit terms on X Layer mainnet every few minutes. Here is how to use them: as a borrower, from code, from a contract, and from an agent.

Read the whitepaper

Overview

One set of terms, four consumers. Kerb Credit is the reference market that lends against them on testnet. Agents buy a decision-ready credit check for one cent over x402. Any X Layer contract reads them in one call through KerbQuote. Developers read them over REST with no key, or through the SDK and the MCP server.

The rules behind every number are the Kerb Terms Standard, on Methodology. The evidence for every claim is on Proof.

Kerb architecture: X Layer pools, OKX DEX quotes, reference prices and exchange calendars feed the collector and an append-only store; the KTS 0.2 engine computes terms and an input bundle; the attester signs and posts to X Layer mainnet with the Builder Code; a relay mirrors terms to testnet where Kerb Credit lends; contracts, agents and developers read the same terms.
Dashed lines carry data; brass lines are signed posts on chain. The same file is in the README: scripts/architecture-svg.py.

Concepts

Clock
Each tokenized stock follows its underlying market's calendar: NYSE, Nasdaq, NYSE Arca or HKEX with its lunch break, holidays included. KerbClock resolves the same calendar on chain.
Regime
The market-time state of an asset right now: Deep, Normal, Thin, Pre-transition, Reference closed, Recovery, Corporate action, Halted or Stale. The first rule that holds wins.
C(1%)
Executable depth: the largest sale the real X Layer pool absorbs while moving the price at most 1%, found by walking the Uniswap V3 pool tick by tick and cross-checked against the OKX DEX quote. The smaller wins.
Credit Mark
A conservative price per token: the lower of the reference median and the pool price along the whole path to USDG, less a haircut set by the regime. Not a mid-market price.
Carry
The LTV a loan may carry unattended until the next deep session. Its margin below the fixed liquidation line grows with how long it must survive (KTS 0.2).
Session Max
More borrowing now, with a promise: at Last Call the position returns to its Carry target. Its margin only has to reach the cure deadline.
Last Call and cure
A window before the market weakens. A Session Max position above its Carry target must be cured back to it; after the owner, anyone may cure it for a small bonus in collateral, and only the difference is repaid.
Liquidation threshold
Fixed per asset at listing and timelocked. Sessions move borrowing capacity and the covenant, never the line under a live borrower.
Debt ceiling
Market-wide debt capacity, a multiple of measured C(1%). It tightens at once when depth falls and loosens in small steps after a cooldown.

Borrow and cure on Kerb Credit

  1. Open Credit and connect a browser wallet; the page adds X Layer testnet (1952).
  2. Get test OKB for gas from the X Layer faucet, then mint mirror collateral and mUSDG with the buttons in Get set up.
  3. Deposit, choose Carry or Session Max, and borrow. The page shows why each limit is what it is.
  4. The demo clock runs a trading week every hour. When its Last Call opens, a Session Max position above its Carry target appears in Curable now. Repay the difference, or let anyone cure it. You can ask the page to notify you, or follow your address on Telegram with @KerbAlertsBot (send /watch and your address).
  5. Follow everything on Your account: holdings, positions, and each borrow, repay and cure.

A standing demo position opens every cycle, so there is always something to cure at a demo Last Call, even on your first visit.

REST and SDK

Public, no key, CORS open. Values are decimal strings with their scale and a provenance label.

shell
curl -s "https://api.usekerb.xyz/v1/terms/196/HKEXCx" | jq '{usable, carryLTV, sessionMaxLTV, debtCeiling}'
curl -s "https://api.usekerb.xyz/v1/terms/196/HKEXCx/why"      # why these terms, with their numbers
curl -s "https://api.usekerb.xyz/v1/exit/196/HKEXCx"           # tick-walk against the OKX DEX quote

Every endpoint, with a real captured response, is in docs/API.md. The TypeScript SDK and live examples are on Developers.

From a contract

KerbQuote reads the posted terms and the clock and returns max borrow, cure deadline and usability in one view call, valuing collateral exactly as Kerb Credit does. It holds nothing and has no owner.

solidity
KerbQuote.Quote memory q = KerbQuote(0x223d5e2a97d751403300b55aa92c88a42920e52a).quoteToken(TOKEN, amount, KerbQuote.Mode.Carry);
require(q.usable, "Kerb: terms not usable");
require(debt <= q.maxBorrow, "Kerb: above Carry capacity");

KerbMarkFeed exposes each asset's Credit Mark behind a Chainlink-shaped latestRoundData with 8 decimals, and reverts whenever the terms are not usable. Live read and the feed addresses.

From an agent

Kerb Credit Check answers how much can be borrowed against a tokenized stock, and until when, for one cent in USDT0 over x402 on X Layer mainnet. Call it without payment to receive a 402 with the requirements; any x402 client signs and retries. Kerb Exit Check prices a sale of any size on the measured pool curve.

curl -i -X POST https://api.usekerb.xyz/agents/credit-check -H 'content-type: application/json' \
  -d '{"asset":"HKEXCx","amount":"100","mode":"session_max"}'

No model is anywhere in the path: the agent buys a computed answer with the transaction and inputs hash that recompute it.

Verify a number

Every post carries the keccak256 of its complete input bundle. Fetch the bundle, check its hash, and recompute the terms:

shell
git clone https://github.com/Franlinozz/Kerb && cd Kerb && pnpm install
pnpm --filter @kerb/engine kerb verify <inputsHash>

Addresses

KerbTerms · X Layer mainnet
0x6d6eaf…0102d5
KerbClock · X Layer mainnet
0xf765d3…2161b8
KerbQuote · X Layer mainnet
0x223d5e…20e52a
KerbMarkFeedFactory · X Layer mainnet
0x6aabab…3d7f6f
KerbCredit · X Layer testnet
0xa13146…0b98a8
KerbClockDemo · X Layer testnet
0xd2483b…6bcb0f

All of them, with Sourcify links: Proof, Contracts.

Limits

Unaudited. The credit plane runs on testnet with mirror collateral; the risk plane is on mainnet and holds no user funds. One attester signs the terms, inside onchain guardrails it cannot loosen. The reference price is issuer data with an independent check, not Chainlink, until credentials exist. Every limit and its rung.

Glossary

KTS
The Kerb Terms Standard: the formula, now version 0.2.
Input bundle
Every observation a post was computed from, canonicalised and hashed; the hash is on chain.
Mirror collateral
Testnet tokens that track a mainnet asset's terms, so credit can be shown without production assets.
mUSDG
The testnet loan asset, a labelled stand-in for USDG.
Builder Code
An ERC-8021 suffix on every Kerb transaction: kt0hl6xyhlx8xmt.
x402
HTTP 402 payments: the server answers with requirements, the client pays and retries.

FAQ

The questions people ask most, answered with the page that shows each answer. Open the FAQ on its own page.

The idea

What Kerb is, and why a loan against a tokenized stock needs the market's clock.

01What is Kerb?

The market-time risk layer for tokenized stocks on X Layer. It measures how much of a position could really be sold in X Layer pools and how long a loan must survive before the next deep market, and posts both as credit terms on X Layer mainnet every few minutes. Kerb Credit lends against those terms; so can any contract, agent or app.

How to use Kerb
02Why does the market's clock matter for a loan?

A tokenized stock trades all weekend, but the market behind it does not. When New York or Hong Kong is shut, no new reference price arrives and the onchain pool is the only exit, often a thin one. A loan that is safe on Tuesday afternoon can be unsellable on Saturday. Kerb sizes credit to survive until the next deep market.

The rules
03Who is it for?

Holders of tokenized stocks who want credit without selling; lenders and curators who need limits that follow real exit depth; agents that want a verifiable answer before taking risk; and any X Layer contract that wants to read those limits in one call.

04Isn't this what Aave or Morpho do?

Those are lending markets. They price collateral with oracles and fix risk parameters per market. Kerb is the layer such a market would read: a measured, recomputable answer to how much the pool could absorb and how long a loan must last. Kerb Credit exists to prove the terms work, not to compete with them.

Borrowing

How Kerb Credit works on testnet: the two modes, Last Call and the cure.

05What are Carry and Session Max?

Two ways to borrow against the same collateral. Carry is sized to survive, unattended, until the next deep session. Session Max lends more now, with a promise: when Last Call opens before the market weakens, the position must come back to its Carry target.

Try both
06What is Last Call, and what is a cure?

Last Call is a window before the market weakens. A Session Max position above its Carry target must be brought back to it by repaying or adding collateral. If the owner does not, anyone may cure it: repay only the difference and receive a small bonus in collateral. The position survives, smaller, while liquidity is still there.

07Can I be liquidated?

Only past the liquidation line, which is fixed per asset and never moves with the session. Sessions change how much you can borrow and when a cure is due, never the line under an open loan.

08Is this real money?

No. Kerb Credit runs on X Layer testnet with mirror collateral and a test loan asset (mUSDG), using the real terms relayed from mainnet. The risk plane itself (measurement, terms, KerbQuote) is on X Layer mainnet and holds no user funds.

09Why is there no mainnet lending?

The contracts are unaudited, the terms are signed by a single attester, and the production tokenized stocks are restricted in some jurisdictions. Lending real money needs all three solved first. Everything that can be proven without real money is live.

10How do I try it?

Open Credit, connect a browser wallet, get test OKB from the X Layer faucet, mint mirror collateral and mUSDG with one click each, then borrow. The demo clock runs a trading week every hour, so Last Call comes around within the hour. A standing demo position is there to cure every cycle.

Open Credit
11Can Kerb tell me when Last Call opens?

Yes, two ways. Credit can send a browser notification while its tab is open. Away from the tab, the Telegram bot @KerbAlertsBot watches an address you send it with /watch and messages you when Last Call opens, five minutes before the deadline, and when the position is cured. /stop ends it. It reads the same public positions feed as the site and never asks for a key.

Open the bot
12Where do I see my own positions and history?

Your account shows your holdings, each position with its health and Last Call status, and everything your address has done in Kerb Credit. It also prices any real xStocks you hold on X Layer mainnet.

Your account

The numbers

Where every figure comes from, and how to check it yourself.

13Where do the numbers come from?

Every minute Kerb reads each X Layer pool's price, liquidity and ticks, walks the pool tick by tick to find how much could be sold within 1% (C(1%)), cross-checks that against the OKX DEX quote and keeps the smaller, takes a conservative Credit Mark, and computes terms under the Kerb Terms Standard. No model is anywhere in that path.

14Can I check a number myself?

Yes. Every post carries the hash of its complete input bundle. Fetch the bundle from the API, check the hash, and run one command to recompute the terms. Proof does this live on the latest post.

Open Proof
15Why did a term change?

Each asset page explains the current terms in sentences with their numbers, and lists every change in the last 72 hours with its cause: a longer horizon, a move in pool depth, volatility, or a loosening that waits for its cooldown.

An example
16Why is a debt ceiling sometimes far below the pool's depth?

Terms tighten at once and loosen slowly: after a sharp fall in measured depth, the ceiling drops in the same post and then recovers in small steps. On 23 Sep a large move in the BRK.Bx pool did exactly that. The asset page says so in its own words.

17Are the input bundles on IPFS?

Some early ones are. Since 21 Sep the free pinning plan's limit has been reached, so every bundle is published and served by the Kerb API under its own hash instead. Anyone can still fetch and verify it; Kerb says published, not pinned.

Builders and agents

Reading Kerb from a contract, from code, and from an agent.

18Can my contract use Kerb?

Yes. KerbQuote on X Layer mainnet returns max borrow, cure deadline and usability for any collateral amount in one view call, valuing collateral exactly as Kerb Credit does. KerbMarkFeed exposes each Credit Mark behind a Chainlink-shaped feed.

Solidity
19How do agents use Kerb?

An agent calls Kerb Credit Check, gets an HTTP 402 with the payment requirements, pays one cent in USDT0 on X Layer through x402, and receives the answer with the transaction and inputs hash that recompute it. A free MCP server offers the public terms to Claude, Cursor or any MCP client.

Agents
20Is there an AI in Kerb?

No. Kerb deliberately keeps models out of anything that produces a number. Agents are customers of Kerb, not part of it.

Trust

What Kerb is not, what it stores, and what it has not yet had.

21Is Kerb audited?

No. It is a hackathon build with guarded parameters, onchain guardrails the attester cannot loosen, invariant and fork tests, and a dispositioned static analysis. Read the limits before relying on anything.

Risk disclosure
22What does Kerb know about me?

Only what a public blockchain already shows: addresses and transactions. The site has no accounts, no cookies for tracking, and stores nothing about a visitor.

Privacy
23Is this investment advice?

No. Kerb Terms describe measured risk. They are not a recommendation to buy, sell, borrow or lend anything.