Message service
The message service is responsible for cross-chain messages between Ethereum and Linea, which:
- Allows a contract on the source chain to safely interact with a contract on the target chain (e.g. L1TokenBridge triggering mint on the L2TokenBridge),
- Is responsible for bridging ETH (native currency on L1 and L2)
- Supports:
- push: auto-execution on target layer if a fee is paid
- pull: users / protocols responsible for triggering the transaction
Message service contractsβ
- Mainnet
- Linea Sepolia
L1 (Ethereum) Address | L2 (Linea) Address |
---|---|
0xd19d4B5d358258f05D7B411E21A1460D11B0876F | 0x508Ca82Df566dCD1B0DE8296e70a96332cD644ec |
L1 (Sepolia) Address | L2 (Linea Sepolia) Address |
---|---|
0xB218f8A4Bc926cF1cA7b3423c154a0D627Bdb7E5 | 0x971e727e956690b9957be6d51Ec16E73AcAC83A7 |
How to useβ
Workflowβ
- dApp calls
sendMessage(...)
on the origin layer usingMessageService.sol
- Args:
_to
: the destination address on the destination chain_fee
: the message service fee on the origin chain- An optional field used to incentivize a Postman to perform
claimMessage(...)
automatically on the destination chain (not available when bridging from L2 to L1)
- An optional field used to incentivize a Postman to perform
_calldata
: a flexible field that is generally created usingabi.encode(...)
- Args:
- dApp uses the Postman SDK (details to come) to pay for the execution of messages on the destination layer by:
- Triggering the delivery
- If messages donβt get delivered by the postman, the message can be manually claimed by calling
claimMessage
with the parameters detailed in the interface below or by using the SDK.
- If messages donβt get delivered by the postman, the message can be manually claimed by calling
- Receiving the delivery in the dApp smart-contract
- This triggers
claimMessage(...)
on the destination layer that will call_to
with_calldata
and a value equal to. - The dApp smart-contract can inherit from
MessageServiceBase.sol
to:- Verify that the call comes from the MessageService
onlyMessagingService
- Verify that the sender on the origin chain comes from a trusted contract (usually the dApp sibling contract) using
onlyAuthorizedRemoteSender()
- Verify that the call comes from the MessageService
- This triggers
- Triggering the delivery