Deploy an SVM HWR
Outcomes
You will be deploying a Hyperlane Warp Route (HWR) for an asset of your choice, between two SVM chains with an existing Hyperlane core deployment. At the time of writing this document, supported SVM chains are Solana and Eclipse, but you can find an up-to-date list here (all chain directory names with a core
subdirectory).
If you want your SVM rollup supported as a core Hyperlane deployment, or are looking to set up an EVM to SVM HWR, get in touch!
HWR Types
The type of token used determines the HWR type, so it’s important to understand the different HWR 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 HWR, 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 HWR 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 HWR 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 HWR 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.
Before You Start
Deploying a HWR 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.
Walkthrough: Deploy a Sealevel HWR
Step 1: Build the HWR Programs
-
Clone the hyperlane-monorepo
-
Build the HWR programs on your machine.
solana-cli 1.14.20
is required for building HWR programs, but it is not required to manually install it. The./build-programs.sh
script will handle switching to this version automatically and revert to your previous version (1.18.18) after building.This script will compile the Solana programs, which is needed for deployment. It will use the
solana-cli 1.14.20
automatically and reset back to the previously used version afterward.To verify the build output, check the target/deploy directory for
.so
files inhyperlane-monorepo/rust/sealevel/target/deploy
During the build process, you may encounter a stack offset error message like
Error: Function [...] Stack offset of 4360 exceeded max offset of xx ..
. This is a known issue that has no impact on the functionality of the programs. The error relates to an unused function in a dependency crate and can be ignored. The programs will build, deploy, and function correctly despite this warning.
Step 2: Prepare for Deployment
-
To deploy the contracts, install
solana-cli 1.18.18
. Note that you must use this version, otherwise deployment may fail.After installing you can verify the version with:
-
Create a Solana keypair. 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.
-
To read the public key you just created:
-
Check the balance:
-
Step 3: Configure the HWR
-
Create a directory for your HWR in
rust/sealevel/environments/mainnet3/warp-routes
with the name you want your HWR deployment to have.For example, the existing SOL HWR between Solana and Eclipse lives in
rust/sealevel/environments/mainnet3/warp-routes/eclipsesol
. -
Inside the directory you just created, create a configuration file named
token-config.json
.Configure the parameters of your HWR based on the
serde_json
serialization of the TokenConfig Rust struct. The value to set for theinterchainGasPaymaster
, can be found in the core deployment artifacts.The example below shows a testnet Native to Synthetic HWR that transfers SOL from Solana and mints synthetic SOL on Eclipse. You can also check this configuration of a production SOL HWR.
-
(Optional) If your HWR creates a Synthetic token, you can open a PR to the
hyperlane-registry
with metadata to associate with this token (example PR here). Thehyperlane-registry
also gives your HWR visibility within the Hyperlane ecosystem.
Step 4: Deploy the HWR
-
Fund the new keypair on both networks the HWR is being deployed to.
-
The public key should be the same across SVM networks, but 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 HWR, pay for transaction fees, and fund the ATA payer accounts (more on this below). For reference, the observed rent from one HWR account is
2.35 SOL
on Solana and0.025 ETH
on Eclipse, so it’s a good idea to fund the key with at least5 SOL
/0.05 ETH
.
-
-
Deploy the HWR using the
warp-route deploy
subcommand from therust/sealevel/client
directory:Example usage:
Please choose a reasonable amount to fund the HWR ATA payer accounts. The
recommended initial funding amount is alert_threshold * 2
, with the
threshold value found
here.
- Overview of CLI flags:
--warp-route-name
: should match the directory name picked for the HWR earlier--environment
: keep asmainnet3
--environments-dir ../environments
: keep as../environments
--built-so-dir
: keep as../../target/deploy
, as it points to the compilation output directory of HWR programs--token-config-file
: point this to thetoken-config.json
file created earlier--registry
: path to your local clone of the hyperlane-registry--ata-payer-funding-amount
: this flag specifies by how much to fund the HWR 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 value1000000
works out to0.001
ETH and0.001
SOL, which is enough for an initial deployment, but not for production usage. ATA payers can always be topped up later. For reference, every HWR transfer costs the ATA payer0.000000001 SOL
(on Solana) and0.000021 ETH
(on Eclipse) on the destination chain.
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.
Troubleshooting tips
-
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
orError: 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 configure a private RPC URL in your local clone of the hyperlane-registry. (e.g. in
solanamainnet.rpcUrls.http
) -
If deploying a synthetic token, 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, runwarp-route deploy
:
Interacting with the HWR
-
Query the HWR Program
You can check the program details like Mint Account, Mint Authority, and ATA payer account using the following command:
Replace:
<CHAIN_RPC_URL>
: e.g., https://api.devnet.solana.com<PROGRAM_ID>
: base58 address from program-ids.json (located in your warp-route directory).<TOKEN_TYPE>
: native|synthetic|collateral
If deploying a synthetic token, query the Mint Authority account to check out the metadata:
-
Transfer Tokens Through the HWR
To test token transfers across chains, run the following command:
<DESTINATION_CHAIN_DOMAIN_ID>
: You’ll need the domain ID of the chain you’re sending to, which you can find in the chain’smetadata.yaml
entry from the hyperlane-registry.<PROGRAM_ID>
: base58 address from program-ids.json (located in your warp-route directory).<WARP_TOKEN_TYPE_ON_ORIGIN_CHAIN>
: Type of token on the origin chain, options are: native|synthetic|collateral
-
Verify the Balance on the Destination Chain
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 HWR 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
-
Explore Additional CLI Commands
This guide has made heavy use of the
hyperlane-sealevel-client
CLI fromhyperlane-monorepo
. You may find its various commands useful for configuring the HWR, making state queries, sending transfers, and more. Check out the other utilities it provides, in particular those under thetoken
subcommand.
For production deployments, we strongly recommend avoiding the use of hotkeys like those used in this guide. Instead, transfer ownership to a multisig setup, such as Squads, for enhanced security.