Docs/ERC-1066-x402/Getting Started

Getting Started

Get up and running with ERC-1066-x402 in under 10 minutes. This guide will help you install the necessary tools, deploy contracts, and validate your first intent.

Prerequisites

Before you begin, ensure you have the following tools installed:

Node.js 18+

Required for running the gateway and SDKs

Terminal
# Check version
node --version

# Using nvm (recommended)
nvm install 18
nvm use 18

Foundry (EVM)

Required for Solidity contract development

Terminal
# Install Foundry
curl -L https://foundry.paradigm.xyz | bash
foundryup

# Verify installation
forge --version

Git

Required for cloning the repository

Terminal
# Verify installation
git --version

Optional: Multi-Chain Support

For Solana or Sui support, you'll also need Anchor (Solana) or Sui CLI. See the Multi-Chain Guide for details.

Installation

Clone the repository and install dependencies:

Terminal
# Clone the repository
git clone https://github.com/hyperkit-labs/erc1066-x402.git
cd erc1066-x402

# Install dependencies
npm install
forge install

Verify the installation by running tests:

Terminal
# Run tests
npm test

# Expected output:
Running 10 tests for IntentExecutorTest...
[PASS] test_execute_success()
[PASS] test_execute_revertsWhenValidationFails()
...
Test result: ok. 10 passed

Configuration

Set up your environment variables for deployment:

.env
# For deployment scripts
PRIVATE_KEY=your_private_key_here
# Note: 0x prefix is optional, scripts handle it automatically

Security Note

Never commit your private key. It's already in .gitignore.

Your First Intent

Create and validate your first intent using the Python SDK:

first_intent.py
from erc1066_x402 import ERC1066Client, Intent

# Initialize client
client = ERC1066Client("http://localhost:3001")

# Create intent
intent = Intent(
    sender="0x...",
    target="0x...",
    data="0x",
    value="0",
    nonce="1",
    policyId="0x0000000000000000000000000000000000000000000000000000000000000000"
)

# Validate intent
result = client.validate_intent(intent, chain_id=133717)

# Check status
if result.status == "0x01":  # SUCCESS
    print("Intent validated successfully!")
    client.execute_intent(intent, chain_id=133717)
else:
    print(f"Validation failed: {result.status}")

Next Steps

1. Read Core Concepts

Learn about architecture, status codes, and intent validation

Learn more

2. Set Up Gateway

Deploy contracts and configure the gateway service

Gateway Setup

3. Explore Examples

See real-world usage examples and code samples

View Examples