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 on L1. If you want to send a message from L2 to L1, use the contract deployed on L1.

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.

ParameterDescription
targetThe address of account who receive the message. The receiver can be either a smart contract or a EOA wallet.
valueThe amount of ether passed when call target contract.
messageThe content of the message. This is the arbitrary calldata to be executed.
gasLimitGas limit required to complete the message relay on corresponding chain.
refundAddressThe address of account who will receive the refunded fee.

relayMessageWithProof

function relayMessageWithProof(
  address from,
  address to,
  uint256 value,
  uint256 nonce,
  bytes memory message,
  L2MessageProof memory proof
) external;

Relay a L2 => L1 message with message proof.

ParameterDescription
fromThe address of the sender of the message.
toThe address of the recipient of the message.
valueThe msg.value passed to the message call.
nonceThe nonce of the message to avoid replay attack.
messageThe content of the message.
proofThe proof used to verify the correctness of the transaction.
Stay up-to-date on the latest Scroll Developer news
Roadmap updates, virtual and live events, ecosystem opportunities and more
Thank you for subscribing!

Resources

Follow Us

© Version 1.0.0 Scroll Ltd 2023