Files
neuron-tai/.scratch/distributed-inference-network/issues/06-solana-stake-and-settlement.md
Dobromir Popov 2f1f9717be tasks
2026-06-29 00:10:21 +03:00

2.0 KiB

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