<!-- Canonical: https://docs.linea.build/api/linea-smart-contracts/interfaces/imessageservice -->

> For the complete Linea documentation index, see [llms.txt](/llms.txt).
> Agents can fetch this page as Markdown at [https://docs.linea.build/api/linea-smart-contracts/interfaces/imessageservice.md](https://docs.linea.build/api/linea-smart-contracts/interfaces/imessageservice.md).

# IMessageService

# `IMessageService`

### MessageSent

```solidity
event MessageSent(address _from, address _to, uint256 _fee, uint256 _value, uint256 _nonce, bytes _calldata, bytes32 _messageHash)
```

Emitted when a message is sent.

#### Parameters

| Name | Type | Description |
| --- | --- | --- |
| _from | address | The indexed sender address of the message (msg.sender). |
| _to | address | The indexed intended recipient address of the message on the other layer. |
| _fee | uint256 | The fee being being paid to deliver the message to the recipient in Wei. |
| _value | uint256 | The value being sent to the recipient in Wei. |
| _nonce | uint256 | The unique message number. |
| _calldata | bytes | The calldata being passed to the intended recipient when being called on claiming. |
| _messageHash | bytes32 | The indexed hash of the message parameters. |

### MessageClaimed

```solidity
event MessageClaimed(bytes32 _messageHash)
```

Emitted when a message is claimed.

#### Parameters

| Name | Type | Description |
| --- | --- | --- |
| _messageHash | bytes32 | The indexed hash of the message that was claimed. |

### FeeTooLow

```solidity
error FeeTooLow()
```

_Thrown when fees are lower than the minimum fee._

### ValueSentTooLow

```solidity
error ValueSentTooLow()
```

### MessageSendingFailed

```solidity
error MessageSendingFailed(address destination)
```

_Thrown when the destination address reverts._

### FeePaymentFailed

```solidity
error FeePaymentFailed(address recipient)
```

_Thrown when the recipient address reverts._

### sendMessage

```solidity
function sendMessage(address _to, uint256 _fee, bytes _calldata) external payable
```

Sends a message for transporting from the given chain.

#### Parameters

| Name | Type | Description |
| --- | --- | --- |
| _to | address | The destination address on the destination chain. |
| _fee | uint256 | The message service fee on the origin chain. |
| _calldata | bytes | The calldata used by the destination message service to call the destination contract. |

### claimMessage

```solidity
function claimMessage(address _from, address _to, uint256 _fee, uint256 _value, address payable _feeRecipient, bytes _calldata, uint256 _nonce) external
```

Deliver a message to the destination chain. Is called by the Postman, dApp or end user.

#### Parameters

| Name | Type | Description |
| --- | --- | --- |
| _from | address | The msg.sender calling the origin message service. |
| _to | address | The destination address on the destination chain. |
| _fee | uint256 | The message service fee on the origin chain. |
| _value | uint256 | The value to be transferred to the destination address. |
| _feeRecipient | address payable | Address that will receive the fees. |
| _calldata | bytes | The calldata used by the destination message service to call/forward to the destination contract. |
| _nonce | uint256 | Unique message number. |

### sender

```solidity
function sender() external view returns (address originalSender)
```

Returns the original sender of the message on the origin layer.

#### Return Values

| Name | Type | Description |
| --- | --- | --- |
| originalSender | address | The original sender of the message on the origin layer. |

Contributions not accepted

These reference pages are automatically generated based on Linea's [smart contracts](https://github.com/Consensys/linea-monorepo/tree/main/contracts/src). To ensure they accurately match the deployed smart contracts, we cannot accept any contributions that edit these pages.
