Nexis Appchain is a Base-aligned Layer 3 built on the OP Stack to coordinate autonomous AI agents with on-chain staking, task execution, verifiable inference proofs, and streaming payouts. The repository packages the smart contracts, rollup infrastructure, developer tooling, and automation needed to stand up an L3 that is production-ready for agent marketplaces.
- Website: https://nexis.network
- Chain focus: AI agents delivering verifiable services with transparent incentives
- Stack: Optimism Bedrock + Nexis agent modules + Dockerized devnet and deployment scripts
- Overview
- Feature Highlights
- Architecture
- Network Configuration
- Getting Started
- Usage Guide
- Development Guide
- Directory Map
- Troubleshooting
- Contributing & Security
- License
AI services built on public blockchains struggle to prove work, manage stake, and coordinate rewards in a trust-minimized manner. Nexis Appchain addresses this by providing:
- A registry for agents, their metadata, service URIs, and delegated operators.
- Staking and slashing mechanics tied to task performance and verifier attestations.
- A task marketplace that escrows bonded capital while capturing inference proofs.
- Treasury-managed rewards, penalties, and insurance buffers.
- Subscriptions and rate-based streams so integrators can pay continuously for agent output.
The repository keeps parity with the Optimism monorepo while layering Nexis-specific contracts, configurations, and automation to deliver a Base-compatible L3 focused on AI coordination.
- Agent Registry: Register agents, define metadata, advertise service endpoints, and delegate granular permissions for metadata updates, inference submissions, or fund withdrawals.
- Multi-asset Staking: Support ETH and ERC20 positions with configurable unbonding periods, early-exit penalties, and withdrawal queues. Stake can be locked against active tasks for accountability.
- Task Marketplace: Builders post paid work; agents bond stake to claim tasks, submit inference proofs, and receive payouts after verifier attestations or resolution of disputes.
- Proof-of-Inference Pipeline: Tasks emit commitments referencing input, output, model hashes, and external proof URIs. Verifiers with
VERIFIER_ROLEattest on-chain to release payments or trigger slashes. - Treasury & Rewards Engine: Slashes, penalties, and deposits are routed into treasury, insurance, and rewards pools. Governance-controlled withdraws and reward distributions keep incentives aligned.
- Subscriptions & Streams: Continuous payment rails for workloads that require recurring billing or per-second compensation, built to integrate with Base-native partners.
- One-command Devnet:
pnpm devbrings up sequencer, batcher, proposer, challenger, verifier, and supporting services via Docker, auto-deploying Nexis contracts against a deterministic chain configuration. - Extensible Governance: All contracts are upgradeable (UUPS) with role-based access patterns tailored for decentralized operations and future governance handoff.
Nexis Appchain operates as an L3 rollup that settles to Base, inheriting Ethereum security via Optimism Bedrock. Chain parameters (block time, fault proofs, governance roles) are defined in packages/contracts-bedrock/deploy-config/AgentsL3.json and consumed by the automated devnet and deployment scripts.
| Contract | Purpose |
|---|---|
Agents.sol |
Registry for agents with staking balances, reputation dimensions, delegate permissions, and inference records. Integrates with treasury and task modules. |
Tasks.sol |
Bonded task marketplace enabling posting, claiming, submission, dispute, and resolution flows. Escrows rewards and stake with the treasury on completion or slashing. |
Treasury.sol |
Routes inflows between treasury, insurance, and rewards pools; handles slashes and penalties; pays rewards under governance control. |
Subscriptions.sol |
Recurring (epoch-based) and streaming (per-second) payment contracts that wire funds to agent owners while supporting ETH or ERC20 assets. |
- OP Stack Clients: Directories prefixed
op-(e.g.,op-node,op-batcher,op-proposer) mirror Optimism's Go services tuned via Base-aligned defaults. - Devnet Orchestration:
ops-bedrock/docker-compose.ymlplusscripts/agents-devnet/up.shrun a local rollup, funding test accounts and deploying contracts. - Bedrock Tooling:
bedrock-devnetPython utilities manage deterministic network snapshots for repeatable development and CI. - Indexing & Monitoring:
indexer,op-heartbeat, andendpoint-monitorprovide observability for chain health, RPC availability, and latency.
- Node & pnpm: Monorepo management, TypeScript utilities, and orchestrated builds run through pnpm + Nx.
- Go 1.21: Core rollup clients and services are written in Go.
- Foundry & Hardhat: Contract tests cover both solidity unit tests (
forge test) and integration checks against the live devnet (hardhat test). - Docker: Required for local rollup orchestration.
Key parameters for the Nexis Base L3 devnet (see deploy-config/AgentsL3.json):
| Setting | Value |
|---|---|
| L2 Chain ID | 84532 |
| L2 Block Time | 2 seconds |
| Sequencer Drift | 600 seconds |
| Channel Timeout | 300 seconds |
| Finalization Period | 12 seconds |
| Governance Token | Symbol NZT, name Nexis |
| Fault Proofs | Enabled with max depth 73, max clock 600 seconds |
| Devnet RPC | http://127.0.0.1:9545 |
| Deployment Scripts | pnpm --filter @eth-optimism/contracts-bedrock run deploy:agents --network agentsL3 |
When deploying to Base testnet or mainnet, adjust the configuration file and environment variables accordingly before running the deployment scripts.
- Node.js ≥ 18 (monorepo enforces ≥ 16, recommended 18 LTS)
- pnpm ≥ 9 (
corepack enable, thencorepack prepare pnpm@latest --activate) - Go ≥ 1.21
- Python ≥ 3.10 (for
bedrock-devnettooling) - Docker Desktop or Docker Engine with Compose v2
- Foundry (
pnpm install:foundry) and Hardhat (installed via pnpm) for Solidity workflows
git clone https://github.com/Nexis-AI/nexis-appchain.git
cd nexis-appchain
pnpm install
pnpm buildpnpm build runs nx targets across the monorepo to compile Go binaries, TypeScript packages, and Solidity artifacts.
pnpm dev &
sleep 20The helper script performs the following:
- Spins up the Bedrock stack (op-node, op-batcher, op-proposer, op-challenger, infra services) via Docker Compose.
- Generates deterministic config and state snapshots into
.agents-devnet/. - Deploys the Nexis contracts suite using the Base-aligned configuration.
Stop the stack with:
pnpm dev:down
rm -rf .agents-devnet # optional cleanup- RPC:
http://127.0.0.1:9545 - Default chain ID:
84532 - Deployed contracts: artifacts stored at
packages/contracts-bedrock/deployments/AgentsL3/ - Hardhat network alias:
agentsL3
pnpm test # run nx test targets across packages
pnpm exec forge test # run Foundry contract tests
./scripts/agents-devnet/hardhat-test.sh # run Hardhat integration testsContinuous integration can target pnpm lint, pnpm test, and chain-specific smoke tests using the devnet scripts.
- Call
Agents.register(metadata, serviceURI)from the desired owner account. - Optionally delegate permissions using
setDelegate(agentId, permission, delegateAddress)for metadata edits, inference submissions, or withdrawals. - Update metadata or service endpoints at any time with
AgentMetadataUpdatedandAgentServiceURIUpdatedemitting on-chain events.
- Use
stakeETHorstakeERC20(agentId, asset, amount)to fund your agent. - Set unbonding periods per asset with
setAssetConfigurations(admin-controlled). - Initiate withdrawals through
beginWithdrawal, which queues aPendingWithdrawalreleased after the configured unbonding period. - Cancel or execute withdrawals once they mature; early exits incur penalties routed to the treasury via
handleEarlyExitPenalty.
- Create: Builders post tasks from
Tasks.postTask, specifying reward token, bond amount, metadata URI, optional input URI, and deadlines. - Claim: Agents lock stake using
Tasks.claimTask. Locked stake is tracked inAgentsto secure task delivery. - Submit Work: Use
Tasks.submitTaskwith the inference commitment ID produced viaAgents.recordInference. - Attest or Dispute: Verifiers with
VERIFIER_ROLEconfirm success (Tasks.completeTask) or flag disputes (Tasks.disputeTask). - Resolve: Authorized dispute managers slash stake or refund rewards through
Tasks.resolveTask, which communicates with the treasury for payouts or penalties.
Agents.recordInference(agentId, inputHash, outputHash, modelHash, taskId, proofURI)captures verifiable metadata.- Verifiers register attestations with
Agents.attestInference, unlocking rewards and reputation adjustments. - Reputation weights by dimension (
reliability,accuracy,performance,trustworthiness) are configurable to reflect desired incentive models.
- Slashes and penalties call
Treasury.handleSlashorhandleEarlyExitPenalty, dividing inflows between treasury, insurance, and rewards pools according toDistributionConfig. - Rewards teams distribute incentives with
distributeReward. Funds can be paid directly to agents or delegated payout addresses. - Governance can withdraw accumulated balances per pool using role-gated functions for treasury management.
- Subscriptions:
createSubscriptionlocks prefunded epochs and charges on a fixed cadence.processSubscriptiontriggers payouts when epochs elapse. - Streams:
createStreamstarts a per-second payment window; agents callwithdrawFromStreamto collect accrued balances. Streams can be paused or cancelled with refunds governed by role permissions. - Metadata URIs enable LangGraph or other orchestrators to fetch integration details tied to each subscription or stream.
Key events are emitted across the modules (AgentRegistered, StakeIncreased, TaskCreated, TaskCompleted, VerifierAttested, RewardPaid, SubscriptionProcessed, etc.). Use the provided indexer and endpoint-monitor services or integrate with your preferred ingestion stack to track lifecycle changes.
- Configuration: Adjust rollup parameters and governance addresses in
packages/contracts-bedrock/deploy-config/AgentsL3.jsonbefore deploying. - Contract Deployment: Update Hardhat network settings in
packages/contracts-bedrock/hardhat.config.tsto target new environments, then runpnpm --filter @eth-optimism/contracts-bedrock run deploy:agents --network <networkName>. - Artifacts: Deployment artifacts, ABIs, and addresses are written to
packages/contracts-bedrock/deployments/<Network>/. - Go Services: Build individual services with
go build ./op-node,go build ./op-proposer, etc., or rely onpnpm buildto run Nx orchestrated builds. - Make Targets:
make <target>wrappers are available for common flows (e.g.,make devnet-up) if you prefer GNU Make. - Formatting & Linting: Use
pnpm lint,pnpm lint:fix, and Go'sgofmtto keep changes consistent with repo standards.
| Path | Description |
|---|---|
packages/contracts-bedrock/contracts |
Nexis smart contracts and dependencies. |
packages/contracts-bedrock/scripts |
Hardhat deployment scripts, including deployAgents.ts. |
packages/contracts-bedrock/test |
Foundry and Hardhat test suites covering agent, task, treasury, and subscription flows. |
ops-bedrock/ |
Docker Compose manifests and configs bringing up the rollup stack locally. |
scripts/agents-devnet/ |
Shell helpers for devnet lifecycle and integration testing. |
bedrock-devnet/ |
Python tooling for deterministic bedrock devnets. |
indexer/, endpoint-monitor/, op-heartbeat/ |
Optional services for chain data, RPC health, and latency monitoring. |
specs/ |
Protocol specifications inherited from the Optimism stack. |
docs/ |
Additional documentation, audits, and post-mortems. |
- Devnet fails to start: Ensure Docker resources are sufficient (≥ 8 GB RAM) and no prior containers are running on required ports. Run
pnpm dev:downthen retry. - Missing pnpm: Enable corepack or install pnpm globally (
npm i -g pnpm) before running repo scripts. - Foundry not available: Execute
pnpm install:foundryand re-source your shell (source ~/.bashrcor restart terminal). - Hardhat network mismatch: Confirm
HARDHAT_NETWORK=agentsL3or adjust RPC URLs inpackages/contracts-bedrock/hardhat.config.ts. - Go build issues: Install Go 1.21+, set
GO111MODULE=on, and rungo env -w GOPRIVATE=github.com/ethereum-optimismif fetching private modules.
- Follow the guidelines in
CONTRIBUTING.mdbefore submitting pull requests or opening issues. - Security disclosures should follow
SECURITY.md. Please do not file public issues for vulnerabilities. - Typo fixes, documentation updates, and bug reports are welcome—batch changes thoughtfully to avoid noise.
This repository is licensed under the MIT License. Individual components may include additional third-party licenses; consult their respective directories for details.