-
-
+
Build the Future with Us
-
+
Join thousands of students learning to build on blockchain. Get exclusive access to
student resources, workshops, and opportunities to connect with the Avalanche Builder community.
diff --git a/components/navigation/docs-subnav.tsx b/components/navigation/docs-subnav.tsx
index 931f47c8cfb..47b999eb7d9 100644
--- a/components/navigation/docs-subnav.tsx
+++ b/components/navigation/docs-subnav.tsx
@@ -27,7 +27,7 @@ const tabs = [
pathMatch: (path: string) => path.startsWith("/docs/api-reference"),
},
{
- label: "Developer Tools",
+ label: "SDKs",
href: "/docs/tooling/avalanche-sdk",
pathMatch: (path: string) => path.startsWith("/docs/tooling"),
},
diff --git a/components/toolbox/hooks/useWrappedNativeToken.ts b/components/toolbox/hooks/useWrappedNativeToken.ts
index 9aef5747fc6..28aa4751052 100644
--- a/components/toolbox/hooks/useWrappedNativeToken.ts
+++ b/components/toolbox/hooks/useWrappedNativeToken.ts
@@ -33,8 +33,7 @@ export function useWrappedNativeToken(): WrappedNativeTokenHook {
abi: WrappedNativeToken.abi,
functionName: 'deposit',
value: parseEther(amount),
- account: walletEVMAddress as `0x${string}`,
- chain: viemChain
+ account: walletEVMAddress as `0x${string}`
});
notify({
@@ -55,8 +54,7 @@ export function useWrappedNativeToken(): WrappedNativeTokenHook {
abi: WrappedNativeToken.abi,
functionName: 'withdraw',
args: [parseEther(amount)],
- account: walletEVMAddress as `0x${string}`,
- chain: viemChain
+ account: walletEVMAddress as `0x${string}`
});
notify({
diff --git a/components/toolbox/stores/l1ListStore.ts b/components/toolbox/stores/l1ListStore.ts
index 2bd27eaac1f..5665e7542c3 100644
--- a/components/toolbox/stores/l1ListStore.ts
+++ b/components/toolbox/stores/l1ListStore.ts
@@ -110,32 +110,6 @@ const l1ListInitialStateFuji = {
"EVM-compatible L1 chain",
"Deploy dApps & test interoperability with Dispatch"
]
- },
- {
- id: "2TTSLdR6uEM3R5Ukej3YThHSyPf6XCfppAsh5vAuzFA1rY5w7e",
- name: "Dexalot",
- description: "Dexalot is a decentralized exchange (DEX) that operates on its own Avalanche L1, offering a central limit order book (CLOB) experience",
- rpcUrl: "https://subnets.avax.network/dexalot/testnet/rpc",
- evmChainId: 432201,
- coinName: "ALOT",
- isTestnet: true,
- subnetId: "9m6a3Qte8FaRbLZixLhh8Ptdkemm4csNaLwQeKkENx5wskbWP",
- wrappedTokenAddress: "",
- validatorManagerAddress: "",
- logoUrl: "https://images.ctfassets.net/gcj8jwzm6086/6tKCXL3AqxfxSUzXLGfN6r/be31715b87bc30c0e4d3da01a3d24e9a/dexalot-subnet.png",
- wellKnownTeleporterRegistryAddress: "0xF86Cb19Ad8405AEFa7d09C778215D2Cb6eBfB228",
- hasBuilderHubFaucet: true,
- externalFaucetUrl: "https://core.app/tools/testnet-faucet",
- explorerUrl: "https://subnets-test.avax.network/dexalot",
- faucetThresholds: {
- threshold: 1.0,
- dripAmount: 2
- },
- features: [
- "EVM-compatible L1 chain",
- "Decentralized exchange with CLOB",
- "Deploy dApps on Dexalot L1"
- ]
}
] as L1ListItem[],
}
diff --git a/content/academy/avalanche-l1/permissionless-l1s/index.mdx b/content/academy/avalanche-l1/permissionless-l1s/index.mdx
index 52c476e0b79..c88338a4de4 100644
--- a/content/academy/avalanche-l1/permissionless-l1s/index.mdx
+++ b/content/academy/avalanche-l1/permissionless-l1s/index.mdx
@@ -32,8 +32,8 @@ If you just completed these recently, you can go ahead and skip the [Review chap
This comprehensive course will walk you through:
- **Proof of Stake** - Understanding PoS consensus, staking token selection, and liquid staking considerations
-- **Transformation Requirements** - Basic precmpoiles (Native Minter and Reward Manager) needed to transform your L1 into a permissionless network
-- **Basic Setup**(*optional*) - Deploying Validator Manager Contract, upgrading proxy, and initializing validator configuration
+- **Necessary Precompiles** - Native Minter and Reward Manager precompiles for tokenomics
+- **Basic Setup** - Deploying Validator Manager Contract, upgrading proxy, and initializing validator configuration
- **Staking Manager Setup** - Deploying and configuring staking managers for native token staking
- **Staking Manager Operations** - Adding, changing weights, removing validators, and handling delegation
- **Node Licenses** - Understanding validator licensing and real-world examples
diff --git a/content/docs/acps/meta.json b/content/docs/acps/meta.json
index 9de1b3dce84..fd3c33c247a 100644
--- a/content/docs/acps/meta.json
+++ b/content/docs/acps/meta.json
@@ -7,7 +7,6 @@
"---Overview---",
"index",
"---Standards Track ACPs---",
- "236-continuous-staking",
"226-dynamic-minimum-block-times",
"224-dynamic-gas-limit-in-subnet-evm",
"209-eip7702-style-account-abstraction",
diff --git a/content/docs/dapps/encrypted-erc.mdx b/content/docs/dapps/encrypted-erc.mdx
new file mode 100644
index 00000000000..8a3b0f8a7d6
--- /dev/null
+++ b/content/docs/dapps/encrypted-erc.mdx
@@ -0,0 +1,523 @@
+---
+title: EncryptedERC
+description: Privacy-preserving ERC-20 token protocol with confidential transfers using zero-knowledge proofs on Avalanche.
+keywords: [encryptederc, privacy, zero-knowledge proofs, zk-snarks, homomorphic encryption, confidential transactions, erc-20, avalanche]
+---
+
+import { Step, Steps } from 'fumadocs-ui/components/steps';
+
+**EncryptedERC** is a privacy-preserving ERC-20 token protocol developed by AvaCloud that enables secure and confidential token transfers on Avalanche blockchains using zero-knowledge proofs (zk-SNARKs) and homomorphic encryption.
+
+[View on GitHub →](https://github.com/ava-labs/EncryptedERC)
+
+## What Is EncryptedERC?
+
+EncryptedERC is a protocol that allows users to perform private token transfers where balances and transaction amounts remain completely hidden on-chain. The system leverages advanced cryptography to maintain privacy without requiring protocol modifications or off-chain intermediaries.
+
+### Key Benefits
+
+- **Complete Privacy**: User balances and transaction amounts are fully encrypted on-chain
+- **No Intermediaries**: Fully on-chain protocol with no relayers or trusted third parties
+- **Client-Side Security**: All encryption, decryption, and proof generation happens locally
+- **Compliance Ready**: Built-in support for external auditors and regulatory requirements
+- **EVM Compatible**: Works on any EVM-compatible blockchain including Avalanche C-Chain
+- **Large Value Support**: Handles token amounts up to 2^251 (suitable for enterprise use)
+
+### How It Works
+
+1. Users register with the protocol by generating an encryption key pair
+2. Tokens are encrypted before being stored on-chain
+3. Users perform operations (transfer, mint, withdraw) with zero-knowledge proofs
+4. The smart contract verifies proofs without revealing sensitive information
+5. Only users with the private key can decrypt their balance
+
+## Why Avalanche for Private Transactions?
+
+| Aspect | Benefit |
+|--------|---------|
+| **Low gas costs** | Makes privacy operations economically viable (~565K-1M gas per operation) |
+| **Fast finality** | Sub-second transaction confirmation for private transfers |
+| **EVM compatible** | Deploy using familiar Solidity and Ethereum tooling |
+| **Scalable** | High throughput supports multiple concurrent private transactions |
+| **Customizable** | Deploy on custom Avalanche L1s with specific privacy rules |
+
+## Features
+
+### Privacy Features
+- **Confidential Balances**: All user balances are encrypted using homomorphic encryption
+- **Hidden Transaction Amounts**: Transfer amounts never revealed on-chain
+- **Encrypted Metadata**: Send arbitrary encrypted data with transactions
+- **Zero-Knowledge Proofs**: Prove transaction validity without revealing details
+
+### Operational Modes
+- **Standalone Mode**: Create entirely new private ERC-20 tokens with minting/burning capabilities
+- **Converter Mode**: Wrap existing ERC-20 tokens for private transfers (deposit/withdraw)
+
+### Compliance & Security
+- **Auditor Support**: Optional external auditors can view encrypted transactions
+- **Rotatable Auditors**: Change auditors without disrupting the protocol
+- **Blacklist Integration**: Optional blacklisting for regulatory compliance
+- **Security Audited**: Underwent comprehensive Circom and Gnark audits in March 2025
+
+### Developer Experience
+- **TypeScript SDK**: Full TypeScript support for client-side operations
+- **Hardhat Integration**: Seamless development and testing workflow
+- **Comprehensive Tests**: ~97% test coverage
+- **Clear Documentation**: API documentation and deployment examples
+
+## Getting Started
+
+
+
+
+### Prerequisites
+
+Ensure you have the following installed:
+
+- **Node.js**: Version 22.x or later
+- **Circom**: Version 2.1.9 or later
+- **Git**: For cloning the repository
+
+Install Circom if you don't have it:
+
+```bash
+# Install Circom (see https://docs.circom.io/getting-started/installation/)
+curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh
+git clone https://github.com/iden3/circom.git
+cd circom
+cargo build --release
+cargo install --path circom
+```
+
+
+
+
+
+### Clone and Install
+
+Clone the repository and install dependencies:
+
+```bash
+git clone https://github.com/ava-labs/EncryptedERC.git
+cd EncryptedERC
+npm install
+```
+
+
+
+
+
+### Compile Contracts and Circuits
+
+Compile the Solidity contracts:
+
+```bash
+npx hardhat compile
+```
+
+Generate zero-knowledge circuits and verifiers:
+
+```bash
+# Generate circuits (this may take several minutes)
+npx hardhat zkit make --force
+
+# Generate verifier contracts
+npx hardhat zkit verifiers
+```
+
+
+
+
+
+### Run Tests
+
+Verify everything is working correctly:
+
+```bash
+# Run all tests
+npm test
+
+# Run specific test suite
+npx hardhat test test/EncryptedERC.test.ts
+
+# Generate coverage report
+npx hardhat coverage
+```
+
+
+
+
+
+### Deploy to Avalanche
+
+Deploy the protocol to Avalanche C-Chain or Fuji Testnet:
+
+**Standalone Mode** (new private token):
+
+```bash
+# Configure deployment in scripts/deploy-standalone.ts
+npx hardhat run scripts/deploy-standalone.ts --network avalanche
+```
+
+**Converter Mode** (wrap existing ERC-20):
+
+```bash
+# Configure deployment in scripts/deploy-converter.ts
+npx hardhat run scripts/deploy-converter.ts --network avalanche
+```
+
+Configure your network in `hardhat.config.ts`:
+
+```typescript
+networks: {
+ avalanche: {
+ url: 'https://api.avax.network/ext/bc/C/rpc',
+ chainId: 43114,
+ accounts: [process.env.PRIVATE_KEY]
+ },
+ fuji: {
+ url: 'https://api.avax-test.network/ext/bc/C/rpc',
+ chainId: 43113,
+ accounts: [process.env.PRIVATE_KEY]
+ }
+}
+```
+
+
+
+
+## Architecture
+
+### Core Contracts
+
+The protocol consists of five main smart contracts:
+
+**EncryptedERC** (`EncryptedERC.sol`):
+- Main contract for private token operations
+- Handles transfers, mints, and burns with ZK proofs
+- Manages encrypted balances and state transitions
+
+**Registrar** (`Registrar.sol`):
+- User registration and public key management
+- Stores BabyJubJub public keys for encryption
+- Enables key rotation for users
+
+**EncryptedUserBalances** (`EncryptedUserBalances.sol`):
+- Stores encrypted balance data on-chain
+- Manages balance ciphertexts and nullifiers
+- Provides balance query functions
+
+**TokenTracker** (`TokenTracker.sol`):
+- Token registration and metadata management
+- Tracks token supply and configuration
+- Handles token-specific parameters
+
+**AuditorManager** (`AuditorManager.sol`):
+- Compliance and auditor management
+- Rotatable auditor keys for regulatory oversight
+- Optional transaction monitoring
+
+### Cryptographic Components
+
+**Zero-Knowledge Circuits**:
+- `registration.circom`: User registration proofs
+- `mint.circom`: Private minting proofs
+- `transfer.circom`: Private transfer proofs
+- `withdraw.circom`: Private withdrawal proofs
+
+**Encryption**:
+- BabyJubJub elliptic curve cryptography
+- Homomorphic encryption for balance operations
+- Groth16 proving system for efficient verification
+
+### Gas Costs (Avalanche C-Chain)
+
+Average on-chain gas consumption:
+
+| Operation | Gas Cost |
+|-----------|----------|
+| User Registration | ~322K gas |
+| Deposit (Converter Mode) | ~565K gas |
+| Private Transfer | ~947K gas |
+| Private Mint | ~722K gas |
+| Private Burn | ~1.03M gas |
+
+## Use Cases
+
+### Private DeFi
+
+Build privacy-preserving DeFi applications:
+
+- Confidential lending and borrowing
+- Private liquidity pools
+- Hidden collateral positions
+- Anonymous yield farming
+
+### Enterprise Tokenization
+
+Enable enterprise use cases requiring privacy:
+
+- Confidential payroll tokens
+- Private equity distributions
+- Supply chain finance with hidden amounts
+- Confidential treasury management
+
+### Compliant Privacy
+
+Combine privacy with regulatory compliance:
+
+- KYC-compliant private transactions
+- Auditor-visible transaction monitoring
+- Selective disclosure for regulators
+- Privacy-preserving tax reporting
+
+### Gaming and NFTs
+
+Create privacy features for gaming economies:
+
+- Hidden in-game currency balances
+- Private marketplace transactions
+- Confidential reward distributions
+- Anonymous player-to-player trades
+
+## Customization
+
+### Deploy Standalone Private Token
+
+Create a completely new private token:
+
+```typescript
+// scripts/deploy-standalone.ts
+import { ethers } from "hardhat";
+
+async function main() {
+ // Deploy with custom parameters
+ const EncryptedERC = await ethers.getContractFactory("EncryptedERC");
+ const token = await EncryptedERC.deploy(
+ "Private Token", // name
+ "PRIV", // symbol
+ 18, // decimals
+ true // standalone mode
+ );
+
+ await token.deployed();
+ console.log("EncryptedERC deployed to:", token.address);
+}
+
+main();
+```
+
+### Deploy Converter for Existing ERC-20
+
+Wrap an existing token for private transfers:
+
+```typescript
+// scripts/deploy-converter.ts
+import { ethers } from "hardhat";
+
+async function main() {
+ const existingTokenAddress = "0x..."; // Your ERC-20 token
+
+ const EncryptedERC = await ethers.getContractFactory("EncryptedERC");
+ const privateToken = await EncryptedERC.deploy(
+ existingTokenAddress, // token to wrap
+ false // converter mode
+ );
+
+ await privateToken.deployed();
+ console.log("Converter deployed to:", privateToken.address);
+}
+
+main();
+```
+
+### Add Auditor Support
+
+Enable auditor functionality for compliance:
+
+```typescript
+// Enable auditor during deployment
+const auditorPublicKey = "0x..."; // Auditor's BabyJubJub public key
+
+await encryptedERC.setAuditor(auditorPublicKey, true);
+console.log("Auditor enabled");
+
+// Rotate auditor
+await encryptedERC.rotateAuditor(newAuditorPublicKey);
+```
+
+### Configure Blacklist
+
+Add blacklisting for regulatory compliance:
+
+```typescript
+// Enable blacklist functionality
+await encryptedERC.enableBlacklist();
+
+// Add address to blacklist
+await encryptedERC.addToBlacklist(userAddress);
+
+// Remove from blacklist
+await encryptedERC.removeFromBlacklist(userAddress);
+```
+
+## Client-Side Integration
+
+### User Registration
+
+Register a user with encryption keys:
+
+```typescript
+import { generateKeyPair, register } from './encryptedERC-sdk';
+
+// Generate BabyJubJub key pair
+const { publicKey, privateKey } = generateKeyPair();
+
+// Register on-chain
+const tx = await encryptedERC.register(publicKey);
+await tx.wait();
+
+// Store private key securely (user-side only!)
+localStorage.setItem('encryptedERC_privateKey', privateKey);
+```
+
+### Private Transfer
+
+Perform a confidential transfer:
+
+```typescript
+import { encryptTransfer, generateTransferProof } from './encryptedERC-sdk';
+
+// Encrypt transfer details
+const encryptedAmount = encryptTransfer(
+ recipientPublicKey,
+ amount
+);
+
+// Generate ZK proof
+const proof = await generateTransferProof(
+ senderPrivateKey,
+ recipientPublicKey,
+ amount
+);
+
+// Submit on-chain
+const tx = await encryptedERC.transfer(
+ recipient,
+ encryptedAmount,
+ proof
+);
+await tx.wait();
+```
+
+### Check Encrypted Balance
+
+Decrypt and view your balance:
+
+```typescript
+import { decryptBalance } from './encryptedERC-sdk';
+
+// Fetch encrypted balance from chain
+const encryptedBalance = await encryptedERC.getEncryptedBalance(userAddress);
+
+// Decrypt locally with private key
+const balance = decryptBalance(
+ encryptedBalance,
+ userPrivateKey
+);
+
+console.log("Your balance:", balance);
+```
+
+## Security Considerations
+
+### Audits
+
+EncryptedERC underwent comprehensive security audits:
+
+- **Circom Audit** (March 2025): Focused on zero-knowledge circuit implementations
+- **Gnark Audit** (March 2025): Covered smart contract and protocol security
+
+Audit reports are available in the `audit/` directory of the repository.
+
+### Best Practices
+
+Follow these security guidelines:
+
+- **Never share private keys**: Private keys enable balance decryption and transaction signing
+- **Store keys securely**: Use hardware wallets or secure key management systems
+- **Validate proofs**: Always verify zero-knowledge proofs before accepting transactions
+- **Regular updates**: Keep circuits and contracts updated with latest security patches
+- **Test thoroughly**: Run comprehensive tests before mainnet deployment
+- **Enable auditors**: Consider enabling auditor functionality for compliance
+- **Monitor gas usage**: Private operations consume significant gas
+
+### Key Management
+
+Implement secure key management:
+
+- Use deterministic key derivation (BIP-32/BIP-44)
+- Implement key rotation mechanisms
+- Back up keys with secure recovery phrases
+- Use multi-signature schemes for high-value accounts
+- Consider hardware security modules (HSMs) for production
+
+## Deployment
+
+### Mainnet Deployment (Avalanche C-Chain)
+
+Deploy to Avalanche mainnet for production use:
+
+```bash
+# Set environment variables
+export PRIVATE_KEY="your_private_key"
+export AVALANCHE_RPC="https://api.avax.network/ext/bc/C/rpc"
+
+# Deploy standalone mode
+npx hardhat run scripts/deploy-standalone.ts --network avalanche
+
+# Or deploy converter mode
+npx hardhat run scripts/deploy-converter.ts --network avalanche
+```
+
+### Testnet Deployment (Fuji)
+
+Test on Avalanche Fuji testnet:
+
+```bash
+# Get test AVAX from faucet: https://core.app/tools/testnet-faucet
+
+# Deploy to Fuji
+npx hardhat run scripts/deploy-standalone.ts --network fuji
+```
+
+### Production Checklist
+
+Complete the following before mainnet deployment:
+
+- Audit all custom circuit modifications
+- Test extensively on Fuji testnet
+- Verify gas costs are acceptable for your use case
+- Implement secure key management system
+- Configure auditor if compliance is required
+- Set up monitoring and alerting
+- Document user key backup procedures
+- Plan for circuit upgrade path
+- Review blacklist requirements
+- Perform security assessment
+
+## Resources
+
+- [GitHub Repository](https://github.com/ava-labs/EncryptedERC) - EncryptedERC source code
+- [Circom Documentation](https://docs.circom.io/) - Zero-knowledge circuit language
+- [BabyJubJub Curve](https://eips.ethereum.org/EIPS/eip-2494) - Elliptic curve cryptography standard
+- [Groth16 Paper](https://eprint.iacr.org/2016/260.pdf) - Zero-knowledge proof system
+- [Avalanche C-Chain Documentation](/docs/dapps) - Learn about Avalanche C-Chain
+
+## Support
+
+For issues, questions, or contributions:
+
+- Open an issue on [GitHub](https://github.com/ava-labs/EncryptedERC/issues)
+- Join the [Avalanche Discord](https://discord.gg/avalanche)
+- Check the [Avalanche Builders Hub](https://builders-hub.avalabs.org)
diff --git a/content/docs/dapps/meta.json b/content/docs/dapps/meta.json
index 35c5c1d3c42..19cf4f719ea 100644
--- a/content/docs/dapps/meta.json
+++ b/content/docs/dapps/meta.json
@@ -8,6 +8,9 @@
"index",
"c-chain-or-avalanche-l1",
"[Block Explorers](/integrations#Block%20Explorers)",
+ "---Starter Kits---",
+ "x402-starter-kit",
+ "encrypted-erc",
"---Smart Contract Development---",
"smart-contract-dev/get-test-funds",
"smart-contract-dev/deploy-with-remix-ide",
diff --git a/content/docs/dapps/x402-starter-kit.mdx b/content/docs/dapps/x402-starter-kit.mdx
new file mode 100644
index 00000000000..dcfa5bbe350
--- /dev/null
+++ b/content/docs/dapps/x402-starter-kit.mdx
@@ -0,0 +1,393 @@
+---
+title: x402 Starter Kit
+description: Build payment-gated APIs and content services using the x402 protocol on Avalanche.
+keywords: [x402, payment protocol, micropayments, next.js, avalanche c-chain, api monetization, payment-gated content, eip-712, usdc payments]
+---
+
+import { Step, Steps } from 'fumadocs-ui/components/steps';
+
+The **x402 Starter Kit** is a production-ready Next.js template that demonstrates how to build payment-gated APIs and content services using the **x402 protocol** on Avalanche C-Chain.
+
+[View on GitHub →](https://github.com/tomi204/x402-starter-kit)
+
+## What Is x402?
+
+x402 is an open payment protocol that uses HTTP status code **402 "Payment Required"** to enable seamless cryptocurrency payments for web content and APIs. Learn more at [x402.org](https://www.x402.org/).
+
+### Key Benefits
+
+- **Direct Payments**: Accept cryptocurrency payments without third-party payment processors
+- **No Accounts**: No user registration or authentication required
+- **Blockchain-Verified**: Payments are verified directly on the Avalanche blockchain
+- **Simple Integration**: Add payment gates to any Next.js route with middleware
+- **Flexible Pricing**: Set different prices for different content in USD
+
+### Payment Flow
+
+1. User requests protected content
+2. Server responds with **402 Payment Required**
+3. User makes payment via wallet
+4. User proves payment with transaction signature
+5. Server verifies payment on Avalanche blockchain
+6. Access is granted to protected content
+
+## Why Avalanche + x402?
+
+| Aspect | Benefit |
+|--------|---------|
+| **Sub-second finality** | Instant payment verification |
+| **Low gas fees (~$0.01)** | Makes micropayments ($0.01+) economically viable |
+| **EVM compatible** | Use familiar Ethereum tooling and Solidity contracts |
+| **4,500+ TPS** | High throughput for serving many concurrent users |
+| **Established network** | Production-proven since 2020 with active ecosystem |
+
+## Features
+
+### Payment Infrastructure
+- **x402 Protocol Integration**: HTTP 402 status code with blockchain verification
+- **Micropayment Support**: Enable sub-dollar transactions with low overhead
+- **USD-Denominated Pricing**: Automatic conversion to AVAX/USDC at current rates
+- **EIP-712 Signatures**: Gasless authorization using `transferWithAuthorization`
+- **Network Support**: Both Mainnet (43114) and Fuji Testnet (43113)
+
+### Demo Endpoints
+- `/api/premium-data` - Market insights ($0.01 USDC)
+- `/api/ai-analysis` - AI-powered market analysis ($0.25 USDC)
+- `/content/[type]` - Payment-gated content pages
+
+### Developer Experience
+- **Wallet Connection**: Reown (WalletConnect v3) integration
+- **Modern UI**: Tailwind CSS 4 with animated backgrounds
+- **Type Safety**: Full TypeScript support
+- **AI Integration**: Optional OpenRouter support for AI features
+
+## Getting Started
+
+
+
+
+### Clone the Repository
+
+```bash
+git clone https://github.com/tomi204/x402-starter-kit.git
+cd x402-starter-kit/starters/nextjs
+```
+
+
+
+
+
+### Install Dependencies
+
+```bash
+npm install
+# or
+yarn install
+# or
+pnpm install
+```
+
+
+
+
+
+### Get Reown Project ID
+
+You'll need a free Reown Project ID for wallet connection:
+
+1. Visit [cloud.reown.com](https://cloud.reown.com)
+2. Sign up (free account)
+3. Create a new project
+4. Copy the Project ID
+
+
+
+
+
+### Configure Environment
+
+Copy the example environment file:
+
+```bash
+cp .env.example .env.local
+```
+
+Edit `.env.local` with your settings:
+
+```bash
+# Your EVM wallet address (where payments go)
+NEXT_PUBLIC_RECEIVER_ADDRESS=0x1234567890123456789012345678901234567890
+
+# Network: avalanche-fuji (testnet) or avalanche (mainnet)
+NEXT_PUBLIC_NETWORK=avalanche-fuji
+
+# Facilitator service for payment verification
+NEXT_PUBLIC_FACILITATOR_URL=https://facilitator.ultravioletadao.xyz
+
+# Your Reown Project ID (REQUIRED)
+NEXT_PUBLIC_REOWN_PROJECT_ID=your_reown_project_id_here
+
+# Optional: OpenRouter API key for real AI features
+OPENROUTER_API_KEY=sk-or-v1-your_api_key_here
+```
+
+**Required Variables:**
+
+| Variable | Purpose | Where to Get |
+|----------|---------|--------------|
+| `NEXT_PUBLIC_RECEIVER_ADDRESS` | Your wallet address that receives payments | Your EVM wallet (MetaMask, Core, etc.) |
+| `NEXT_PUBLIC_NETWORK` | Blockchain network | Use `avalanche-fuji` for testing |
+| `NEXT_PUBLIC_FACILITATOR_URL` | Payment verification service | Use provided URL |
+| `NEXT_PUBLIC_REOWN_PROJECT_ID` | Wallet connection | [cloud.reown.com](https://cloud.reown.com) |
+
+
+
+
+
+### Run Development Server
+
+```bash
+npm run dev
+# or
+yarn dev
+# or
+pnpm dev
+```
+
+Visit [http://localhost:3000](http://localhost:3000) to see your app running.
+
+
+
+
+
+### Test the Payment Flow
+
+1. Click on **"Access Cheap Content"** or **"Access Expensive Content"**
+2. Connect your wallet when prompted
+3. You'll see a payment modal
+4. Complete the payment (on testnet, make sure you have test AVAX)
+5. Access is granted and you'll see the protected content
+
+Make sure you're using Avalanche Fuji testnet. You can get test AVAX from the [Fuji Faucet](https://core.app/tools/testnet-faucet).
+
+
+
+
+## Project Structure
+
+```
+starters/nextjs/
+├── app/
+│ ├── api/
+│ │ ├── ai-analysis/route.ts # AI analysis endpoint ($0.25)
+│ │ ├── premium-data/route.ts # Market data endpoint ($0.01)
+│ │ └── test-payment/route.ts # Test endpoint
+│ ├── content/
+│ │ └── [type]/page.tsx # Dynamic content pages
+│ ├── page.tsx # Landing page
+│ └── layout.tsx # Root layout with providers
+│
+├── components/ui/ # React UI components
+│
+├── lib/
+│ ├── x402-middleware.ts # Server-side payment verification
+│ ├── x402-client.ts # Client-side payment handling
+│ ├── facilitator.ts # Facilitator API helpers
+│ ├── ai-service.ts # AI integration (OpenRouter)
+│ ├── config.ts # Wallet configuration
+│ └── context.tsx # React providers
+│
+├── middleware.ts # Next.js middleware (payment protection)
+├── .env.example # Environment template
+└── package.json # Dependencies
+```
+
+## How It Works
+
+### Payment Verification Flow
+
+The template uses Next.js middleware to intercept requests and verify payments:
+
+```typescript
+// middleware.ts defines protected routes
+const protectedRoutes = {
+ "/api/premium-data": {
+ maxAmountRequired: "10000", // 0.01 USDC (6 decimals)
+ description: "Premium data access"
+ },
+ "/api/ai-analysis": {
+ maxAmountRequired: "250000", // 0.25 USDC
+ description: "AI-powered market analysis"
+ }
+}
+```
+
+The payment verification follows this flow:
+
+```
+User Request → Middleware Checks Payment
+ ↓
+No Payment? → Return 402 Payment Required
+ ↓
+User Signs Payment → Retry Request with Payment Header
+ ↓
+Middleware Verifies with Facilitator → Check Blockchain
+ ↓
+Valid Payment? → Proceed to API Route → Return Content
+```
+
+### Core Components
+
+The template consists of three main components:
+
+**Middleware** (`middleware.ts`):
+- Intercepts requests to protected routes
+- Returns 402 if no valid payment exists
+- Verifies payments via facilitator
+
+**x402 Client** (`lib/x402-client.ts`):
+- Handles client-side payment flow
+- Creates EIP-712 signatures
+- Retries requests with payment proof
+
+**x402 Middleware Library** (`lib/x402-middleware.ts`):
+- Payment verification logic
+- Facilitator communication
+- Payment settlement
+
+## Customization
+
+### Add New Protected Route
+
+Edit `middleware.ts` to add more protected endpoints:
+
+```typescript
+const protectedRoutes = {
+ // ... existing routes
+ "/api/premium-forecast": {
+ maxAmountRequired: "500000", // $0.50 USDC
+ description: "Premium 30-day price forecast"
+ }
+}
+```
+
+### Change Pricing
+
+Amounts are in USDC with 6 decimals:
+
+```typescript
+"10000" // $0.01
+"500000" // $0.50
+"1000000" // $1.00
+```
+
+### Add AI Features
+
+To enable real AI-powered analysis:
+
+1. Get an API key from [OpenRouter](https://openrouter.ai)
+2. Add to `.env.local`:
+
+```bash
+OPENROUTER_API_KEY=sk-or-v1-your_api_key_here
+```
+
+3. The template will automatically use real AI instead of mock data
+
+You can change the AI model in `app/api/ai-analysis/route.ts`:
+
+```typescript
+const aiService = new AIService({
+ apiKey: process.env.OPENROUTER_API_KEY,
+ model: 'anthropic/claude-3.5-sonnet', // or 'openai/gpt-4o'
+ temperature: 0.7,
+ maxTokens: 800,
+});
+```
+
+## Use Cases
+
+### API Monetization
+
+Build AI-powered APIs that users pay per request:
+
+- Market analysis services
+- Data feeds and analytics
+- AI content generation
+- Real-time insights
+
+### Premium Content
+
+Create token-gated content:
+
+- Educational materials
+- Research reports
+- Trading signals
+- Expert analysis
+
+### AI Agent Economy
+
+Enable autonomous agents to offer services:
+
+- Agents earn from user interactions
+- Instant blockchain settlement
+- No intermediary required
+- Dynamic pricing per service
+
+### Micropayment Services
+
+Viable micropayments due to low Avalanche fees:
+
+- Per-article access
+- API call pricing
+- Content unlocking
+- Service consumption
+
+## Deployment
+
+### Vercel (Recommended)
+
+The easiest way to deploy is using [Vercel](https://vercel.com):
+
+```bash
+npm run build
+vercel deploy --prod
+```
+
+Add all environment variables from `.env.local` in Vercel Dashboard → Settings → Environment Variables.
+
+### Self-Hosted
+
+```bash
+npm run build
+npm start
+```
+
+### Production Checklist
+
+Complete the following steps before deploying to production:
+
+- Use `avalanche` (mainnet) instead of `avalanche-fuji`
+- Set real wallet address for payment collection
+- Test payment flow thoroughly on testnet first
+- Enable OpenRouter API for real AI features (optional)
+- Configure proper Reown project
+- Set up monitoring and error tracking
+- Review security best practices
+
+## Resources
+
+- [x402 Protocol](https://www.x402.org/) - Official x402 protocol website
+- [UltraViolet DAO Facilitator](https://facilitator.ultravioletadao.xyz/) - Payment verification service
+- [x402 on Avalanche Ecosystem](https://build.avax.network/integrations#x402) - View x402 in Avalanche integrations
+- [GitHub Repository](https://github.com/tomi204/x402-starter-kit) - x402 Starter Kit source code
+- [OpenRouter](https://openrouter.ai/) - AI API aggregator for AI features
+- [Avalanche C-Chain Documentation](/docs/dapps) - Learn about Avalanche C-Chain
+
+## Support
+
+For issues, questions, or contributions:
+
+- Open an issue on [GitHub](https://github.com/tomi204/x402-starter-kit/issues)
+- Join the [Avalanche Discord](https://discord.gg/avalanche)
+- Check the [Avalanche Builders Hub](https://builders-hub.avalabs.org)
diff --git a/utils/remote-content/acps.mts b/utils/remote-content/acps.mts
index 2012388a02a..cd44d86db63 100644
--- a/utils/remote-content/acps.mts
+++ b/utils/remote-content/acps.mts
@@ -209,7 +209,7 @@ async function generateAcpConfigs(): Promise
{
outputPath: "content/docs/acps/index.mdx",
title: "Avalanche Community Proposals (ACPs)",
description: "Official framework for proposing improvements and gathering consensus around changes to the Avalanche Network",
- contentUrl: "https://github.com/avalanche-foundation/ACPs/blob/main/",
+ contentUrl: "https://raw.githubusercontent.com/avalanche-foundation/ACPs/main/",
});
// Generate configs for each ACP