> 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/usc/creditcoin-oracle-subsystems/readability/readability-gas-costs.md).

# Readability 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](/usc/creditcoin-oracle-subsystems/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:\
   1\. A single transaction in which contracts circularly call each-other 1000's of times\
   2\. 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.&#x20;

Cost≈ (base tx cost) + (hash op cost)⋅(continuity hash count)\
\
CTC Cost ≈ 2.3×10<sup>−5</sup> + 2.9×10<sup>−7</sup> \* (continuity hash count)

## Continuity Length Scenarios

1. Tx which was finalized 10 minutes ago at height 10,870,001\
   Because this tx 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 tx as in #1, 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**

1. The cost of USC readability is currently quite low, facilitating as much traffic as desired
2. 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.


---

# 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.creditcoin.org/usc/creditcoin-oracle-subsystems/readability/readability-gas-costs.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.
