Connect SKALE Chains
Ready to start bridging ERC-20’s, ERC-721’s, and ERC-1155’s between SKALE Chains? Before you proceed to the setup guides for your target token, read through the following to ensure that the SKALE Chains you are moving assets between are able to communicate.
Background on Connections
Section titled “Background on Connections”All SKALE Chains utilize the same components and contracts to enable bridging. However, while SKALE Chains are all by default connected to Ethereum for operations and bridging; SKALE Chains do not come out of the box with connections to other SKALE Chains.
This is both for security since the SKALE architecture does not define what chains can be used for externally, all chains adhere to an appchain first mentality i.e as siloed and secure as possible allowing the chain owner to setup and connect as they see fit.
Interested in setting up your own token on multiple SKALE Chains? Connect the chains now!
Connect a SKALE Chain
Section titled “Connect a SKALE Chain”The following will create a connection from your chain to the target chain. If the other chain is already connected to your SKALE Chain, you can proceed with token setup and bridging. If the other chain has not yet connected then bridging will not work until completed.
npx msig encodeData [SKALE_CHAIN_NAME] TokenManagerLinker connectSchain [TARGET_CHAIN_NAME]
After this, execute by following the steps on Using SAFE
import { Contract, JsonRpcProvider, Wallet } from "ethers"; // npm add ethers
const PRIVATE_KEY = "[YOUR_PRIVATE_KEY]";const SCHAIN_RPC_URL = "[YOUR_RPC_URL]";const TOKEN_MANAGER_LINKER_ADDRESS = "0xD2aAA00800000000000000000000000000000000"; // DO NOT CHANGE THISconst TOKEN_MANAGER_LINKER_ABI = [ "function connectSchain(string calldata schainName) external" ];const SCHAIN_NAME = "[TARGET_SKALE_CHAIN_NAME]"; // e.g green-giddy-denebola (nebula mainnnet);
// Setup the RPC Provider to connect to SKALE Chainconst provider = new JsonRpcProvider(SCHAIN_RPC_URL);
// Setup the wallet with your private key and default to the SKALE Chain providerconst wallet = new Wallet(PRIVATE_KEY, provider);
const tokenManagerLinkerContract = new Contract(TOKEN_MANAGER_LINKER_ADDRESS, TOKEN_MANAGER_LINKER_ABI, wallet);
const connectTx = await tokenManagerLinkerContract.connectSchain(SCHAIN_NAME);await connectTx.wait(1); // Wait 1 blocks for confirmation, ~1 seconds
// Success! Now watch for delivery on Destination Chainconsole.log("Success!");