Files
neuron-tai/docs/issues/06-solana-stake-and-settlement.md
Dobromir Popov d1e75ddded docs: consolidate all docs under docs/ — single source of truth
Move issues (01–29) and PRD from .scratch/distributed-inference-network/
into docs/issues/ and docs/. Update ralph_progress.py DEFAULT_PRD path
and rewrite docs/agents/issue-tracker.md to reflect the new layout.

The distributed_inference_network.egg-info/docs/ mirror is a build
artifact already covered by *.egg-info/ in .gitignore — not committed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-01 14:18:26 +03:00

33 lines
2.0 KiB
Markdown

Status: ready-for-agent
# 06 — Solana stake + settlement contracts
## What to build
Deploy and integrate the Solana smart contracts that make node staking, client payment, and token reward settlement trustless. All development and testing targets **Solana testnet** — never devnet or mainnet during development, to avoid real costs.
Three contracts are needed:
**Registry contract**: records stake balances, strike counts, and ban status per wallet. The gateway and tracker read from this contract to exclude banned wallets from route selection.
**Payment contract**: clients pre-fund an API key account with SOL or USDC. The gateway records per-request compute attribution (which node served which layer range, for how many tokens).
**Settlement contract**: called once per epoch. Debits client accounts proportional to compute consumed. Credits node operator wallets with our native token proportional to layers served. Distributes a validator reward share.
The `packages/contracts` package provides Python wrappers for reading and writing to all three contracts. The gateway uses these wrappers to check stake before routing to a node and to record attribution after each request.
## Acceptance criteria
- [ ] All contracts deploy successfully to Solana testnet
- [ ] A node can submit a stake transaction and have its balance reflected in the registry contract
- [ ] A client can fund an API key account with testnet SOL
- [ ] After a completed inference session, compute attribution is recorded on-chain with correct node/layer attribution
- [ ] The epoch settlement transaction correctly distributes token rewards to node operators and deducts client balances
- [ ] The gateway refuses to route to a node whose stake balance is below the minimum threshold
- [ ] All contract interactions in tests run against a local Solana test validator (via `solana-test-validator`) — no live testnet required for CI
- [ ] A `.env.testnet` config points to Solana testnet RPC for manual end-to-end testing
## Blocked by
- `03-tracker-registration-and-routing.md`