Bridge SPL or ERC-20

The Hyperlane bridge is currently deployed on Eclipse Devnet. Hyperlane provides fast finality bridging between Eclipse Mainnet and other blockchains. This integration enables Eclipse Mainnet to connect with other rollups and ecosystems without permission, such as the Solana L1.

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.

Mailbox Contract

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, you can do so here.

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.

Interacting with the mailbox 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.

Writing the Smart Contract

Parsing Instruction Data

Send the instruction data and set up the send message function:

fn process_instruction(
    program_id: &Pubkey,
    accounts: &[AccountInfo],
    instruction_data: &[u8],
) -> ProgramResult {
    match instruction_data.get(0) {
        Some(&0) => {
            let accounts_iter = &mut accounts.iter();
            let sender_account = next_account_info(accounts_iter)?;
            let recipient_account = next_account_info(accounts_iter)?;
            let message_data = &instruction_data[1..];

Now, call the send message function:


Here you can call the receive message function. This goes inside the main match block:

    Some(&1) => {
      let accounts_iter = &mut accounts.iter();
      let recipient_account = next_account_info(accounts_iter)?;
      mailbox::instruction::receive_message(program_id, recipient_account)?;
    _ => return Err(solana_program::program_error::ProgramError::InvalidInstructionData),

Hyperlane CLI

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.

Last updated