# Tips & Tricks

## How to create your own token on Spicy Testnet

Developping an app on Chiliz Chain Mainnet requires first to test it on Spicy Testnet, in order to check that your code handles testCHZ tokens well without having to use tons of expensive CHZ tokens. For that purpose, you can obtain Testnet tokens for free through our Spicy Faucets:

{% content-ref url="obtain-free-testnet-tokens" %}
[obtain-free-testnet-tokens](https://docs.chiliz.com/develop/basics/obtain-free-testnet-tokens)
{% endcontent-ref %}

But sometimes development requires a lot of test tokens, and the faucets are limited in how many tokens you can get each day.

In order to free yourself from this limitation, you can create your own token on Spicy Testnet! Indeed, Chiliz Chain (Mainnet and Testnet) are EVM-compataible chains, and the CHZ and testCHZ tokens are really ERC20 tokens.

You can therefore mint your own, quasi-unlimited ERC20 token on Spicy Testnet, and test your code thoroughly with that token. Then, once you feel you're ready, test your dApp with test CHZ tokens on Spicy a few more times before going live on Chiliz Chain Mainnet.

Here are the steps to create your own token on Spicy Testnet:

1. [Connect MetaMask to Chiliz Spicy Testnet](https://docs.chiliz.com/learn/about-wallets/how-to-use-metamask/link-chiliz-chain-and-metamask).
2. [Get test CHZ tokens from the Spicy Faucet](https://docs.chiliz.com/develop/basics/obtain-free-testnet-tokens). This is needed because you will need CHZ tokens to deploy your ERC20 contract.
3. Write the token's smart contract (we recommend relying on [OpenZeppelin's ERC20](https://docs.openzeppelin.com/contracts/5.x/erc20)). In your `constructor`, set the token's name (e.g., "MyOwnToken"), symbol (e.g., "MOT"), and mint an initial supply that's enough for your needs.
4. [Compile the contract and deploy it to Spicy Testnet](https://docs.chiliz.com/quick-start/developer-toolbox/deploy-and-verify-a-contract), then verify it through a [block explorer](https://docs.chiliz.com/develop/basics/use-a-block-explorer).
5. View your new token in MetaMask:
   1. Copy your token's contract address from your deployment toolset (e.g., Remix's "Deployed Contracts" menu).
   2. In MetaMask, go to the "Tokens" tab and click "Import tokens".
   3. Paste the contract address. The symbol and decimals should auto-fill.
   4. Click "Add custom token" and then "Import tokens". You should now see your new token balance.

You're now ready to test your Chiliz Chain dApp on Spicy Testnet with your own token!

## How to get the current gas price

To get the gas price on Chiliz Chain, you can use [one of the public RPC nodes](https://docs.chiliz.com/develop/connect-to-chiliz-chain/connect-using-rpc).

You can obtain the current gas price like so:&#x20;

```bash
curl --location 'https://rpc.ankr.com/chiliz' # For Spicy: https://spicy-rpc.chiliz.com/
--header 'Content-Type: application/json' 
--data '{ 
    "method": "eth_gasPrice", 
    "params": [], 
    "id": 1, 
    "jsonrpc": "2.0"
}'
```

## How to check why a transaction failed

A transaction might fail,  and you don't always know why, especially since the block explorer doesn't display the error.&#x20;

{% hint style="warning" %}
To ensure that your transaction doesn't remain in "pending" status for too long, you should include enough to cover the fees:

* Minimum gas fee: 2,501 Gwei.
* Minimum priority fee: 1 Gwei.
  {% endhint %}

To check why your transaction failed, run the following script in the terminal with the correct transaction ID:

```bash
curl --location 'https://rpc.ankr.com/chiliz' # For Spicy: https://spicy-rpc.chiliz.com/
--header 'Content-Type: application/json' 
--data '{
    "method": "debug_traceTransaction",
    "params": [
        "[Transaction ID]",
        {
            "tracer": "callTracer"
        }
    ],
    "id": 1,
    "jsonrpc": "2.0"
}'
```


---

# Agent Instructions: 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:

```
GET https://docs.chiliz.com/develop/basics/tips-and-tricks.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
