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 (not yet available)
- pull: users / protocols responsible for triggering the transaction
Contractsβ
Contract | L1 (Goerli) Address | L2 (Linea) Address |
---|---|---|
Transparent Proxy | 0x70BaD09280FD342D02fe64119779BC1f0791BAC2 | 0xC499a572640B64eA1C8c194c43Bc3E19940719dC |
Implementation | 0x2652e1547Ac6b9a0311cF1B7F024a378f30ad8D8 | 0xc0557e2149751e201749b87f86acd91DB22e2662 |
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 (this is not yet available)
- An optional field used to incentivize a Postman to perform
_calldata
: a flexible field that is generally created usingabi.encode(...)
- Example: the Canonical Token Bridge (link to Etherscan)
- 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