KeelDocs
On this page

Developers

Keel is open source under GPL-3.0: github.com/Im-2/keel.

#Repo layout

PathContents
contracts/Fork of mezo-org/musd plus Keel's contracts in contracts/keel/; Hardhat tests against the real MUSD stack
shared/ABIs (generated), deployments, risk maths, chain readers
bot/API, Telegram bot, keeper, relayer, block watcher, alerts, stats; testnet scripts in bot/scripts/
miniapp/React app: Mini App, web app, landing page, docs site
docs/Markdown docs (docs/site/ is what this site renders), status, business model, images
submission/Pitch deck (PDF and PPTX), deck source, submission text, landing screenshots

#Run locally

Requires Node 22+ and pnpm 10.

pnpm install
cp .env.example .env                        # names only; fill in your own values
cp miniapp/.env.example miniapp/.env.local
pnpm --filter @keel/miniapp dev             # app on :5173
pnpm --filter @keel/bot dev                 # bot + API + keeper + watcher on :8787

To work on the web app without a Telegram bot, run the API with no Telegram connection:

cd bot && PORT=8790 npx tsx --env-file=../.env scripts/web-dev.ts

#Environment variables (names only)

WhereVariables
Bot / API (required)BOT_TOKEN, BOT_USERNAME, MINIAPP_URL, NETWORK
Bot / API (optional)MINIAPP_SHORTNAME, PUBLIC_URL, KEEPER_PRIVATE_KEY, RELAYER_PRIVATE_KEY, KEEPER_MIN_BTC, ADMIN_IDS, RPC_URL, PORT, POLL_MS, DB_PATH, TURSO_DATABASE_URL, TURSO_AUTH_TOKEN, CRON_SECRET, KEEL_FACTORY, KEEL_PAY, PREMIUM_PAY_TO, PREMIUM_PRICE_MUSD, PREMIUM_DAYS, X402_FACILITATOR_URL
App (build time)VITE_API_BASE, VITE_WC_PROJECT_ID, VITE_DEMO_VIDEO_URL (optional; overrides keel.config.json)
Scripts / deploysDEPLOYER_PRIVATE_KEY, MATSNET_PRIVATE_KEY

Every name is listed in .env.example, bot/.env.example, miniapp/.env.example and contracts/.env.example. Never commit .env.

#Deploy

cd contracts && pnpm deploy:keel:v2:testnet       # factory v2 + implementation, KeelPay, KeelPro; previous ones become `legacy`
python contracts/scripts/verify-blockscout.py      # verify every contract on the explorer
PartHost and settings
API and botRender web service (render.yaml), Turso mirror, a scheduler calling /cron/tick
AppVercel (vercel.json); the build prerenders the landing page and every docs page

#Tests

cd contracts && KEEL_SOLCJS=1 npx hardhat test test/keel/*.test.ts   # 41 tests: v1 + v2 against the real MUSD stack
pnpm --filter @keel/bot test        # 242 tests
pnpm --filter @keel/shared test     # 25 tests
pnpm --filter @keel/miniapp test    # 12 tests
pnpm --filter @keel/miniapp e2e     # Playwright: every landing link at 375px and 1440px (E2E_URL to target a deployment)

Testnet end-to-end scripts in bot/scripts/, which need funded testnet keys:

ScriptCovers
guardian-v2-testnet.tsFull, partial and insufficient v2 rescues
payments-testnet.tsPayments
claims-splits-testnet.tsClaim links and splits
x402-testnet.tsx402 premium

#API overview

EndpointAuthPurpose
GET /api/configpublicNetwork, chain id, deployment addresses
GET /api/stats[?all=1]publicOn-chain stats (team wallets excluded unless all=1)
GET /api/claim/:link, POST /api/claim/relaylink keyClaim-link info and gasless claim
POST /api/web/nonce, POST /api/web/session, POST /api/web/logoutpublic / sessionWallet sign-in for the web app
POST /api/web/telegramsessionOne-time code to attach Telegram to a web account
GET /api/me, GET /api/position, GET /api/activity, GET /api/marketuserAccount, loan and balances, history, price
POST /api/intent, GET /api/intent/:id, POST /api/intent/:id/completeuserCreate, read and settle intents
GET/POST /api/splits, /api/split/:id[/pay|remind|cancel], /api/request/:id/payuserSplits and requests
POST /api/live/token, GET /api/liveuserShort-lived token, then a server-sent events stream
POST /api/nonce, POST /api/bind, POST /api/disconnect, POST /api/handoffTelegramWallet linking and handoff

"User" means Telegram initData (header x-telegram-init-data) or a web session (header x-keel-session).

#Contributing

  • Open an issue or a pull request on GitHub.
  • Keep changes tested: contracts against the real MUSD stack, the API with the in-memory store.
  • Never commit secrets. Run gitleaks before pushing.

#License and credits

  • Keel: GPL-3.0.
  • MUSD: contracts/ builds on MUSD by Mezo / Thesis (GPL-3.0). Everything under contracts/contracts/ except keel/ is vendored unmodified, so Keel's tests run against the real protocol.
  • Fonts and logos:
    • Onest, the landing font, is SIL OFL 1.1.
    • Wallet logos come from the WalletConnect registry and belong to their owners.

See NOTICE.md.

Edit this page on GitHub · Keel is testnet software, not audited.