> For the complete documentation index, see [llms.txt](https://docs.creditcoin.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.creditcoin.org/creditcoin-usc/readability/gas-costs.md).

# Gas Costs

## What Influences Verification Cost?

1. **Continuity Proof Length (Large effect):** For each block in a continuity proof, the Creditcoin Native Verifier must perform a hashing operation to calculate a digest. All these hashing ops cost gas. For historical transactions, continuity proofs can be quite long (Eg: 1000 blocks). If you aren't already familiar with what a continuity proof is, see [continuity proving for queries](/creditcoin-usc/readability/step-2-transaction-proving/continuity-proving-for-queries.md).
2. **Merkle Proof Size (Small effect):** Merkle proof size grows modestly as you increase the number of transactions in a block. For example:
   * 1024 tx block -> 11 hash merkle proof (1 to get leaf + 10 with siblings)
   * 1 tx block -> 1 hash merkle proof\
     \
     This will cause some modest fluctuation in gas costs, but isn't a large factor.
3. **Transaction Data Size:** While not strictly a part of the verification process, transaction decoding is still a necessary step for USC Readability. For almost all transactions the cost of decoding is negligable. But a few outliers make this cost potentially noteworthy. \
   \
   Transaction types to avoid:
   * A single transaction in which contracts circularly call each-other 1000's of times
   * Transactions which bundle state updates for layer 2 rollup chains\
     \
     If you do happen request verification and decoding of very large transactions repeatedly, then the cost will add up. Estimated cost for 1 maximal decoding workload is **0.0375 CTC**.

## Verification Gas Equation

Below we provide a line of best fit equation which roughly estimates the gas cost of a query given the length of its continuity proof.

### Cost formula

*<mark style="background-color:$primary;">Cost ≈ (base tx cost) + (hash op cost) · (continuity hash count)</mark>*<br>

Based on it the approximate costs are:

**CTC Cost ≈ 2.3×10**<sup>**−5**</sup>**&#x20;+ 2.9×10**<sup>**−7**</sup>**&#x20;\* (continuity hash count)**

## Continuity Length Scenarios

1. Transaction which was finalized 10 minutes ago at height 10,870,001\
   Because this transaction is recent, we have an attestation in storage at block 10,870,010. So continuity proof verification requires 10 hashing ops. \
   \
   This gives us the expected price: **2.59x10**<sup>**−5**</sup>**&#x20;CTC**
2. Same transaction as in the first case, but we've waited another 24 hours\
   Now that we've waited for 1 day, the attestations in storage got replaced by more sparse checkpoints (1 per 1000 blocks). So continuity proof verification requires 1000 hashing ops. \
   \
   This gives us an expected price: **3.13×10**<sup>**−4**</sup>**&#x20;CTC**\
   \
   **That's more than 10x higher cost!** <br>

## **Key Takeaways**

* The cost of USC readability is currently quite low, facilitating as much traffic as desired
* To future proof against the potential of rising readability costs, try to make verification requests for transactions when they are recently finalized. This will reduce average continuity proof length by a factor of 10-100x.
