Skip to content

DIN CLI

umermjd11 edited this page Oct 5, 2026 · 4 revisions

DIN CLI

🚧 This wiki describes DevNet 2.0, soon to be launched. It follows the contracts and dincli on the develop branch; the currently running DevNet may still use older contracts and commands. Pre-launch discussion: #102.

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.12) 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 registration and connection, IPFS provider setup, importing platform deployments, ABI export
dincli dinrep DIN-Representative slasher authorization, model registration and manifest-update approvals, disabling models, setting registry fees, sweeping fees to DinFeeRouter
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, seed locking, evaluating (commit) and revealing scores for assigned audit batches
dincli aggregator aggregators registration, staking, seed locking, T1/T2 aggregation (commit) and reveal for assigned batches
dincli dintoken everyone buying DIN with ETH, staking, reading stake and the DIN-per-ETH rate
dincli task model owners, everyone model registration and manifest update requests on DINModelRegistry (task model-owner …), GI state (task gi show-state), registry counters
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, then dincli client submit-lm), 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_devnet, sepolia_op_devnet, mainnet) from the global --network option (accepted anywhere on the command line) 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. A key is first registered as a named, encrypted wallet with dincli system register-wallet: from a hidden prompt (recommended), --keystore (import a JSON keystore), --key-file, or --account <n> (reads ETH_PRIVATE_KEY_<n> from .env), then selected with dincli system connect-wallet <name> (or register-wallet … --connect). Per invocation, --wallet <name> or DIN_WALLET_NAME override the connected wallet. Production validators use an encrypted keystore protected by DIN_WALLET_PASSWORD; see the wallet setup guide. A demo mode exists for local experimentation (connect-demo-wallet, --demokey; plaintext dev keys, 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) with demo mode off; dincli system get-config-dir / get-cache-dir print them. Fetched artifacts are cached by CID so files are only re-downloaded when their CID changes.
  • Platform addresses. After the DIN-Representative deploys the platform contracts, dincli system import-deployments loads their addresses from foundry/deployments/<network>.json; dincli system din-info shows what is configured.

Getting started

# install from a checkout (in a virtualenv, Python 3.12 recommended)
git clone https://github.com/InfiniteZeroFoundation/DevNet.git && cd DevNet
pip install -e .

# initialize and configure
dincli system init
dincli system configure-demo --mode no
dincli --network sepolia_op_devnet system configure-network
dincli system register-wallet --account 0 --connect
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

Introduction

DIN Components

Network Roles

Clone this wiki locally