send_message_to_L1
syscall
sendMessageToL2
function
send_message_to_L1
syscall.
processMessage
function, which is part of the Starknet Core Contract, emits the LogMessageToL1
event, which contains the message parameters.
consumeMessageFromL2
function, which includes the message parameters within the transaction. This function, which is part of the Starknet Core Contract, verifies the following:
consumeMessageFromL2
function in StarknetMessaging.sol
.
L2→L1 message mechanism
MSG_TO_L1
in the Starknet API JSON RPC specification as follows:
from_address (felt252 ) | The address of the L2 contract sending the message. |
to_address (EthAddress ) | The target L1 address the message is sent to. |
payload (Array<felt252> ) | The payload of the message. |
sendMessageToL2
function on the Starknet Core Contract with the message parameters.
The Starknet Core Contract hashes the message parameters and updates the L1→L2 message mapping to indicate that a message with this hash was indeed sent. The L1 contract records the fee that the sender paid. For more information, see L1 → L2 message fees.
l1_handler
decorator on the target contract. Transactions like this on L2 are called L1 handler transactions.
l1_handler
function.
FromAddress | ToAddress | Selector | Payload | Nonce | |
---|---|---|---|---|---|
EthereumAddress | FieldElement | FieldElement | List | FieldElement |
startL1ToL2MessageCancellation
function in the Starknet Core Contract.
cancelL1ToL2Message
function.
sendMessageToL2
on the Starknet Core Contract.
The sequencer takes this fee in exchange for handling the message. The sequencer charges the fee in full upon updating the L1 state with the consumption of this message.
The fee itself is calculated in the same manner as “regular” L2 transactions.
Version | ContractAddress | Selector | Calldata | Nonce | |
---|---|---|---|---|---|
FieldElement | FieldElement | FieldElement | List | FieldElement |
l1_handler
is a constant prefix, encoded in bytes (ASCII), as big-endian.
version
is the transaction version. Only version 0 is currently supported.
chain_id
is a constant value that specifies the network to which this transaction is sent.
0
indicates that L1 to L2 message fees are charged on L1.
get_caller_address
or similar account-related functions returns the address 0x0
.
REVERTED
, instead of only be written in the feeder gateway’s database as REJECTED
. The purpose of this change is to simplify the tracking of messages L1 → L2, and the implementation of getMessageStatus
in particular.
l1_gas
, l2_gas
, and l1_data_gas
execution resources of L1 handlers will be bounded as follows:
l2_gas
will bounded by (the same as __validate__
’s)
l1_gas
and l1_data_gas
will be bounded by and , respectively (to allow for sending one L2 → L1 message)
Current version | Deprecated versions | Unsupported versions |
---|---|---|
v0 | N/A | N/A |