Agglayer Native Bridge

Direct blockchain operations with Agglayer bridge contracts for maximum control and flexibility

Overview

Agglayer Native Bridge is the SDK's Native module that provides direct interaction with Agglayer bridge contracts and blockchain networks. Unlike Multi-Bridge Routes which uses ARC API for route aggregation, Native Bridge gives you complete control over bridge operations, ERC20 token management, and chain configurations across local, testnet, and mainnet environments.

Core Features

ERC20 Operations

Complete ERC20 token management including balance checks, approvals, transfers, and direct bridge operations with built-in gas estimation.

Learn more →

Bridge Operations

Direct bridge contract interactions including asset bridging, message bridging, claim operations, and proof generation.

Learn more →

Chain Management

Built-in chain registry with support for custom networks, RPC configuration, and multi-environment setups (local, testnet, mainnet).

Learn more →

Complete Guides

Local Testing with AggSandbox

Complete guide for local development using AggSandbox. Perfect for rapid prototyping with instant feedback and comprehensive debugging.

Start locally →

Testnet Development

Step-by-step guide for testnet development using Sepolia and other test networks. Validate your integration with real network conditions.

Test on testnet →

Production Deployment

Production-ready implementation with mainnet configuration, error handling, monitoring, and security best practices.

Deploy to mainnet →

When to Use Native Bridge

Choose Native Bridge when you need direct control over bridge operations, local testing capabilities with AggSandbox, or custom bridge logic beyond standard route aggregation. It's ideal for advanced integrations with custom business logic and testnet development workflows.

Consider Multi-Bridge Routes for route optimization across multiple providers and cross-chain bridging from non-Agglayer chains.

Quick Example

Here's how simple it is to perform direct bridge operations with Native Bridge:

import { AggLayerSDK, SDK_MODES } from '@agglayer/sdk';

// Initialize for local testing
const sdk = new AggLayerSDK({
  mode: [SDK_MODES.NATIVE],
  native: {
    defaultNetwork: 1,
    customRpcUrls: {
      1: 'http://localhost:8545',     // AggSandbox L1
      1101: 'http://localhost:8546',  // AggSandbox L2
    },
  },
});

const native = sdk.getNative();

// Create token instance and bridge directly
const token = native.erc20('0xTokenAddress', 1);
const bridgeTx = await token.bridgeTo(
  1101, // Destination network
  '0xRecipientAddress',
  '1000000000000000000', // 1 token
  '0xFromAddress'
);

// Transaction ready for signing and execution
console.log('Bridge transaction built:', bridgeTx.to);
Edit on GitHub

Last updated on