This bot is a policy-controlled AI market maker for Perp DEX trading. It replaces direct private key signing with OWS-based authorization.
Most trading bots sign directly from PRIVATE_KEY in .env.
That is simple but risky.
This bot flow:
- Bot proposes an action.
- Policy engine evaluates limits and rules.
- OWS signs only if policy allows.
- Unsafe actions are blocked and logged.
- Builders running automated trading agents with real funds.
- Individuals who don’t want private keys exposed inside bot logic.
- Developers integrating AI agents with on-chain execution.
- Market makers who need enforceable risk limits, not just configs.
This setup was tested with 01.xyz market maker flow using OWS signing mode.
This bot is also a ready-to-use market maker baseline. You can tune your own parameters and build your own strategy and automation layers on top of it.
- OWS wallet mode (
OWS_WALLET). - Runtime policy checks before sensitive actions.
- Daily spend/loss protection.
- Allowed target and operation restrictions.
- Kill switch after repeated violations.
- Telegram alerts.
- Security dashboard.
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
source ~/.bashrc
nvm install --ltsnpm install -g @open-wallet-standard/corenpm installcp .env.example .envFill trading + RPC values.
- Keep your current key only in local
.envasPRIVATE_KEY=.... - Run:
export PRIVATE_KEY_B58="$(grep '^PRIVATE_KEY=' .env | cut -d '=' -f2-)"
node import-ows.mjs
unset PRIVATE_KEY_B58This imports your key into your local OWS vault.
OWS_WALLET=my-agent
OWS_INDEX=0
OWS_VAULT_PATH=/home/<user>/.ows
OWS_PASSPHRASE=<your-local-passphrase>
PRIVATE_KEY=PRIVATE_KEY= empty means runtime signing path is OWS-based.
npm run bot -- btcIf logs show Using OWS wallet "my-agent", OWS mode is active.
http://localhost:8787
The dashboard was designed to show in real time that external intervention attempts are blocked by OWS. I am still including it in case you want to build more on top of it.
OWS_WALLETOWS_INDEXOWS_PASSPHRASEOWS_VAULT_PATHOWS_MAX_DAILY_SPEND_USDOWS_KILL_SWITCH_THRESHOLDRPC_URLTELEGRAM_BOT_TOKENTELEGRAM_CHAT_IDSECURITY_TELEGRAM_ALERTS_ENABLED
Legacy fallback:
PRIVATE_KEY(not recommended after OWS mode activation)
.
├─ src/
│ ├─ bots/
│ │ └─ mm/
│ │ ├─ index.ts
│ │ ├─ config.ts
│ │ ├─ position.ts
│ │ └─ quoter.ts
│ ├─ sdk/
│ │ ├─ client.ts
│ │ ├─ account.ts
│ │ ├─ orders.ts
│ │ └─ orderbook.ts
│ ├─ security/
│ │ ├─ policy-engine.ts
│ │ ├─ runtime.ts
│ │ ├─ dashboard.ts
│ │ ├─ onchain-policy.ts
│ │ └─ types.ts
│ ├─ pricing/
│ ├─ risk/
│ ├─ signals/
│ ├─ strategy/
│ ├─ telegram/
│ ├─ utils/
│ ├─ types.ts
│ └─ viem-shim.d.ts
├─ contracts/
│ └─ OwsPolicyRegistry.sol
├─ docs/
├─ dist/
├─ logs/
├─ import-ows.mjs
├─ .env.example
├─ package.json
├─ tsconfig.json
└─ Dockerfile