> For the complete documentation index, see [llms.txt](https://docs.bitoftrade.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.bitoftrade.com/for-developers/cross-chain-messaging-protocol/quick-start/receive-event.md).

# Receive event

After the event was made on the SRC chain and verified by the Signer, the last step of the protocol is receiving that event on the **DEST** chain.&#x20;

\
We can trust that event happened on the **SRC** chain if proof of this event was made by the correct signer. [Signers Registry smart contract](/for-developers/cross-chain-messaging-protocol/how-it-works/signers-registry-contract.md) is responsible for this validation.

In our example, to receive the event on the **DEST** chain, we have to call `receiveMyMessage` method on the `MsgReceiver`.&#x20;

```solidity
pragma solidity ^0.8.0;

contract MsgReceiver {
    event MyMessageReceived(string message);

    ISignersRegistry signersRegistry;

    constructor(address _signersRegistry) {
        signersRegistry = ISignersRegistry(_signersRegistry);
    }

    function receiveMyMessage(
        bytes calldata _signature,
        string memory _message,
        address _msgSender,
        uint256 _chainId,
        bytes calldata _transactionHash
    ) external {
        bytes32 eventHash = keccak256(abi.encodePacked("MyMessage", _chainId, _msgSender, _transactionHash, _message));
        address signer = eventHash.recover(_signature);
        bool isSignerWhitelisted = signersRegistry.isPublicWhitelisted(signer);
        
        require(isSignerWhitelisted, "Signer is not whitelisted");

        emit MyMessageReceived(_message);
    }
}

```

You can check, that [eventHash](/for-developers/cross-chain-messaging-protocol/how-it-works/signer-service/event-hash.md) was made the same way as Signer did while making the signature. It's very important to recover the signature with the same eventHash.&#x20;

After the signature maker was recovered, `signersRegistry` checked if the signer was whitelisted. That's why all public and private `Signers` have to be whitelisted before producing any event proofs.

If `signersRegistry` approved that the signer was whitelisted, it means that we can trust this event. Therefore, do any steps required by your dApp.&#x20;

In our example, it just emits the `MyMessageReceived` event.&#x20;

See the example of the `receiveMyMessage` transaction on the [explorer](https://polygonscan.com/tx/0x3b9c04a4d3d0061173be7654724a9114441f125bc5912a4b31e9bb3f39b4223c).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.bitoftrade.com/for-developers/cross-chain-messaging-protocol/quick-start/receive-event.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
