The Scroll Messenger

You can send arbitrary messages from L1 to L2 or vice versa through the Scroll Messenger contracts. This means we can execute functions on another chain in a secure and permissionless way. If you want to send a message from L1 to L2, use the messenger smart contract deployed at 0x5260e38080BFe97e6C4925d9209eCc5f964373b6 on Goerli testnet. If you want to send a message from L2 to L1, use the contract deployed at 0xb75d7e84517e1504C151B270255B087Fd746D34C on Scroll Alpha.

Messenger API

Please visit the npm library for the complete Scroll contract API documentation.

sendMessage

function sendMessage(
    address target,
    uint256 value,
    bytes calldata message,
    uint256 gasLimit,
    address refundAddress
) external payable;

Sends arbitrary data from one chain to another. It allows us to execute functions cross-chain.

Parameter
Description

target

The address of account who receive the message. The receiver can be either a smart contract or a EOA wallet.

value

The amount of ether passed when call target contract.

message

The content of the message. This is the arbitrary calldata to be executed.

gasLimit

Gas limit required to complete the message relay on corresponding chain.

refundAddress

The address of account who will receive the refunded fee.

Last updated

Was this helpful?