# Agent Gas Values

### Context <a href="#context" id="context"></a>

Gas estimation is hard. `eth_estimateGas` calls have historically caused our agents many issues across different RPC providers and networks. Given that we now have a reasonable dataset on how much gas is needed for different contract methods, we are moving to custom-coding our gas limits using estimates from previous gas usage data.

### Standard EVM <a href="#standard-evm" id="standard-evm"></a>

#### Home <a href="#home" id="home"></a>

Update:

* Take average limit for one message (50k) and double base to 100k
* Each additional message dequeued is \~5k gas so double that cost to 10k per message
* `100k + (num_messages * 10k)`

Improper Update:

* Subset of `update` gas (`update` calls `improperUpdate`)
* Using same estimation as `update`
* `100k + (num_messages * 10k)`

DoubleUpdate:

* Signature check is \~`50k`
* Double that for two signature checks in double update `100k`
* Double total for safety to `200k`

#### Replica <a href="#replica" id="replica"></a>

Update:

* `70k` on average
* Double that to `140k` (constant)

Prove:

* `100k` on average
* Double that to `200k` (constant since merkle proofs always same size)

Process:

* Minimum `850k` required
* Double minimum to `1.7M`

ProveAndProcess:

* `1.7M` for process
* `200k` for prove
* `1.9M` total

DoubleUpdate:

* Signature check is \~`50k`
* Double that for two signature checks in double update `100k`
* Double total for safety to `200k`

#### XAppConnectionManager <a href="#xappconnectionmanager" id="xappconnectionmanager"></a>

UnenrollReplica:

* `60k` average
* Double that to `120k`

OwnerUnenrollReplica:

* Cheaper version of normal `unenrollReplica` without signature check
* Use same estimate of `120k`


---

# 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.nomad.xyz/developers/node-operators/agent-gas-values.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.
