{"id":"64811a27-b116-49b7-82e0-92b6bfdb993c","slug":"ubi2","kind":"skill","name":"ubi2","summary":"A Universal Basic Income blockchain where humans are verified by AI, contracts are written in plain language, and money flows as a continuous stream.","owner":"DemocracyEarth","repoUrl":"https://github.com/DemocracyEarth/ubi2","license":"MIT","licenseTier":"permissive","trust":"community","stars":6,"match":null,"fewStars":false,"format":"skill","createdAt":"2026-06-21T02:42:49.000Z","addedAt":"2026-10-21T23:18:57.187Z","logoUrl":"https://avatars.githubusercontent.com/u/15898510?v=4","linkOnly":false,"collection":null,"skillPath":null,"categories":["data-analytics"],"tags":[],"runtime":"binary","local":true,"cloudCapable":false,"cloudCapability":"unknown","cloudReadyOnPlatform":false,"needsApiKey":false,"reviewed":false,"syncedAt":"2026-10-25T20:03:16.768Z","sample":false,"url":"https://conduits.dev/tools/ubi2","language":"Rust","transports":["stdio"],"install":{},"requirements":{"env":[],"upstreamMayCharge":false},"tools":null,"readme":"# UBI\n\n**A Universal Basic Income blockchain where humans are verified by AI and zero-knowledge cryptography,\ncontracts are written in plain language, and money flows as a continuous stream — verifiable from any\nbrowser or phone.**\n\nUBI is an EVM-compatible chain built around six ideas:\n\n1. **AI proof-of-humanity** — you become a verified, unique human through social **vouching** adjudicated\n   by a **quorum of AI verifier nodes** (liveness grading + sybil analysis + dispute resolution). No\n   biometrics, no documents.\n2. **ZK-passport proof-of-humanity** — an optional, additive upgrade path: a zero-knowledge proof over\n   an ICAO-9303 NFC e-passport (Groth16/BN254, adapted from the OpenPassport/Self circuit) produces a\n   **one-passport-one-human nullifier** and opaque **attribute commitments** (age, nationality, expiry —\n   no PII on-chain). Completing either path yields full `Verified` status and the same 1 UBI/hour stream.\n3. **Streaming UBI** — every verified human accrues **1 UBI per hour**, continuously. Streams extend\n   account-to-account in real time, turning payments into flows.\n4. **Prompt contracts** — smart contracts written in **natural language** and executed by a **quorum of\n   AI interpreter nodes** that agree on the resulting effect, or abort. *Intent-as-law*, not code-as-law.\n5. **EVM-compatible JSON-RPC** — standard wallets (MetaMask) add it as a custom network and read\n   streaming balances, send txs, and sign contract/vouch/ZK-passport operations.\n6. **Browser and mobile light nodes** — anyone can run a node in a browser tab or on their phone. The\n   deterministic runtime compiles to WASM; a light client syncs blocks over a WebSocket gateway,\n   re-executes every block, and checks the `state_root` byte-for-byte. A lying server is caught, not\n   trusted. Phone + NFC + WASM = ZK-passport proof generated and submitted on-device.\n\n> Status: M1–M4 shipped (EVM RPC, streaming, AI PoH, prompt contracts). M5 Stage A (P2P networking)\n> shipped. M6 ZK-passport PoH and the browser/mobile light node are **Stage 1 shipped** (crates\n> `zkpoh` and `runtime-wasm` in tree; `packages/light-client` in tree). The in-browser PWA and the\n> real NFC passport-scan flow are upcoming stages. See [`docs/roadmap.md`](docs/roadmap.md).\n\n---\n\n## Quickstart\n\nPrerequisites: **Rust** (the toolchain auto-pins via `rust-toolchain.toml`), **Node ≥ 20**, **pnpm**.\nNo API key is needed — the node defaults to a deterministic mock AI so the devnet always runs.\n\n**Terminal 1 — the chain:**\n```bash\npkill -f ubi2-node            # clear any stale node holding :8545\n./scripts/devnet.sh          # builds + serves EVM JSON-RPC (HTTP+WS) on http://127.0.0.1:8545\n```\n\n**Terminal 2 — the app:**\n```bash\npnpm install                 # once\npnpm --filter @ubi2/wallet dev   # → http://localhost:3000\n```\n\n**MetaMask (optional):** the app's \"Add to MetaMask\" button adds the network — name `UBI devnet`,\nRPC `http://127.0.0.1:8545`, Chain ID `21826`, symbol `UBI`. Import the public devnet key\n`0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80` to see a balance streaming at\n1 UBI/hour and to sign transfers, vouches, and contracts.\n\n**Use a real AI (optional):** open **Settings** in the app and point the node at a local model\n(**Ollama** — run `ollama serve` and pull a model) or a cloud key (**Anthropic** / **OpenAI**-compatible).\nUnconfigured, proof-of-humanity verdicts and contract interpretation use the deterministic mock.\n\n---\n\n## CLI (`ubi`)\n\n`ubi` is the one discoverable binary for running and operating the chain — it replaces the env-var\nsprawl and shell scripts. Every command has `--help`. The `ubi node` flags are ergonomic **sugar over\nthe `UBI2_*` env vars** the node already reads: a flag **overrides** the matching env var; an unset flag\nleaves the env var as the documented fallback. Config resolution is unchanged, so the CLI adds no\nconsensus risk.\n\n### Install\n\n```bash\ncargo install --path crates/cli    # installs `ubi` to ~/.cargo/bin (on your PATH)\nubi --help\n```\n\n`multi` re-invokes the `ubi` binary itself, so installing the CLI is all you need — no separate\n`ubi2-node` on your PATH. Or run it straight from the workspace without installing (note the `--`\nbefore the CLI's own args, and that a bare `ubi` name won't be found until you `cargo install`):\n\n```bash\ncargo run -q -p ubi2-cli --bin ubi -- --help          # or, after `cargo build`: ./target/debug/ubi --help\n```\n\n### `ubi node` — run a full node\n\n```bash\nubi node --preset devnet          # plain single node (== ./scripts/devnet.sh)\nubi node --preset lightnode       # single node the browser light node accepts (pinned genesis + gateway)\nubi node --preset multi           # multi-node local network (== ./scripts/devnet-multi.sh)\nubi node --rpc 127.0.0.1:9000 --block-ms 1000     # bare (no preset), just flags/env\n```\n\n| Flag | Overrides | Meaning |\n|---|---|---|\n| `--preset <devnet\\|lightnode\\|multi>` | — | Canned config (see below). Flags still override preset values. |\n| `--rpc <addr>` | `UBI2_RPC_ADDR` | JSON-RPC (HTTP+WS) listen address. Default `127.0.0.1:8545`. |\n| `--sync-gateway <addr>` | `UBI2_SYNC_ADDR` | Enable the WebSocket sync gateway (browser light node). |\n| `--genesis-time <unix>` | `UBI2_GENESIS_TIME` | Pinned genesis time (a shared value ⇒ matching genesis hashes). |\n| `--proposer-key <hex32>` | `UBI2_PROPOSER_KEY` | PoA block-author signing key (32-byte hex). |\n| `--block-ms <ms>` | `UBI2_BLOCK_MS` | Block interval. Default `2000`. |\n| `--data-dir <path>` | `UBI2_DATA_DIR` | Chain snapshot + oracle config dir. Default `./.ubi2-devnet`. |\n| `--p2p <addr>` | `UBI2_P2P_ADDR` | Enable libp2p on this listen multiaddr. |\n| `-n, --nodes <N>` | — | (`multi` only) number of nodes to launch. Default `3`. |\n\n**Presets:**\n\n- **`devnet`** — plain single node: RPC `127.0.0.1:8545`, 2s blocks, wall-clock genesis, no proposer\n  key, sync gateway off unless `--sync-gateway` is given. Identical to `./scripts/devnet.sh`.\n- **`lightnode`** — the single node the browser light node accepts: pinned `genesis_time=1700000000`,\n  Anvil acct #2 as the PoA proposer, RPC `127.0.0.1:8545`, sync gateway `127.0.0.1:8546`, 1s blocks,\n  isolated data dir `.devnet-lightnode-data`. Reproduces the pinned genesis anchor\n  `b24d054f…` / `state_root aa2c66cd…`.\n- **`multi`** — one designated proposer (Anvil acct #1) + N-1 followers over libp2p, pinned genesis,\n  full cross-bootstrap mesh (no mDNS — deterministic). The CLI launches the N processes itself and\n  stops them all on Ctrl-C. Identical to `./scripts/devnet-multi.sh` (which now delegates here).\n\n### `ubi genesis anchor` — print/verify the canonical genesis anchor\n\n```bash\nubi genesis anchor --preset lightnode\n# genesis_time : 1700000000\n# genesis_hash : bc53563fa41f719abe0358f106b067e31915a6ed68d0656ba7443a36f01224e3\n# state_root   : fa0360178cd29e57affe89478e19cbdc5bdc94fad00212695a4b241f2dcba1ac\n# pin check    : OK (matches apps/light-node/src/config.ts PINNED_GENESIS_HASH/STATE_ROOT)\n```\n\nRecomputes the canonical devnet genesis from the SAME seeds the node applies (one shared function,\nno duplicated seed list) and — for the pinned `lightnode` genesis — asserts equality with the constants\nshipped in `apps/light-node/src/config.ts`, exiting non-zero on drift. Use it to regenerate or verify\nthat pin.\n\n### `ubi keys` — the PUBLIC devnet accounts\n\nPrints the standard Hardhat/Anvil test accounts the presets use (the dev account, the 3 jurors, and the\nPoA proposers), with addresses, private keys, and roles. These are **public test keys** published in\nevery EVM dev toolkit — never use them for real value.\n\n---\n\n## The app (one on-ramp)\n\n- **Wallet** — your streaming balance (ticks live), transfers, and real-time **streams** to other\n  accounts (each stream mints two soulbound NFTs you can view in MetaMask).\n- **Explorer** — search any address / tx hash / block; drill into blocks (all header fields + decoded\n  txs) and transactions (decoded hub call, logs, the resulting effect/verdict, fee).\n- **Identity** — proof-of-humanity: your status, vouches in/out, vouch for / challenge others, the\n  pending-cases queue, and the jurors. The ZK-passport upgrade path (NFC scan + on-device proof\n  generation) lands in Stage 3 of the light-node track.\n- **Contracts** — write a contract in plain language (or start from a template), deploy it, fund its\n  escrow, and invoke it; watch the AI quorum commit or abort the effect.\n\n---\n\n## Architecture\n\n```\ncrates/runtime      Deterministic state: accounts, 1-UBI/hr emission, streams, the proof-of-humanity\n                    lifecycle (social-vouching + AI-jury AND ZK-passport paths), prompt-contract\n                    execution, and the shared AI-quorum tally. No floats in any consensus path;\n                    balances are pure integer functions of (state, timestamp). Defines the\n                    ZkPassportVerifier trait (no crypto deps in runtime itself).\n\ncrates/zkpoh        Pure, deterministic Groth16/BN254 SNARK verifier (Stage 1 shipped). Isolated\n                    from runtime so the consensus core stays dependency-free. Implements the\n                    ZkPassportVerifier trait with arkworks (ark-bn254 + ark-groth16, pinned);\n                    compiles to WASM. Also holds the Pedersen attribute verifier, the MockZkVerifier\n                    for CI, and a real-curve test-passport fixture path.\n\ncrates/runtime-wasm Thin wasm-bindgen wrapper over the untouched crates/runtime (Stage 1 shipped).\n                    The only crate that may depend on wasm-bindgen. Exposes applyBlock / stateRoot /\n                    balanceOf / serialize as a bytes/JSON API. Used by packages/light-client to run\n                    the same deterministic kernel in a browser tab that full nodes run in Rust.\n\ncrates/rpc          EVM-compatible JSON-RPC (jsonrpsee, HTTP+WS) + the ubi_* read surface + the EXPL\n                    indexer + the loopback-only oracle-admin RPC. Decodes the three system hubs.\n                    Hosts the WebSocket sync gateway that serves blocks to light clients.\n\ncrates/oracle       The AI layer: HumanityOracle + ContractInterpreter, with a configurable backend\n                    (Anthropic / Ollama / OpenAI-compatible) producing canonical structured outputs at\n                    temperature 0, behind injection-fenced prompts. A deterministic MockOracle for tests.\n\ncrates/network      P2P networking (M5): libp2p transport, block gossip, the ubi2/sync/1 wire protocol.\n                    The WireBlock format the light client re-executes is defined here.\n\ncrates/node         The devnet node binary: genesis, block production (2s tick), seeded jurors, wires\n                    the real ZkPassportVerifier from crates/zkpoh.\n\npackages/sdk        TypeScript client: EVM JSON-RPC + ubi_* readers + viem encoders for stream / vouch /\n                    contract operations. No WASM dependency.\n\npackages/light-client  TypeScript light-client (Stage 1 shipped): WebSocket sync driver, WASM glue for\n                    crates/runtime-wasm, IndexedDB store, EIP-1193 signer, verifyMode control. Separate\n                    from packages/sdk so non-light-node consumers do not pull the WASM artifact.\n\napps/wallet         The Next.js app (wallet + explorer + identity + contracts + settings).\n\ndocs/               WHITEPAPER, the roadmap, the dev loop, the task board, specs (+ ADRs), gate reports.\n```\n\n**System hubs** (reserved addresses; operations are EIP-155 txs to them, so MetaMask signs them):\n\n| Hub | Address | Operations |\n|---|---|---|\n| StreamHub | `0x…5742` | `openStream` / `stopStream` (+ ERC-721 stream NFTs) |\n| HumanityHub | `0x…5048` | `requestVerification` / `vouch` / `challenge` / `submitVerdict` / `submitZkPassportProof` |\n| ContractHub | `0x…5043` | `deployContract` / `fundContract` / `invokeContract` / `submitEffect` |\n| Treasury | `0x…5542` | collects UBI gas fees (the basis for fee-recycling) |\n\n**Fees:** every tx pays a small gas fee in **UBI** (`gas_used × 1 gwei`) to the treasury; onboarding\n(`requestVerification`) is fee-exempt. A tx whose op fails is mined with a `status 0` receipt + reason\n(it never silently hangs).\n\n**The AI-quorum invariant:** AI is non-deterministic, but consensus must be reproducible. So every AI\nverdict or contract effect in the consensus path is produced by an **independent quorum** running a\npinned model at temperature 0 with a **canonical structured output**, and is committed only when a\nsupermajority agree — otherwise it **aborts deterministically**.\n\n**The ZK-PoH invariant:** ZK verification is pure deterministic cryptography — no AI in the verify\npath at all. Every honest node re-runs the Groth16 pairing check and gets the same boolean. A tampered\nor patched verifier produces a different `state_root` and is out-voted by the honest majority; the chain\nadvances only on the value the honest nodes agree on. See [`docs/specs/00-overview.md`](docs/specs/00-overview.md).\n\n**The light-node trust model:** the WASM light client re-executes every block and checks the\n`state_root` byte-for-byte before updating any balance. A gateway that serves a forged block is caught\nimmediately; it cannot make the light node display a wrong balance. See\n[`docs/specs/07-browser-light-node.md`](docs/specs/07-browser-light-node.md).\n\n---\n\n## Light-node quick check\n\nThe `crates/runtime-wasm` crate and `packages/light-client` are in tree. To verify the WASM kernel\nproduces byte-identical state roots to the server follower (the AC-WB parity gate):\n\n```bash\ncargo test -p ubi2-runtime-wasm --test parity --no-default-features\n```\n\nThe ZK-passport verifier (real Groth16 curve, test-passport fixture):\n\n```bash\ncargo test -p ubi2-zkpoh\n```\n\n---\n\n## How it's built — the agent loop\n\nUBI is developed by a team of specialized [Claude Code subagents](.claude/agents/) running an explicit\nloop: **product → spec → build → test → reliability → security → release**, gated by a Definition-of-Done\n(QA + reliability + security must be green). See [`AGENTS.md`](AGENTS.md), [`docs/loop.md`](docs/loop.md),\nand the live board [`docs/board.md`](docs/board.md). To run or extend a node as an agent, see\n[`SKILL.md`](SKILL.md).\n\n## Verify\n```bash\ncargo test --workspace        # the full Rust suite\npnpm -r build                 # the SDK + wallet\n```\n\n## License\nMIT © Democracy Earth Foundation. Built on the vision in [`WHITEPAPER.md`](WHITEPAPER.md).\n"}