> For the complete documentation index, see [llms.txt](https://gitbook.humanode.io/hmnd-ehmnd/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gitbook.humanode.io/hmnd-ehmnd/hmnd-ehmnd-swap-guide/ehmnd-to-hmnd.md).

# eHMND to HMND

### Tools

* Environment to deploy ethereum smart contracts like [Remix IDE](https://remix.ethereum.org/)
* Ethereum supported wallet like [Metamask](https://metamask.io)
* [Polkadot.js apps](https://gitbook.humanode.io/docs/tools-and-services/polkadotjs-apps)

### Steps

1. Open the Remix IDE and create a file containing the currency swap precompile interface.

```solidity
// SPDX-License-Identifier: UNLICENSED

pragma solidity >=0.7.0 <0.9.0;

/**
 * @title Currency Swap Interface
 *
 * An interface enabling swapping the funds from EVM accounts to
 * native Substrate accounts.
 *
 * Address: 0x0000000000000000000000000000000000000900
 */
interface CurrencySwap {
  /**
   * Transfer the funds from an EVM account to native substrate account.
   * Selector: 76467cbd
   *
   * @param nativeAddress The native address to send the funds to.
   * @return success Whether or not the swap was successful.
   */
  function swap(bytes32 nativeAddress) external payable returns (bool success);
}

```

<figure><img src="/files/aG4ASaqy3bshvB8ujaTZ" alt=""><figcaption></figcaption></figure>

2. Go to `compile` tab and compile the interface.<br>

   <figure><img src="/files/qttw4ZMAAP6ZGzLFpXcY" alt=""><figcaption></figcaption></figure>
3. Go to deploy tab.<br>

   <figure><img src="/files/2UFoOwcNfYoQ2OHbtzFl" alt=""><figcaption></figcaption></figure>
4. Properly select `ENVIRONMENT`, `ACCOUNT` and `CONTRACT` fields.<br>

   <figure><img src="/files/YZ57CnwVmumGPJCzC2Ua" alt=""><figcaption></figcaption></figure>
5. Use `0x0000000000000000000000000000000000000900` value as an input for `Deploy` tab at `At Address` field.<br>

   <figure><img src="/files/4BNthPu59UGyiO3fJFGS" alt=""><figcaption></figcaption></figure>
6. Click on `Deploy` tab and open `Deployed Contracts` tab. You will be able to see a `swap` call. The call accepts `bytes32` `nativeAddress` as an argument to send currency to.<br>

   <figure><img src="/files/hUBGwDXeSNwlwTniD4Gm" alt=""><figcaption></figcaption></figure>
7. Open `Utilities` tab at Polkadot-JS apps connected to Humanode Israfel Testnet.<br>

   <figure><img src="/files/NXyFe2HTbQcQCwXppjvO" alt=""><figcaption></figcaption></figure>
8. Convert your native HMND address into `bytes32` value.<br>

   <figure><img src="/files/05pHtnqiICc42QaALtUb" alt=""><figcaption></figcaption></figure>
9. Copy the value from the `hex public key` field and go back to Remix IDE. Input the value as an argument for the `swap` call. Input the amount you would like to swap into `VALUE` field. Keep in mind, that you should input the amount with 18 point decimals value in case using `Wei`.<br>

   <figure><img src="/files/zJbpmIEZm4FwZP8KTFM3" alt=""><figcaption></figcaption></figure>
10. &#x20;Finally, perform the swap by clicking on the `swap` call and confirm the transaction.<br>

    <figure><img src="/files/MEHfTTWURX9dDQgN0D8z" alt=""><figcaption></figcaption></figure>
11. Check the balance on the Polkadot-JS app.<br>

    <figure><img src="/files/dSxINAG506coBpjvcUND" alt=""><figcaption></figcaption></figure>


---

# 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://gitbook.humanode.io/hmnd-ehmnd/hmnd-ehmnd-swap-guide/ehmnd-to-hmnd.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.
