---
# System prepended metadata

title: Precompile Testing
tags: [MNET]

---

# Precompile Testing
### Ensure you can find the precompile implementation and it solidity interface contract are implemented.
Here is a table with the currently available precompiles and theirr interfaces:

| Pallet Name | Precompile Address | Solidity Interface | Precompile |
| -------- | -------- | -------- | -------- |
| currencies    | 0x0000000000000000000000000000000000000000    |[here](https://github.com/chexware/Bit-Country-Blockchain/blob/feature/nft-pallet-precompile/pallets/currencies/CurrencyInterface.sol)  | [here](https://github.com/bit-country/Metaverse-Network/blob/master/runtime/common/src/currencies.rs) |
| metaverse     | 0x0101010101010101010000000000000000000000    | [here](https://github.com/chexware/Bit-Country-Blockchain/blob/feature/metaverse-pallet-precompile/pallets/metaverse/MetaverseInterface.sol) | [here](https://github.com/chexware/Bit-Country-Blockchain/blob/feature/metaverse-pallet-precompile/runtime/common/src/metaverse.rs)|
| nft           | 0x0202020202020202020000000000000000000000    | [here](https://github.com/chexware/Bit-Country-Blockchain/blob/feature/nft-pallet-precompile/pallets/nft/NFTInterface.sol) | [here](https://github.com/chexware/Bit-Country-Blockchain/blob/feature/nft-pallet-precompile/runtime/common/src/nft.rs)|


#### !!! If you plan to test on a public testnet please make sure that the precompile is also included in its latest runtime.

### Run a local instance of the blockchain (if testing locally)
Inside a terminal instance on your machine enter `make run-dev` and wait until you see that the blockchain instance is running

### Log in to a funded metamask addresss
1. Ensure that your MetaMask extension is updated to it's latest version.
2. Inside MetaMask, open **Networks** tab and select **Add Network**.![](https://i.imgur.com/3gIL1ps.png)

2. Click **Add  a network manually**.![](https://i.imgur.com/E0xF60h.png)

3. Enter the following details and click **Save**. 
    *   **For a local network** !![metamask-setup-local](https://hackmd.io/_uploads/rJQp9Y5Yp.png)

    *   **For our public test network**![](https://i.imgur.com/X6rI8GQ.png)

4. Ensure that your address have enough tokens to perform transations. If not, transfer tokens from a funded account that you have access to.           

### Open Remix IDE and compile the .sol interface that you created.
1. Go to https://remix.ethereum.org/ and select the **Solidity** featured plugin and create a blank workspace called **Precomile Tests**. Delete all deafult folders and files.![](https://i.imgur.com/Od8v8U5.png)

2. Create a solidity file named in the format **[name_of_pallet_you_want_to_test].sol** and paste the solidity interface contract code.![](https://i.imgur.com/cbe5gtq.png)

3. From the **Solidity Compiler** tab compile the interface that you've created and ensure there are no compilation errors.   ![](https://i.imgur.com/O8Cu0lN.png)

        
### Deploy the compiled interface on your local chain
1. Open the **Deploy & Run Transactions** tab in **Remix IDE**.
2. Select **Injected Provider - MetaMask** as deployment environment.
4. Select your funded account and the solidity contract that you've just 
5. Enter the precompile address at the **At Address** field an click on it. ![](https://i.imgur.com/i9edyBI.png)


#### !!! Ensure that you reset your funded MetaMask account every time you run a new local blockchain instance.
![](https://i.imgur.com/KDEZdxA.png)![](https://i.imgur.com/o93CbkA.png)![](https://i.imgur.com/DitNEN5.png)

### Test if the interface calls work as expected
Ensure that all precompile functions are working as expected. You may need to pre-populate relevant information in the blockchain using Polkadot.js (e.g. create a metaverse and NFT when testing the auction precompile)

