Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 44 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# TypeScript Examples for Bridge Contracts

This directory contains TypeScript scripts demonstrating how to interact with various bridge contracts on Neo using the `bridge-sdk-ts` library.
This directory contains TypeScript scripts demonstrating how to interact with various bridge contracts on both Neo and EVM chains using the `@bane-labs/bridge-sdk-ts` library.

## Prerequisites
- Node.js v18 or newer
- npm
- Access to a running Neo node (local or remote)
- A valid Neo wallet file (JSON format)
- Contract hashes for the deployed bridge contracts
- Access to running nodes (Neo and/or EVM compatible)
- Valid wallet configurations for target chains
- Contract addresses/hashes for deployed bridge contracts

## Setup
1. Install dependencies:
Expand All @@ -18,31 +18,57 @@ This directory contains TypeScript scripts demonstrating how to interact with va
```sh
cp env-template .env
```
Edit `.env` and set values for:
- Contract hashes for deployed bridge contracts (e.g., `MESSAGE_BRIDGE_CONTRACT_HASH`, `NATIVE_BRIDGE_CONTRACT_HASH`, etc.)
- `NEO_NODE_URL` (RPC URL)
- `WALLET_PATH` (path to your Neo wallet JSON)
- `WALLET_PASSWORD` (if your wallet is encrypted)
- Other variables as needed for specific scripts
Edit `.env` and configure values for your target chain(s). See [Environment Variables](#environment-variables) section below.

## Usage
Scripts are organized by bridge component. See the subdirectories below for specific usage instructions and npm scripts.
Scripts are organized by blockchain platform and bridge component. All scripts can be run using npm scripts with the following naming conventions:
- **Neo**: `npm run neo:<component>:<operation>`
- **EVM**: `npm run evm:<component>:<operation>`

See the platform-specific sections below and individual README files for detailed instructions.

## Environment Variables
See `env-template` for all required and optional variables. Key variables include:
- `NEO_NODE_URL`
- `WALLET_PATH`
- `WALLET_PASSWORD`
See `env-template` for all required and optional variables.

### Neo Chain Variables
- `NEO_NODE_URL` - RPC URL of the Neo node
- `NEO_WALLET_PATH` - Path to your Neo wallet JSON file
- `NEO_WALLET_PASSWORD` - Password for the wallet (if encrypted)
- Contract-specific hashes (e.g., `MESSAGE_BRIDGE_CONTRACT_HASH`, `NATIVE_BRIDGE_CONTRACT_HASH`)
- Operation-specific variables (see subdirectory READMEs for details)

## Bridge Components
### EVM Chain Variables
- `EVM_RPC_URL` - RPC URL of the EVM node (defaults to http://localhost:8545)
- `EVM_WALLET_PATH` - Path to your EVM wallet JSON file
- `EVM_WALLET_PASSWORD` - Password for the wallet (if encrypted)
- Contract-specific addresses (e.g., `EVM_MESSAGE_BRIDGE_CONTRACT_ADDRESS`, `EVM_NATIVE_BRIDGE_CONTRACT_ADDRESS`)

### Operation-specific Variables
Each operation may require additional variables. See subdirectory READMEs for details.

## Neo Bridge Components
- **Native Bridge**: Handles native token (GAS/NEO) bridging. See [src/neo/native-bridge/README.md](src/neo/native-bridge/README.md)
- **Token Bridge**: Handles NEP-17 token bridging. See [src/neo/token-bridge/README.md](src/neo/token-bridge/README.md)
- **Message Bridge**: Handles cross-chain message bridging. See [src/neo/message-bridge/README.md](src/neo/message-bridge/README.md)
- **Management**: Handles ownership, relayer, governor, security guard, and validator management. See [src/neo/management/README.md](src/neo/management/README.md)
- **Execution Manager**: Handles message execution and bridge management. See [src/neo/execution-manager/README.md](src/neo/execution-manager/README.md)
- **Wallet Operations**: Examples for wallet interactions. See [src/neo/wallet/walletOperations.ts](src/neo/wallet/walletOperations.ts)
- **Wallet Operations**: Examples for wallet interactions. See [src/neo/wallet/README.md](src/neo/wallet/README.md)

## EVM Bridge Components
- **Message Bridge**: Handles cross-chain message bridging operations between EVM and Neo. See [src/evm/message-bridge/README.md](src/evm/message-bridge/README.md)
- **Execution Manager**: Handles message execution and management. See [src/evm/execution-manager/README.md](src/evm/execution-manager/README.md)
- **Native Bridge**: Handles native token bridging operations. See [src/evm/native-bridge/README.md](src/evm/native-bridge/README.md)
- **Token Bridge**: Handles ERC-20 token bridging operations. See [src/evm/token-bridge/README.md](src/evm/token-bridge/README.md)
- **Bridge Management**: Handles governance and validator management. See [src/evm/bridge-management/README.md](src/evm/bridge-management/README.md)

For a comprehensive overview of EVM examples, see [src/evm/README.md](src/evm/README.md).

## Notes
- Ensure your `.env` file does **not** use quotes or semicolons around values.
- Wallet file paths should be relative to this directory or absolute.
- Scripts are modular; you can add or modify npm scripts in `package.json` as needed.
- All EVM examples now include complete management, execution, message bridge, native bridge, and token bridge operations.

For more details, see the comments in each script file.

## Notes
- Ensure your `.env` file does **not** use quotes or semicolons around values.
Expand Down
23 changes: 18 additions & 5 deletions env-template
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
NEO_NODE_URL=http://localhost:40332

#Conrtract hashes
# EVM Configuration
EVM_RPC_URL=http://localhost:8562

# Neo Contract hashes
MESSAGE_BRIDGE_CONTRACT_HASH=bd98300a1951d72533fa749010265f71c4cfff38
BRIDGE_MANAGEMENT_CONTRACT_HASH=f0e6bccc463fa39fb21c4d0b69c2c279cd3d12d9
EXECUTION_MANAGER_CONTRACT_HASH=0xa4cda6c7b19c7e06ad702f1bc7e20ecc21e0a050
NATIVE_TOKEN_BRIDGE_CONTRACT_HASH=0x356376dcd5580f49f8b4d1274745ac55ad858784

# EVM Contract addresses
EVM_MESSAGE_BRIDGE_CONTRACT_ADDRESS=
EVM_EXECUTION_MANAGER_CONTRACT_ADDRESS=
EVM_NATIVE_BRIDGE_CONTRACT_ADDRESS=
EVM_TOKEN_BRIDGE_CONTRACT_ADDRESS=
EVM_BRIDGE_MANAGEMENT_CONTRACT_ADDRESS=

# Validator public keys
VALIDATOR_PUBLIC_KEY=0x02a0150e31043503248d2e3cb1e55011062d19a02a2da82f3cb55d9a1b967a601d
NEW_VALIDATOR_PUBLIC_KEY=0x... # Fill with new validator pubkey when replacing validator
Expand Down Expand Up @@ -80,7 +90,10 @@ NEW_MIN_TOKEN_DEPOSIT=... # New minimum token deposit
NEW_MAX_TOKEN_DEPOSIT=... # New maximum token deposit
NEW_MAX_TOKEN_WITHDRAWALS=... # New maximum token withdrawals

# pausing will only work if this is the governor account
# changing validator will only work if this is the owner account
WALLET_PATH=../neon3-funding/neon3-wallets/personal.json
WALLET_PASSWORD=
# Neo wallet configuration
NEO_WALLET_PATH=../neon3-funding/neon3-wallets/personal.json
NEO_WALLET_PASSWORD=

# EVM wallet configuration
EVM_WALLET_PATH=../neox-funding/neox-wallets/personal.json
EVM_WALLET_PASSWORD=
Loading