In the previous post on cross-chain interoperability we explored cross-chain messaging. In this post, we will delve into cross-chain transfers with Hyperlane warp routes.
In this blog post, we will go through the process of deploying Hyperlane contracts to Neon EVM and utilizing Warp routes for token transfers. And we're not just connecting Ethereum to another EVM-compatible chain. Through Neon EVM, we're actually opening a fast lane directly to Solana.
By the end of this guide, you'll have a clear understanding of how to:
To refresh the cross-messaging process, you can read Part 1 here.
In this tutorial, we will deploy a Hyperlane warp route and seamlessly send tokens across chains.
Prerequisites:
For this step, we will again need to use our a private key from our wallet. To retrieve the private key from the Metamask wallet, follow these steps.
hyperlane warp init
This will create a new deployment config.
Hyperlane CLI
Hyperlane Warp Configure
------------------------
Creating a new warp route deployment config...
? Enter the desired owner address: YOUR_ADDRESS
? Select network type Testnet
Use SPACE key to select at least 1 chains, then press ENTER
? Select chains to connect holesky, neondev
holesky: Configuring warp route...
? Select holesky's token type collateral
? Detected mailbox address as YOUR_MAILBOX_ADDR from hyperlane-registry, is this correct? yes
? Enter the existing token address on chain holesky YOUR_MAILBOX_ADDR
neondev: Configuring warp route...
? Select neondev's token type synthetic
? Detected mailbox address as YOUR_MAILBOX_ADDR from hyperlane-registry, is this correct? yes
For this example, we will create a warp route that bridges an ERC20 token (WETH) to NeonEVM.
This will create a config file similar to this:
Warp Route config is valid, writing to file ./configs/warp-route-deployment.yaml:
holesky:
isNft: false
type: collateral
token: "0x94373a4919B3240D86eA41593D5eBa789FEF3848"
owner: "YOUR_WALLET_ADDR"
mailbox: "YOUR_MAILBOX_ADDR"
interchainSecurityModule:
type: staticAggregationIsm
modules:
- type: trustedRelayerIsm
relayer: "YOUR_WALLET_ADDR"
- owner: "YOUR_WALLET_ADDR"
type: defaultFallbackRoutingIsm
domains: {}
threshold: 1
neondev:
isNft: false
type: synthetic
owner: "YOUR_WALLET_ADDR"
mailbox: "YOUR_MAILBOX_ADDR"
interchainSecurityModule:
type: staticAggregationIsm
modules:
- type: trustedRelayerIsm
relayer: "YOUR_WALLET_ADDR"
- owner: "YOUR_WALLET_ADDR"
type: defaultFallbackRoutingIsm
domains: {}
threshold: 1
After this, we can start the route deployment:
hyperlane warp deploy
Your deployment plan will look similar to this:
Before confirming, make sure you have enough devnet NEON for gas, since we are deploying many contracts.
After the deployment is complete, this configuration will be added into warp confugrations in your .hyperlane folder.
Finally, we can send the tokens:
hyperlane warp send --relay --warp $HOME/.hyperlane/deployments/warp_routes/WETH/holesky-neondev-config.yaml --amount 9
Follow the prompts and enter your private key:
Please enter private key or use the HYP_KEY environment variable. <YOUR_PRIVATE_KEY>
Make sure your origin network is holesky, since this is there we created the collateral contract. And the destination network is Neon Devnet.
? Select network type Testnet
? Select the origin chain holesky
? Select network type Testnet
? Select the destination chain neondev
This will start the message relay.
And after the transaction is confirmed on both chains, we can head over to Neon block explorer and check it out.
https://neon-devnet.blockscout.com/tx/0x384a599697d203402d65d836887450ead99da024bb79eba644274bc0c9a9acdd
If we scroll down to transaction input and view is as UTF-8, we can see than the transaction value of 9 wei is the very beginning of the data.
Let’s also go to neon scan and check the corresponding Solana transactions.
https://devnet.neonscan.org/tx/0x384a599697d203402d65d836887450ead99da024bb79eba644274bc0c9a9acdd
In the first Solana tx we can now also see our message in hex format relayed on solana.
Great, we have successfully deployed and used a warp route to bridge test funds from holesky to Neon. We've explored the powerful integration of NeonEVM and Hyperlane, demonstrating cross-chain messaging and token transfers between Ethereum and Neon as well as Solana. Our journey covered:
This integration bridges Ethereum's smart contract capabilities with Solana's speed and efficiency, opening up new possibilities for decentralized applications. It paves the way for innovative cross-chain DeFi, NFTs, and governance systems…
Other articles