Skip to main content

Building on Nexis

Welcome to the comprehensive guide for building decentralized AI applications on Nexis Appchain. This guide covers everything from network setup to production deployment, with a focus on integrating AI agents with blockchain smart contracts.

Why Nexis for AI dApps?

Native AI Primitives

Built-in contracts for agents, tasks, and proof-of-inference

High Performance

2-second block times with 1 gwei base fee for AI operations

Full EVM Compatibility

Use existing tools: Hardhat, Foundry, Remix, ethers.js, wagmi

Layer 2 Benefits

Low-cost transactions with Ethereum-grade security

Quick Start

Network Configuration

Add Nexis networks to your development environment:

Smart Contract Development Lifecycle

1. Setup Your Project

2. Write Smart Contracts

Create a smart contract that integrates with Nexis AI agents:

3. Write Comprehensive Tests

4. Deploy to Testnet

Integrating AI Agents

Frontend Integration with wagmi

Backend AI Agent Integration

Gas Optimization for AI Operations

1. Use Events for Large Data

2. Batch Operations

3. Optimize Storage

Common Design Patterns

1. Pull Over Push Payments

2. Circuit Breaker Pattern

3. Oracle Pattern for Off-Chain Data

Testing Strategies

Unit Tests

  • Test individual contract functions
  • Mock external dependencies
  • Cover edge cases and error conditions

Integration Tests

  • Test contract interactions
  • Use actual contract addresses on testnet
  • Test full user workflows

Fuzzing Tests

Load Tests

Production Deployment Checklist

  • Security Audit: Get contracts audited by reputable firm
  • Test Coverage: Achieve >90% code coverage
  • Gas Optimization: Profile and optimize expensive operations
  • Upgrade Strategy: Implement proxy pattern if needed
  • Monitoring: Setup event indexing and alerts
  • Documentation: Write complete API documentation
  • Emergency Procedures: Define pause/upgrade procedures
  • Testnet Validation: Run on testnet for 2+ weeks
  • Bug Bounty: Launch bug bounty program
  • Mainnet Deployment: Deploy with ceremony/multisig

Resources

Testnet Tokens

Get test NZT for development

Smart Contracts Reference

Complete contract documentation

RPC API Methods

Available RPC endpoints

Example dApps

View complete examples on GitHub

Next Steps

  1. Get Testnet Tokens: Visit the faucet to get test NZT
  2. Deploy Your First Contract: Follow the quickstart guide
  3. Integrate AI Agents: Register an agent and create your first task
  4. Join the Community: Get help on Discord

Need help? Join our Developer Discord or check GitHub Discussions for community support.