-
-
+
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..1b443f7fd89 100644
--- a/components/navigation/docs-subnav.tsx
+++ b/components/navigation/docs-subnav.tsx
@@ -14,7 +14,8 @@ const tabs = [
!path.startsWith("/docs/api-reference") &&
!path.startsWith("/docs/rpcs") &&
!path.startsWith("/docs/tooling") &&
- !path.startsWith("/docs/acps")),
+ !path.startsWith("/docs/acps") &&
+ !path.startsWith("/docs/templates")),
},
{
label: "Node RPCs",
@@ -27,10 +28,15 @@ 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"),
},
+ {
+ label: "Templates",
+ href: "/docs/templates",
+ pathMatch: (path: string) => path.startsWith("/docs/templates"),
+ },
{
label: "ACPs",
href: "/docs/acps",
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/permissionless-l1s/02-proof-of-stake/01-introduction.mdx b/content/academy/permissionless-l1s/02-proof-of-stake/01-introduction.mdx
index f8d3984b73b..6078f74e323 100644
--- a/content/academy/permissionless-l1s/02-proof-of-stake/01-introduction.mdx
+++ b/content/academy/permissionless-l1s/02-proof-of-stake/01-introduction.mdx
@@ -6,12 +6,6 @@ authors: [nicolasarnedo]
icon: Book
---
-## The Transformation: Two Pieces of the Puzzle
-
-Converting from PoA to PoS isn't about replacing your entire blockchain—it's about strategically combining two concepts you may have already learned in separate courses:
-
-
-
## Proof of Stake as Sybil Protection
Proof of Stake (PoS) is fundamentally a **Sybil protection mechanism** that secures blockchain networks by preventing malicious actors from gaining control through the creation of multiple fake identities. Sybil protection mechanisms serve three critical functions:
diff --git a/content/academy/permissionless-l1s/03-transformation-requirements/01-introduction.mdx b/content/academy/permissionless-l1s/03-transformation-requirements/01-introduction.mdx
deleted file mode 100644
index 3433851b098..00000000000
--- a/content/academy/permissionless-l1s/03-transformation-requirements/01-introduction.mdx
+++ /dev/null
@@ -1,48 +0,0 @@
----
-title: Native Token Staking Blockchain
-description: Precompile contracts necessary for a Permissionless L1 implementation
-updated: 2025-03-13
-authors: [nicolasarnedo]
-icon: Book
----
-
-## From Proof of Authority to Proof of Stake
-
-Now that we've covered how Proof of Stake serves as a Sybil protection mechanism that enables permissionless participation in an L1, the next question is: How do we actually transform an existing permissioned L1 using [Proof of Authority](/academy/permissioned-l1s/proof-of-authority/proof-of-authority) into a permissionless L1 with Proof of Stake?
-
-In the previous section on [staking token selection](/academy/permissionless-l1s/proof-of-stake/staking-token), we learned that the staking token can either be the native token or a separate ERC20 token. **For this course, we will focus on building a permissionless L1 where the native token is also the staking token**—the most common and straightforward implementation that creates unified token economics.
-
-### 1. Opening Validator Management (From Permissioned L1s)
-
-In the [Permissioned L1s course](/academy/permissioned-l1s), we learned about the [Validator Manager Contract](/academy/permissioned-l1s/proof-of-authority/validator-manager-contract)—specifically how PoA restricts validator control to a single owner address. The contract hierarchy showed us:
-
-- **PoA Model**: Only the owner can call `initiateValidatorRegistration()`, `initiateValidatorRemoval()`, and `initiateValidatorWeightUpdate()`
-- **Centralized Control**: One account (EOA or multi-sig) acts as the gatekeeper
-
-To enable PoS, we need to **open these functions to the public**—but with economic requirements instead of permission requirements.
-
-### 2. Adding Token Economics (From L1 Native Tokenomics)
-
-In the [L1 Native Tokenomics course](/academy/l1-native-tokenomics), we learned about [custom native tokens](/academy/l1-native-tokenomics/custom-tokens/introduction) and that [native tokens and staking tokens can be different](/academy/l1-native-tokenomics/custom-tokens/native-vs-staking). We also explored the [Native Minter Precompile](/academy/l1-native-tokenomics/native-minter/introduction) for managing token supply.
-
-Now we need to integrate these token economics with validator management to create the economic security model that defines PoS.
-
-## The Transformation Requirements
-
-To enable native token staking on our L1, we'll need to configure specific precompiles:
-
-### Required: Native Minter Precompile
-
-When using the native token for staking, the **Native Minter Precompile is mandatory**. It enables the minting of staking rewards for validators.
-
-> If we're using an ERC20 token for staking instead, we don't need the Native Minter—the ERC20 token just needs to be mintable.
-
-### Recommended: Reward Manager Precompile
-
-The **Reward Manager Precompile is optional but highly recommended**. It automates reward distribution based on validator performance and participation.
-
-If we choose not to enable the Reward Manager, transaction fees will simply be burned rather than distributed as rewards.
-
-## Next Steps
-
-In the following sections, we'll explore why these precompiles are necessary and how to configure them for our permissionless L1.
\ No newline at end of file
diff --git a/content/academy/permissionless-l1s/03-transformation-requirements/02-native-minter.mdx b/content/academy/permissionless-l1s/03-transformation-requirements/02-native-minter.mdx
deleted file mode 100644
index 9eb67ae0e17..00000000000
--- a/content/academy/permissionless-l1s/03-transformation-requirements/02-native-minter.mdx
+++ /dev/null
@@ -1,65 +0,0 @@
----
-title: Native Minter with PoS
-description: How the Native Minter precompile enables staking rewards
-updated: 2025-03-13
-authors: [nicolasarnedo]
-icon: BookOpen
----
-
-The **Native Minter Precompile** is essential for native token staking because it allows the staking manager contract to mint new tokens as rewards for validators and delegators. Without this capability, there would be no way to programmatically reward validators for securing the network.
-
-The `NativeTokenStakingManager` contract mints rewards by calling the `INativeMinter` precompile at address `0x0200000000000000000000000000000000000001`.
-
-## Setup Requirements
-
-**The `NativeTokenStakingManager` contract must be granted admin privileges on the Native Minter precompile** to mint rewards. Without these privileges, the staking manager cannot mint rewards and reward distribution will fail.
-
-For this course, we will activate the Native Minter precompile in the genesis configuration. Since the staking manager contract is deployed after the L1 is created, we'll add its address to the precompile's allowlist in later chapters once the contract address is known.
-
-Note that precompile can also be added to a chain after deployment through a network upgrade, but this will be covered in another course.
-
-## Reward Minting Flow
-
-The reward minting flow involves multiple contracts working together to distribute rewards to validators and delegators:
-
-
-
-## The _reward() Function
-
-The core reward minting happens through the `_reward()` internal function in `NativeTokenStakingManager`:
-
-```solidity
-function _reward(address account, uint256 amount) internal override {
- nativeMinter.mintNativeCoin(account, amount);
-}
-```
-
-This simple function wraps the Native Minter precompile's `mintNativeCoin(address addr, uint256 amount)` function, which performs the actual token minting at the protocol level.
\ No newline at end of file
diff --git a/content/academy/permissionless-l1s/03-transformation-requirements/03-reward-manger.mdx b/content/academy/permissionless-l1s/03-transformation-requirements/03-reward-manger.mdx
deleted file mode 100644
index c6f8e4fb73a..00000000000
--- a/content/academy/permissionless-l1s/03-transformation-requirements/03-reward-manger.mdx
+++ /dev/null
@@ -1,108 +0,0 @@
----
-title: Reward Manager
-description: How the Reward Manager calculates and distributes staking rewards
-updated: 2025-03-13
-authors: [nicolasarnedo]
-icon: BookOpen
----
-
-The **Reward Manager** is an **optional but highly recommended component** that automates the calculation and distribution of staking rewards. While the Native Minter precompile handles the actual token minting, the Reward Manager determines *how much* each validator and delegator should receive based on their staking duration, stake amount, and network parameters.
-
-Without the Reward Manager enabled, rewards are set to zero—validators receive only their original stake back when they unstake, no reward UTXOs are created, and transaction fees are burned rather than distributed. This eliminates economic incentives for validators beyond minimal transaction fee revenue, significantly weakening the security model of Proof of Stake and reducing decentralization.
-
-## How the Reward Manager Works
-
-The reward system operates through a **proposal-commit/abort mechanism** on the P-Chain. When a validator's or delegator's staking period ends, the system automatically calculates and distributes their rewards.
-
-
-
-## Reward Calculation
-
-When a validator's or delegator's staking period ends, the system calculates rewards using the `reward.Calculator` which considers:
-
-1. **Staking Duration**: How long tokens were staked
-2. **Stake Amount**: The weight of the validator (own stake + delegated stake)
-3. **Current Supply**: The total token supply affects reward rate
-4. **Network Parameters**: Configured reward rates and caps
-
-The calculation follows this general formula:
-
-```
-reward = (stake_amount × staking_duration × reward_rate) / supply_factor
-```
-
-The reward rate typically decreases as supply increases, creating controlled inflation.
-
-## Reward Distribution Process
-
-### 1. Block Building
-
-When a staker's end time is reached, the **Block Builder** creates a `RewardValidatorTx` transaction. This transaction proposes to:
-- Remove the validator/delegator from the active set
-- Calculate their earned rewards
-- Return their stake plus rewards
-
-### 2. Execution Phase
-
-The `RewardValidatorTx` is executed as a **proposal transaction** by the Proposal Executor:
-
-- The Reward Calculator computes the potential reward amount
-- The P-Chain State is queried for staker information
-- A reward UTXO is prepared (if reward > 0)
-
-### 3. Commit or Abort
-
-The transaction can follow two paths:
-
-#### Commit Path (Normal Operation)
-- Validator receives: Original stake + validation rewards
-- Delegators receive: Their share of rewards (minus delegation fees)
-- Delegation fees are either:
- - **Post-Cortina**: Accumulated for the validator to claim later
- - **Pre-Cortina**: Paid immediately to the validator
-
-#### Abort Path (Network Issues)
-- Validator receives: Only their original stake (no rewards)
-- Potential rewards are burned (supply decreased)
-- Accumulated delegation fees are still returned
-- This protects the network from rewarding validators during unstable periods
\ No newline at end of file
diff --git a/content/academy/permissionless-l1s/05-staking-manager-contract/03-staking-contract-post-etna.mdx b/content/academy/permissionless-l1s/06-staking-contract/03-staking-contract-post-etna.mdx
similarity index 100%
rename from content/academy/permissionless-l1s/05-staking-manager-contract/03-staking-contract-post-etna.mdx
rename to content/academy/permissionless-l1s/06-staking-contract/03-staking-contract-post-etna.mdx
diff --git a/content/academy/permissionless-l1s/06-staking-manager-operations/04-register-validators.mdx b/content/academy/permissionless-l1s/07-staking-manager-operations/04-register-validators.mdx
similarity index 100%
rename from content/academy/permissionless-l1s/06-staking-manager-operations/04-register-validators.mdx
rename to content/academy/permissionless-l1s/07-staking-manager-operations/04-register-validators.mdx
diff --git a/content/academy/permissionless-l1s/index.mdx b/content/academy/permissionless-l1s/index.mdx
index 52c476e0b79..c88338a4de4 100644
--- a/content/academy/permissionless-l1s/index.mdx
+++ b/content/academy/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/academy/permissionless-l1s/meta.json b/content/academy/permissionless-l1s/meta.json
index 7e86421bd76..54f2f9b02c8 100644
--- a/content/academy/permissionless-l1s/meta.json
+++ b/content/academy/permissionless-l1s/meta.json
@@ -8,8 +8,6 @@
"...01-review",
"---Proof of Stake---",
"...02-proof-of-stake",
- "---Transformation Requirements---",
- "...03-transformation-requirements",
"---More coming soon...---"
]
}
\ No newline at end of file
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/templates/encrypted-erc.mdx b/content/docs/templates/encrypted-erc.mdx
new file mode 100644
index 00000000000..8a3b0f8a7d6
--- /dev/null
+++ b/content/docs/templates/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/templates/index.mdx b/content/docs/templates/index.mdx
new file mode 100644
index 00000000000..1ce0a1e4a16
--- /dev/null
+++ b/content/docs/templates/index.mdx
@@ -0,0 +1,35 @@
+---
+title: Templates
+description: Production-ready starter templates for building on Avalanche.
+icon: LayoutTemplate
+keywords: [templates, starter kits, avalanche templates, next.js template, payment protocol, x402, encrypted erc, privacy, zero-knowledge proofs, micropayments]
+---
+
+Start building on Avalanche faster with production-ready templates and starter kits. These templates provide complete, working examples that you can clone, customize, and deploy.
+
+## Available Templates
+
+### x402 Starter Kit
+
+A Next.js template for building payment-gated APIs and content services using the x402 protocol on Avalanche C-Chain.
+
+Perfect for API monetization, premium content, AI agent services, and micropayment applications.
+
+[View x402 Template Guide](/docs/templates/x402-starter-kit)
+
+### EncryptedERC
+
+A privacy-preserving ERC-20 token protocol that enables confidential token transfers on Avalanche using zero-knowledge proofs and homomorphic encryption.
+
+Perfect for private transactions, confidential DeFi applications, compliance-friendly privacy solutions, and enterprise tokenization.
+
+[View EncryptedERC Template Guide](/docs/templates/encrypted-erc)
+
+## Why Use Templates?
+
+Templates help you:
+
+- **Start Fast**: Skip boilerplate setup and configuration
+- **Learn Best Practices**: See working examples of proper implementation
+- **Save Time**: Production-ready code that you can customize
+- **Avoid Common Mistakes**: Tested code with security best practices built-in
diff --git a/content/docs/templates/meta.json b/content/docs/templates/meta.json
new file mode 100644
index 00000000000..4f94e6949e4
--- /dev/null
+++ b/content/docs/templates/meta.json
@@ -0,0 +1,12 @@
+{
+ "title": "Templates",
+ "description": "Starter templates for Avalanche",
+ "icon": "LayoutTemplate",
+ "root": true,
+ "pages": [
+ "index",
+ "---Starter Kits---",
+ "x402-starter-kit",
+ "encrypted-erc"
+ ]
+}
diff --git a/content/docs/templates/x402-starter-kit.mdx b/content/docs/templates/x402-starter-kit.mdx
new file mode 100644
index 00000000000..dcfa5bbe350
--- /dev/null
+++ b/content/docs/templates/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/lib/source.ts b/lib/source.ts
index 7f825437677..9126bac2eb9 100644
--- a/lib/source.ts
+++ b/lib/source.ts
@@ -50,7 +50,8 @@ export function getDocumentationTree() {
!url.startsWith('/docs/api-reference') &&
!url.startsWith('/docs/rpcs') &&
!url.startsWith('/docs/tooling') &&
- !url.startsWith('/docs/acps')
+ !url.startsWith('/docs/acps') &&
+ !url.startsWith('/docs/templates')
);
});
}
@@ -87,6 +88,14 @@ export function getAcpsTree() {
});
}
+export function getTemplatesTree() {
+ const fullTree = documentation.pageTree;
+ return filterTopLevelSections(fullTree, (url) => {
+ // Only include templates section
+ return url.startsWith('/docs/templates');
+ });
+}
+
export const academy = loader({
baseUrl: '/academy',
icon(icon) {
diff --git a/next-env.d.ts b/next-env.d.ts
index c4b7818fbb2..1b3be0840f3 100644
--- a/next-env.d.ts
+++ b/next-env.d.ts
@@ -1,6 +1,5 @@
///
///
-import "./.next/dev/types/routes.d.ts";
// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
diff --git a/scripts/versions.json b/scripts/versions.json
index 59a52ad6d9a..b6783e25182 100644
--- a/scripts/versions.json
+++ b/scripts/versions.json
@@ -5,9 +5,9 @@
"avaplatform/icm-relayer": "v1.7.3"
},
"testnet": {
- "avaplatform/avalanchego": "v1.14.0",
- "avaplatform/subnet-evm_avalanchego": "v0.8.0_v1.14.0",
- "avaplatform/icm-relayer": "v1.7.3"
+ "avaplatform/avalanchego": "v1.14.0-fuji",
+ "avaplatform/subnet-evm_avalanchego": "v0.8.0-fuji_v1.14.0-fuji",
+ "avaplatform/icm-relayer": "v1.7.2-fuji"
},
"ava-labs/icm-contracts": "4d5ab0b6dbc653770cfe9709878c9406eb28b71c"
-}
+}
\ No newline at end of file
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