> For the complete documentation index, see [llms.txt](https://crosschain-alliance.gitbook.io/hashi/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://crosschain-alliance.gitbook.io/hashi/getting-started/quick-start/pushing-a-message/writing-your-message-sending-contract.md).

# Writing your message sending contract

Here’s how you write a contract on **Sepolia** that dispatches a message using Hashi’s **Yaho** contract. This message will be relayed to **Chiado** and trigger the callback.

```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IYaho {
    function dispatchMessageToAdapters(
        uint256 targetChainId,
        uint256 threshold,
        address targetAddress,
        bytes memory data,
        address[] memory reporters,
        address[] memory adapters
    ) external;
}

contract SepoliaSender {
    IYaho public yaho = IYaho(0x21eAB033C7D2DF6A67AeF6C5Bda9A7F151eB9f52);  // Yaho address on Sepolia
    uint256 public threshold;
    address[] public reporters;
    address[] public adapters;

    constructor(address _yaho, uint256 _threshold, address[] memory _reporters, address[] memory _adapters) {
        threshold = _threshold;
        reporters = _reporters;
        adapters = _adapters;
    }

    // Function to send a cross-chain message to Chiado
    function sendMessageToChiado(
        uint256 targetChainId, 
        address targetAddress, 
        string memory _message
    ) public {
        bytes memory data = abi.encode(_message);
        yaho.dispatchMessageToAdapters(targetChainId, threshold, targetAddress, data, reporters, adapters);
    }
}
```

**Explanation**:

* The contract interacts with the **Yaho** contract on **Sepolia** to dispatch a message to **Chiado** using `dispatchMessageToAdapters`.
* The `sendMessageToChiado` function takes the target chain ID(10200 for Chiado), target address (ChiadoReceiver contract on Chiado), and the message to be sent.
* The **reporters**, **adapters**, and **threshold** are passed into the Yaho contract for cross-chain message validation and relaying.

**Deployment**:

* Deploy this contract on **Sepolia**, passing the **reporters**, **adapters**, and **threshold** into the constructor.
* A list of reporters and adapters contract can be found in: [Oracles](/hashi/core-concepts/oracles.md)
* Yaho contract address can be found in [Blockchains](/hashi/deployments/blockchains.md#yaho-and-yaru)
* `Threshold` must equal to `expectedThreshold` in Receiver contract.


---

# 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://crosschain-alliance.gitbook.io/hashi/getting-started/quick-start/pushing-a-message/writing-your-message-sending-contract.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.
