Ethereum <> SKALE IMA Bridge
Interchain Messaging Agent (IMA)
SKALE makes it possible to manage tokens for end-users between Ethereum and your SKALE Chain. Users can use the Interchain Messaging Agent (IMA) (or SKALE IMA Bridge as it is also known) to transfer ETH, ERC-20, ERC-721 (NFTs), ERC-1155, Dai/USDC/USDT and others into a deposit box on Ethereum, where the IMA will then create clones of the token(s) on your SKALE Chain. Users can then withdraw the tokens from the SKALE Chain back into Ethereum, whereby the tokens will be released from the deposit box.
IMA is flexible and modular - It can support transfer of any token standard, and can also transfer any arbitrary message between chains. See Managing Message Transfer below for more information.
IMA is backed by Ethereum mainnet and SKALE Chain security mechanisms - It uses your SKALE Chain’s 16 randomly selected validator nodes to sign and verify messages between the Ethereum mainnet and your SKALE Chain using BLS threshold signatures and Trusted-Execution Environments (TEE). It uses smart contracts running on Ethereum to manage the locking and unlocking of the deposit box on the mainnet. And, each of the 16 nodes supporting your SKALE Chain each has 20 million SKL tokens staked.
For more details on the SKALE IMA Bridge and how it addresses security, decentralization, transfer speed, preservation of custody, cost efficiency, and customization, see our post here https://skale.network/blog/introduction-of-the-skale-ima-bridge/
To learn how to integrate this feature into your dApp, please see the guides below.
The SKALE IMA bridge between SKALE and Ethereum allows users to transfer tokens to and from Ethereum and across SKALE Chains. The SKALE IMA bridge supports ETH, ERC-20, ERC-721, and ERC-1155 out of the box. The IMA Bridge can be expanded to any arbitrary message or token standard using MessageProxy, which is an interface that can be applied to any contract to enable transfer of messages through IMA.
IMA consists of three parts:
IMA contracts on Ethereum.
IMA contracts pre-deployed on your SKALE Chain.
IMA Agent - a containerized service on each SKALE Chain node that relays messages between Ethereum and your SKALE Chain.
Developing with IMA is easy. You only need to interact with the IMA contracts within the SKALE Manager on Ethereum and the contracts operating your SKALE Chain. The IMA Agent works behind the scenes to relay messages between Ethereum and SKALE.
The high-level flow between Ethereum and SKALE Chains consists of the following:
Tokens that leave Ethereum are locked on the Ethereum mainnet and the same number of tokens are minted on a SKALE Chain.
Tokens that leave SKALE are burned on the SKALE Chain and then unlocked on Ethereum to complete the transfer.
Deposits and withdrawals take only seconds and are secured using BLS Threshold signatures and secure enclaves from the 16 validator nodes that support the SKALE Chain.
Token contracts on Ethereum are cloned and deployed on SKALE chains.
In order for an Ethereum Mainnet token contract to work with IMA on your SKALE Chain, the token contract copy deployed on SKALE may need to be modified to include MINTABLE and BURNABLE functions. SKALE Chain IMA contracts need to mint and burn the token on SKALE chains to maintain the 1:1 peg with Ethereum. If the token is already using OpenZeppelin’s framework, you can do this by importing ERC20Mintable/ERC721Mintable and ERC20Burnable/ERC721Burnable contracts that extend the functionality to include mintable and burnable functions. You can also do this by manually modifying the contract by adding mintable and burnable functions.
The SKALE Chain TokenManager contract must be assigned the minter role for your modified token contract. This enables IMA to mint token clones as the tokens are Locked on mainnet contracts.
When using ERC-721s be careful with MINT_ID. This is the mapping between Mainnet and SKALE Chain ERC-721s. Improper or corrupt mapping may cause loss of ERC721.
It’s recommended to use Web3.js 1.5.1. Don’t use Web3.js 2.x.x.