> For the complete documentation index, see [llms.txt](https://docs.bitbadges.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.bitbadges.io/token-standard/evm_integration/tokenization-precompile/gas.md).

# Gas

Gas costs are calculated dynamically based on operation complexity. More complex operations (multiple recipients, ranges, etc.) consume more gas.

For detailed gas calculations and optimization strategies, see the implementation in the [precompile code](https://github.com/BitBadges/bitbadgeschain/tree/evm-poc/x/tokenization/precompile).

## General Principles

* **Base costs** apply to all operations
* **Per-element costs** for arrays (recipients, ranges, etc.)
* **Query operations** are generally cheaper than transactions
* **Batch operations** are more gas-efficient than multiple individual calls

## Utility Method Gas Costs

Utility helper methods have low fixed gas costs:

| Method                      | Gas Cost | Description                      |
| --------------------------- | -------- | -------------------------------- |
| `convertEvmAddressToBech32` | 100      | Convert EVM to bech32 address    |
| `convertBech32ToEvmAddress` | 100      | Convert bech32 to EVM address    |
| `rangeContains`             | 200      | Check if value is in range       |
| `rangesOverlap`             | 200      | Check if two ranges overlap      |
| `searchInRanges`            | 500      | Search value in JSON range array |
| `getBalanceForIdAndTime`    | 500      | Get balance from JSON balances   |
| `getReservedListId`         | 300      | Get reserved list ID for address |

## Optimization Tips

* Minimize the number of recipients when transferring
* Consolidate token ID and ownership time ranges when possible
* Use direct return methods (`getBalanceAmount`, `getTotalSupply`) instead of protobuf-encoded methods when you only need amounts
* Batch multiple operations in a single transaction when possible
* Use utility helper methods (`rangeContains`, `searchInRanges`) for on-chain validation instead of implementing range logic in Solidity


---

# 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://docs.bitbadges.io/token-standard/evm_integration/tokenization-precompile/gas.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.
