-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Murtaza Ali Imtiaz edited this page Jun 5, 2026
·
7 revisions
Polar Bear (🍨) · Technology Lead · Murtaza Ali Imtiaz · July 2019 – present Proprietary software - see LICENSE
polar-bear-rig-onchain is a production-grade Rust implementation of the rig-onchain-kit
on-chain agent pattern. It demonstrates Solana devnet balance queries, Jupiter V6 dry-run
swap quotes, and task-local SignerContext signer isolation via tokio::task_local!:
the correct async-safe implementation of the rig-onchain-kit security boundary pattern.
| Page | Description |
|---|---|
| Getting Started | Prerequisites, clone, build, first run (keyless) |
| CLI Reference |
--mode flags, --no-agent, --wallet, --amount
|
| Configuration | Environment variables and .env setup |
| Architecture | System design, module map, data-flow diagram |
| Module Reference | Per-module API overview (onchain, agent, config) |
| SignerContext and Security |
tokio::task_local! isolation deep-dive |
| Testing | Running tests, live provider tests, coverage areas |
| Zed IDE | Task runner, debugger configs, rust-analyzer settings |
| Contributing | Dev workflow, code style, extending the agent |
| Changelog | Version history and bug-fix log |
CLI Entry (main.rs)
--mode [full|balance|quote|signer] [--no-agent]
│
├─ --mode full ──────────────────────────────── requires ANTHROPIC_API_KEY
│ ┌──────────────────────────────────────┐
│ │ rig-core Agent (claude-sonnet-4-6) │──── SolanaBalanceTool
│ │ PEV loop governance │ JupiterQuoteTool (dry-run)
│ └──────────────────────────────────────┘ SignerIsolationTool
│
└─ --mode full --no-agent ───────────────── no API key needed
balance → quote → signer (direct, no LLM)
│
┌────┴───────────────────────────────┐
│ onchain::signer │──── tokio::task_local! SignerContext
│ with_signer(signer, f) │ (task-scoped, not thread-scoped)
├────────────────────────────────────┤
│ onchain::balance │──── Solana devnet RPC get_balance
│ onchain::jupiter │──── Jupiter V6 /quote (read-only)
└────────────────────────────────────┘
-
tokio::task_local!signer isolation - every concurrent HFT task gets its own isolated keypair slot, preventing cross-task key contamination thatthread_local!cannot prevent in an async runtime. -
Keyless operation -
ANTHROPIC_API_KEYis only required for--mode fullwithout--no-agent. All other modes, all tests, and all examples run without it. -
rig-core ≥ 0.36 compatibility -
Client::new(api_key)?(fallible constructor); bothCompletionClient+ProviderClienttraits in scope for.agent()to resolve. -
Jupiter V6 dry-run guard - a runtime
assert!inJupiterClientphysically prevents any swap execution path, even ifdry_runwere somehow set tofalse. -
IsolationReportaudit trail - serialisable JSON record of each signer lifecycle, designed as direct input to the Reactor GUI. -
Zero-warning build - passes
cargo clippy --all-targets -- -D warningswith the Rust 2024 edition lint table. -
Fully configured Zed IDE -
.zed/tasks.json(23 tasks),.zed/debug.json(9 CodeLLDB configs), and.zed/settings.json(rust-analyzer, format-on-save, inlay hints).
Published under the PBS License: portfolio and reference use only.
polar-bear-rig-onchain · Polar Bear (🍨) · Technology Lead: Murtaza Ali Imtiaz · PBS License
Getting Started
Design
Reference
Development
External