|
| 1 | +--- |
| 2 | +title: Agglayer Native Bridge |
| 3 | +--- |
| 4 | + |
| 5 | +<!-- Page Header Component --> |
| 6 | +<h1 style="text-align: left; font-size: 38px; font-weight: 700; font-family: 'Inter Tight', sans-serif;"> |
| 7 | + Agglayer Native Bridge |
| 8 | +</h1> |
| 9 | + |
| 10 | +<div style="text-align: left; margin: 0.5rem 0;"> |
| 11 | + <p style="font-size: 18px; color: #666; max-width: 600px; margin: 0;"> |
| 12 | + Direct blockchain operations with Agglayer bridge contracts for maximum control and flexibility |
| 13 | + </p> |
| 14 | +</div> |
| 15 | + |
| 16 | +## Overview |
| 17 | + |
| 18 | +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. |
| 19 | + |
| 20 | +## Core Features |
| 21 | + |
| 22 | +<div style="display: flex; flex-direction: column; gap: 1rem; max-width: 800px; margin: 1rem 0;"> |
| 23 | + |
| 24 | + <!-- ERC20 Operations Card --> |
| 25 | + <div style="background: #f8f9fa; border: 1px solid #dee2e6; border-radius: 6px; padding: 1rem 1rem; margin: 0.25rem 0;"> |
| 26 | + <h3 style="color: #0071F7; margin: 0 0 0.5rem 0; font-size: 18px; font-weight: 600;"> |
| 27 | + ERC20 Operations |
| 28 | + </h3> |
| 29 | + <p style="color: #666; margin-bottom: 0.75rem; line-height: 1.4; font-size: 14px;"> |
| 30 | + Complete ERC20 token management including balance checks, approvals, transfers, and direct bridge operations with built-in gas estimation. |
| 31 | + </p> |
| 32 | + <a href="/agglayer/developer-tools/agglayer-sdk/agglayer-native-bridge/operations/erc20-operations/" style="color: #0071F7; text-decoration: none; font-weight: 500; font-size: 14px;"> |
| 33 | + Learn more → |
| 34 | + </a> |
| 35 | + </div> |
| 36 | + |
| 37 | + <!-- Bridge Operations Card --> |
| 38 | + <div style="background: #f8f9fa; border: 1px solid #dee2e6; border-radius: 6px; padding: 1rem 1rem; margin: 0.25rem 0;"> |
| 39 | + <h3 style="color: #0071F7; margin: 0 0 0.5rem 0; font-size: 18px; font-weight: 600;"> |
| 40 | + Bridge Operations |
| 41 | + </h3> |
| 42 | + <p style="color: #666; margin-bottom: 0.75rem; line-height: 1.4; font-size: 14px;"> |
| 43 | + Direct bridge contract interactions including asset bridging, message bridging, claim operations, and proof generation. |
| 44 | + </p> |
| 45 | + <a href="/agglayer/developer-tools/agglayer-sdk/agglayer-native-bridge/operations/bridge-operations/" style="color: #0071F7; text-decoration: none; font-weight: 500; font-size: 14px;"> |
| 46 | + Learn more → |
| 47 | + </a> |
| 48 | + </div> |
| 49 | + |
| 50 | + <!-- Chain Management Card --> |
| 51 | + <div style="background: #f8f9fa; border: 1px solid #dee2e6; border-radius: 6px; padding: 1rem 1rem; margin: 0.25rem 0;"> |
| 52 | + <h3 style="color: #0071F7; margin: 0 0 0.5rem 0; font-size: 18px; font-weight: 600;"> |
| 53 | + Chain Management |
| 54 | + </h3> |
| 55 | + <p style="color: #666; margin-bottom: 0.75rem; line-height: 1.4; font-size: 14px;"> |
| 56 | + Built-in chain registry with support for custom networks, RPC configuration, and multi-environment setups (local, testnet, mainnet). |
| 57 | + </p> |
| 58 | + <a href="/agglayer/developer-tools/agglayer-sdk/agglayer-native-bridge/operations/chain-management/" style="color: #0071F7; text-decoration: none; font-weight: 500; font-size: 14px;"> |
| 59 | + Learn more → |
| 60 | + </a> |
| 61 | + </div> |
| 62 | + |
| 63 | +</div> |
| 64 | + |
| 65 | +## Complete Guides |
| 66 | + |
| 67 | +<div style="display: flex; flex-direction: column; gap: 1rem; max-width: 800px; margin: 1rem 0;"> |
| 68 | + |
| 69 | + <!-- Local Testing Card --> |
| 70 | + <div style="background: #f8f9fa; border: 1px solid #dee2e6; border-radius: 6px; padding: 1rem 1rem; margin: 0.25rem 0;"> |
| 71 | + <h3 style="color: #0071F7; margin: 0 0 0.5rem 0; font-size: 18px; font-weight: 600;"> |
| 72 | + Local Testing with AggSandbox |
| 73 | + </h3> |
| 74 | + <p style="color: #666; margin-bottom: 0.75rem; line-height: 1.4; font-size: 14px;"> |
| 75 | + Complete guide for local development using AggSandbox. Perfect for rapid prototyping with instant feedback and comprehensive debugging. |
| 76 | + </p> |
| 77 | + <a href="/agglayer/developer-tools/agglayer-sdk/agglayer-native-bridge/step-by-step-guide/native-bridge-locally/" style="color: #0071F7; text-decoration: none; font-weight: 500; font-size: 14px;"> |
| 78 | + Start locally → |
| 79 | + </a> |
| 80 | + </div> |
| 81 | + |
| 82 | + <!-- Testnet Testing Card --> |
| 83 | + <div style="background: #f8f9fa; border: 1px solid #dee2e6; border-radius: 6px; padding: 1rem 1rem; margin: 0.25rem 0;"> |
| 84 | + <h3 style="color: #0071F7; margin: 0 0 0.5rem 0; font-size: 18px; font-weight: 600;"> |
| 85 | + Testnet Development |
| 86 | + </h3> |
| 87 | + <p style="color: #666; margin-bottom: 0.75rem; line-height: 1.4; font-size: 14px;"> |
| 88 | + Step-by-step guide for testnet development using Sepolia and other test networks. Validate your integration with real network conditions. |
| 89 | + </p> |
| 90 | + <a href="/agglayer/developer-tools/agglayer-sdk/agglayer-native-bridge/step-by-step-guide/native-bridge-testnet/" style="color: #0071F7; text-decoration: none; font-weight: 500; font-size: 14px;"> |
| 91 | + Test on testnet → |
| 92 | + </a> |
| 93 | + </div> |
| 94 | + |
| 95 | + <!-- Production Deployment Card --> |
| 96 | + <div style="background: #f8f9fa; border: 1px solid #dee2e6; border-radius: 6px; padding: 1rem 1rem; margin: 0.25rem 0;"> |
| 97 | + <h3 style="color: #0071F7; margin: 0 0 0.5rem 0; font-size: 18px; font-weight: 600;"> |
| 98 | + Production Deployment |
| 99 | + </h3> |
| 100 | + <p style="color: #666; margin-bottom: 0.75rem; line-height: 1.4; font-size: 14px;"> |
| 101 | + Production-ready implementation with mainnet configuration, error handling, monitoring, and security best practices. |
| 102 | + </p> |
| 103 | + <a href="/agglayer/developer-tools/agglayer-sdk/agglayer-native-bridge/step-by-step-guide/native-bridge-mainnet/" style="color: #0071F7; text-decoration: none; font-weight: 500; font-size: 14px;"> |
| 104 | + Deploy to mainnet → |
| 105 | + </a> |
| 106 | + </div> |
| 107 | + |
| 108 | +</div> |
| 109 | + |
| 110 | +## When to Use Native Bridge |
| 111 | + |
| 112 | +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. |
| 113 | + |
| 114 | +Consider [Multi-Bridge Routes](/agglayer/developer-tools/agglayer-sdk/multi-bridge-routes/) for route optimization across multiple providers and cross-chain bridging from non-Agglayer chains. |
| 115 | + |
| 116 | +## Quick Example |
| 117 | + |
| 118 | +Here's how simple it is to perform direct bridge operations with Native Bridge: |
| 119 | + |
| 120 | +```typescript |
| 121 | +import { AggLayerSDK, SDK_MODES } from '@agglayer/sdk'; |
| 122 | + |
| 123 | +// Initialize for local testing |
| 124 | +const sdk = new AggLayerSDK({ |
| 125 | + mode: [SDK_MODES.NATIVE], |
| 126 | + native: { |
| 127 | + defaultNetwork: 1, |
| 128 | + customRpcUrls: { |
| 129 | + 1: 'http://localhost:8545', // AggSandbox L1 |
| 130 | + 1101: 'http://localhost:8546', // AggSandbox L2 |
| 131 | + }, |
| 132 | + }, |
| 133 | +}); |
| 134 | + |
| 135 | +const native = sdk.getNative(); |
| 136 | + |
| 137 | +// Create token instance and bridge directly |
| 138 | +const token = native.erc20('0xTokenAddress', 1); |
| 139 | +const bridgeTx = await token.bridgeTo( |
| 140 | + 1101, // Destination network |
| 141 | + '0xRecipientAddress', |
| 142 | + '1000000000000000000', // 1 token |
| 143 | + '0xFromAddress' |
| 144 | +); |
| 145 | + |
| 146 | +// Transaction ready for signing and execution |
| 147 | +console.log('Bridge transaction built:', bridgeTx.to); |
| 148 | +``` |
0 commit comments