Hyperlane
Last updated
Last updated
Hyperlane is now live on Eclipse, connecting it to Ethereum and Solana. This enables Eclipse to interoperate with two of the largest ecosystems in crypto, and it allows users to bridge assets from these two chains into a bustling ecosystem. You can bridge using the Hyperlane Nexus Bridge:
Key Takeaways
Eclipse is now connected to Ethereum and Solana through Hyperlane. The Hyperlane Eclipse bridge will enable USDC, SOL, and WIF to be bridged between Eclipse, Ethereum, and Solana.
More assets will be supported through Hyperlane, including Eclipse’s Unified Restaking Token, tETH.
Hyperlane will enable Eclipse to build an ecosystem that sits at the intersection of Ethereum and Solana assets.
Through Hyperlane, users can now bridge the following assets between the following chains at launch.
USDC - Ethereum <> Eclipse
SOL - Solana <> Eclipse
USDC - Solana <> Eclipse
WIF - Solana <> Eclipse.
More assets will be supported in the future.
You can find the official Hyperlane docs here: https://docs.hyperlane.xyz/
You can deploy a Warp Route for an asset of your choice, between two SVM chains with an existing Hyperlane core deployment. Currently, supported SVM chains are Eclipse and Solana, but you can find an up-to-date list here (all chain directory names with a core
subdirectory).
The type of token used determines the Warp Route type, so it's important to understand the different Warp Route contracts available:
Native: Handles the transfer of native gas tokens (e.g. SOL on Solana, ETH on Eclipse).
Collateral: Handles the transfer of existing Token-2022 or Token tokens (the ERC20 equivalent on SVM).
Synthetic: Handles synthetic tokens that are minted and burned as transfers occur through the Warp Route, to represent tokens from their origin chain. The tooling in this guide deploys a new Token-2022 token in this case, whose authority is set to the deployer key.
Here are the common Warp Route setups (you can find more details here):
Native to Synthetic: Lock Native tokens on the origin chain to mint Synthetic ones on the destination. When transferring back, the Synthetic is burned. An example of this is a SOL Warp Route between Solana and Eclipse.
Collateral to Synthetic: Lock Collateral tokens on the origin chain to mint Synthetic ones on the destination. When transferring back, the Synthetic is burned. An example of this is a USDC Warp Route between Solana and Eclipse.
Other: Native to Native (such as ETH between Optimism and Arbitrum), as well as Collateral to Collateral, are also possible if the token already exists on both origin and destination chains. Rebalancing liquidity is an important consideration in this case.
Deploying a Warp Route requires there to be a core Hyperlane deployment that is connected (i.e. actively relayed and secured) to the rest of the Hyperlane ecosystem. The core Hyperlane deployments used in this guide are Solana (core artifacts) and Eclipse (core artifacts). You may need to refer to these core artifacts throughout the guide.
Install solana-cli 1.14.20
to build the Warp Route programs. Note that you must use this version, otherwise deployment may fail.
Build the Warp Route programs on your machine
Clone hyperlane-monorepo
Go to ./hyperlane-monorepo/rust/sealevel/programs/
To deploy the contracts, install solana-cli 1.18.18
. Note that you must use this version, otherwise deployment may fail.
In the monorepo, in rust/sealevel/environments/mainnet3/warp-routes
, create a new directory with the name you want your Warp Route deployment to have. For example, the existing SOL Warp Route between Solana and Eclipse lives in rust/sealevel/environments/mainnet3/warp-routes/eclipsesol
.
If your warp route creates a synthetic token, you can open a PR to the hyperlane-registry
with metadata to associate with this token (example PR here). The hyperlane-registry
also gives your Warp Route visibility within the Hyperlane ecosystem.
Configure the parameters of your Warp Route in a JSON file named token-config.json
, based on the serde_json
serialization of the TokenConfig Rust struct. The value to set for the interchainGasPaymaster
, can be found in the core deployment artifacts.
The example below shows a testnet Native to Synthetic Warp Route that transfers SOL from Solana and mints synthetic SOL on Eclipse. You can also check this configuration of a production SOL Warp Route.
Create a Solana private key file. This key pays for the deployment and will be the owner of the deployed programs. An existing funded key can be used if you'd like.
Fund the new key on both networks the Warp Route is being deployed to. The public key should be the same across SVM networks, but do double check with the wallets recommended by each chain, by loading the private key into them.
The funding should be enough to cover rent for all accounts related to the Warp Route, pay for transaction fees, and fund the ATA payer accounts (more on this below). For reference, the observed rent from one Hyperlane Warp Route account is 2.35 SOL
on Solana and 0.025 ETH
on Eclipse, so it's a good idea to fund the key with at least 5 SOL
/ 0.05 ETH
.
To read the public key you just created:
Deploy the warp route with warp-route deploy
info
Note that since our goal was to make this tooling accessible to developers as soon as possible, it's not as reliable as we would hope. Please get in touch through a GitHub issue or via the developers
channel on Discord if you run into issues.
Overview of CLI flags:
--warp-route-name
- should match the directory name picked for the Warp Route earlier
--environment
- keep as mainnet3
--environments-dir ../environments
- keep as ../environments
--built-so-dir
- keep as ../../target/deploy
, as it points to the compilation output directory of Warp Route programs
--token-config-file
- point this to the token-config.json
file created earlier
--chain-config-file
- keep as ../environments/mainnet3/chain-config.json
, as this file has been pre-populated with chain settings for all Hyperlane-supported chains
--ata-payer-funding-amount
- this flag specifies by how much to fund the Warp Route ATA payer accounts on both chains the deployment happens on. It's expressed in the lowest currency denomination, which means that it's interpreted as Lamports on Solana and Gwei on Eclipse (since it uses ETH as its native currency). In the command below, the value 10000000
works out to 0.001
ETH and 0.001
SOL, which is enough for an initial deployment. ATA payers can always be topped up later, so it’s fine to pick a small value. For reference, every Warp Route transfer costs the ATA payer 0.000000001 SOL
(on Solana) and 0.000021 ETH
(on Eclipse) on the destination chain.
The script is unlikely to work from the first try due to network congestion and program size, but the script should be idempotent and skip contracts that were already deployed / initialized. Errors like Error: 11 write transactions failed
or Error: Custom: Invalid blockhash
can always be retried by re-running the command. If retriable errors persist, consider increasing the compute unit price here.
For other error types, you may need to close the buffers and programs of your deployer key and redeploy everything from scratch. To display buffers and programs and close them one by one, follow the commands below. Closing programs also helps recover their rent deposit.
To increase the odds of the deployment succeeding faster, you can set a private RPC url in the --chain-config-file
passed to the script. (e.g. in solanamainnet.rpcUrls.http
)
If deploying a synthetic, the command below will create a new token mint and use the metadata token extension to set the token name, symbol, and metadata json using the fields in the --token-config-file
file
Run warp-route deploy
Let’s query one of the Warp Route programs, getting the program ID from the auto-generated program-ids.json
in the directory you created above (where token-config.json
also lives). This command prints the Mint Account, Mint Authority, and ATA payer account.
if deploying a synthetic token, query the Mint Authority account to check out the metadata
Try transferring tokens!
You'll need the domain ID of the chain you're sending to, which you can find in the chain's metadata.yaml
entry from the hyperlane-registry.
Look for the balance of the recipient on the destination chain, by querying the Mint Account address
The final parameter here is the SPL token ID. So if this is a synthetic warp route you want to check the balance of, you need to use the Mint address from a prior query you made a few steps ago.
You can also check out the last tx made to the recipient account in the explorer
This guide has made heavy use of the hyperlane-sealevel-client
CLI from hyperlane-monorepo
. You may find its various commands useful for configuring the Warp Route, making state queries, sending transfers, and more. Check out the other utilities it provides, in particular those under the token
subcommand.
Eclipse and Hyperlane partnered to bring Hyperlane's Permissionless Interoperability solution to Solana Virtual Machine (SVM) based blockchains. The Eclipse team worked with Hyperlane to deploy their mailbox contracts for the SVM.
The mailbox contract facilitates interchain operations. To develop smart contracts for the bridge, you must interact with this contract. If you would like to test a user interface against the active mailbox deployment.
Assuming you have already set up Rust, Solana CLI, and switched to the Eclipse Devnet using our RPC, let's proceed to writing the smart contract.
For Hyperlane to deliver a message to our smart contract, we need to implement a handle function. This function will be called by the mailbox.
Send the instruction data and set up the send message function:
Now, call the send message function:
Here you can call the receive message function. This goes inside the main match block:
You can use the Hyperlane CLI to get a better understanding of how the deployments work and how to interact with them. The CLI can also be used to test sending and receiving messages.