Skip to content

DIN CLI

umeradl edited this page Jul 8, 2026 · 1 revision

DIN CLI

dincli is the command-line interface to the DIN Protocol — the tool through which every participant interacts with the network. It is a Python application (Typer-based, Python ≥ 3.9) that wraps the on-chain contracts and the IPFS layer behind role-oriented commands, so participants never have to hand-craft transactions or manage CIDs themselves.

One CLI, every role

Commands are grouped into sub-apps, one per role or concern:

Command group Who uses it What it covers
dincli system everyone init, network/logging/demo-mode config, wallet connection, IPFS provider setup
dincli dindao DIN-Representative slasher authorization, model registration approvals, protocol admin
dincli model-owner model owners task contract deployment, genesis model, driving every GI phase (registration windows, LMS, evaluation, aggregation batches, slashing)
dincli client clients (model trainees) local training on private data and local model submission
dincli auditor auditors registration, staking, evaluating assigned audit batches
dincli aggregator aggregators registration, staking, T1/T2 aggregation of assigned batches
dincli dintoken everyone buying DIN with ETH, staking, reading stake
dincli task model owners model registration & manifest update requests on DinModelRegistry
dincli ipfs everyone direct IPFS upload/retrieve utilities

A typical Global Iteration is literally a conversation between these sub-apps: the model owner opens a phase (dincli model-owner lms open), participants act within it (dincli client train-lms --submit), and the owner closes it — the CLI enforcing the on-chain state machine at every step.

Key design points

  • Network selection per command. Every command resolves its network (local, sepolia_op_devnet, mainnet) from a --network flag or the configured default. The choice drives which .env.<network> file, RPC endpoint, and deployed contract addresses are used. The live DevNet is sepolia_op_devnet (Optimism Sepolia).
  • Wallets & keys. Accounts connect via dincli system connect-wallet. For local development, private keys can live in .env (ETH_PRIVATE_KEY_<n>); production validators use an encrypted keystore protected by DIN_WALLET_PASSWORD — see the wallet setup guide. A demo mode exists for experimentation (plaintext wallets — never with real funds).
  • Manifest-driven model logic. dincli contains no model-specific code. Each model's training, scoring, and aggregation functions are Python service files written by the model owner, pinned to IPFS, and referenced by CID in the model's manifest.json. The CLI fetches and executes them on demand, caching by CID — so a new model means a new manifest, not a new CLI release. See Manifest & Services.
  • Pluggable IPFS. All artifact traffic goes through one abstraction with three interchangeable backends — a self-hosted IPFS node (env), managed Filebase (recommended), or a fully custom Python provider. See the IPFS Layer page.
  • Config & cache. dincli system init creates per-user config and cache directories (via platformdirs); fetched artifacts are cached by CID so files are only re-downloaded when their CID changes.

Getting started

# install (in a virtualenv, Python 3.12 recommended)
pip install git+https://github.com/InfiniteZeroFoundation/devnet.git@main#subdirectory=dist

# initialize and configure
dincli system init
dincli system configure-demo --mode no
dincli system configure-network --network sepolia_op_devnet
dincli system connect-wallet --account 0
dincli system configure-ipfs --provider filebase --api-key <key>

Requirements: an RPC endpoint for Optimism Sepolia in your project .env (SEPOLIA_OP_DEVNET_RPC_URL, e.g. from Alchemy/Infura/Ankr) and an IPFS provider.

Further reading

Clone this wiki locally