> For the complete documentation index, see [llms.txt](https://docs.chiliz.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.chiliz.com/jp/kaihatsu/kihon/tips-and-tricks.md).

# Tips & Tricks

## Spicy Testnet で独自のトークンを作成する方法

Chiliz Chain Mainnet 上でアプリを開発するには、まず Spicy Testnet 上でテストし、高価な CHZ トークンを大量に使用せずに、コードが testCHZ トークンを適切に処理できることを確認する必要があります。そのために、Spicy Faucets を通じて Testnet トークンを無料で入手できます。

[無料の testnet token を入手する](/jp/kaihatsu/kihon/testnet-token-nyushu.md)

しかし開発では大量のテストトークンが必要になることがあり、faucet では 1 日あたりに入手できるトークン数に制限があります。

この制限から解放されるために、Spicy Testnet 上で独自のトークンを作成できます！ 実際、Chiliz Chain（Mainnet と Testnet）は EVM 互換のチェーンであり、CHZ および testCHZ トークンは実際には ERC20 トークンです。

したがって、Spicy Testnet 上で実質的に無制限の独自の ERC20 トークンを mint し、そのトークンを使ってコードを徹底的にテストできます。そして準備ができたと感じたら、Chiliz Chain Mainnet で本番稼働する前に、Spicy 上でテスト用 CHZ トークンを使って dApp をもう数回テストしてください。

Spicy Testnet で独自のトークンを作成する手順は次のとおりです。

1. MetaMask を Chiliz Spicy Testnet に接続する。
2. [Spicy Faucet からテスト用 CHZ トークンを入手する](/jp/kaihatsu/kihon/testnet-token-nyushu.md)。ERC20 コントラクトを deploy するには CHZ トークンが必要になるため、これが必要です。
3. トークンの smart contract を記述する（[OpenZeppelin の ERC20](https://docs.openzeppelin.com/contracts/5.x/erc20) を利用することをお勧めします）。`constructor` 内で、トークンの名前（例: "MyOwnToken"）、シンボル（例: "MOT"）を設定し、必要に応じた初期供給量を mint します。
4. コントラクトをコンパイルして Spicy Testnet に deploy し、[block explorer](/jp/kaihatsu/kihon/block-explorer.md) を通じて verify します。
5. MetaMask で新しいトークンを表示する。
   1. デプロイツールセット（例: Remix の "Deployed Contracts" メニュー）からトークンの contract アドレスをコピーします。
   2. MetaMask で "Tokens" タブに移動し、"Import tokens" をクリックします。
   3. contract アドレスを貼り付けます。シンボルと小数桁数は自動的に入力されるはずです。
   4. "Add custom token" をクリックし、続いて "Import tokens" をクリックします。これで新しいトークンの残高が表示されるはずです。

これで、独自のトークンを使って Spicy Testnet 上で Chiliz Chain dApp をテストする準備が整いました！

## 現在の gas 価格を取得する方法

Chiliz Chain で gas 価格を取得するには、[公開 RPC ノードの 1 つ](/jp/kaihatsu/kihon/chiliz-chain-setsuzoku/rpc-setsuzoku.md) を使用できます。

現在の gas 価格は次のようにして取得できます。

```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"
}'
```

## トランザクションが失敗した理由を確認する方法

トランザクションは失敗することがありますが、特に block explorer がエラーを表示しないため、その理由が必ずしもわかるとは限りません。

{% hint style="warning" %}
トランザクションが長時間「pending」状態のままにならないようにするため、手数料をカバーするのに十分な量を含めるべきです。

* 最低 gas 手数料: 2,501 Gwei。
* 最低 priority 手数料: 1 Gwei。
  {% endhint %}

トランザクションが失敗した理由を確認するには、正しいトランザクション 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
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:

```
GET https://docs.chiliz.com/jp/kaihatsu/kihon/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.
