> For the complete documentation index, see [llms.txt](https://intrinsic-1.gitbook.io/axiomv2-sdk/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://intrinsic-1.gitbook.io/axiomv2-sdk/sdk-and-repl-reference/axiomrepl-reference/data-functions.md).

# Data Functions

All data fetching results will return a `CircuitValue256`. If an input value is of type `string`, `number`, or `bigint`, it will be treated as a constant (regardless of the input to your circuit, it will need to remain the same). If you pass in a `CircuitValue` instead, it will be a variable input to your circuit. All inputs defined in the JSON input panel at the bottom of axiom-repl will be auto-converted to `CircuitValue`s (or `CircuitValue256` if it exceeds 253 bits) and injected into your circuit.

### Account Subquery

<pre class="language-typescript" data-full-width="false"><code class="lang-typescript"><strong>const account = getAccount(blockNumber, address)
</strong><strong>const nonce: CircuitValue256 = account.nonce()
</strong>const balance: CircuitValue256 = account.balance()
const storageRoot: CircuitValue256 = account.storageRoot()
const codeHash: CircuitValue256 = account.codeHash()
</code></pre>

See for more details and limitations:

{% content-ref url="/pages/81wtC6WsBO9RVL27ywWa" %}
[Account Subquery](/axiomv2-sdk/sdk-and-repl-reference/axiom-sdk-reference/data-subqueries/account-subquery.md)
{% endcontent-ref %}

### Header Subquery

```typescript
const header = getHeader(blockNumber)
const parentHash: CircuitValue256 = header.parentHash()
const sha3Uncles: CircuitValue256 = header.sha3Uncles()
const miner: CircuitValue256 = header.miner()
const stateRoot: CircuitValue256 = header.stateRoot()
const transactionsRoot: CircuitValue256 = header.transactionsRoot()
const receiptsRoot: CircuitValue256 = header.receiptsRoot()
const difficulty: CircuitValue256 = header.difficulty()
const blockNumber: CircuitValue256 = header.number()
const gasLimit: CircuitValue256 = header.gasLimit()
const gasUsed: CircuitValue256 = header.gasUsed()
const timestamp: CircuitValue256 = header.timestamp()
const extraData: CircuitValue256 = header.extraData()
const mixHash: CircuitValue256 = header.mixHash()
const nonce: CircuitValue256 = header.nonce()
const baseFeePerGas: CircuitValue256 = header.baseFeePerGas()


//gets the 32 bytes chunk of logsBloom, idx in [0, 8)
const logsBloom: CircuitValue256 = header.logsBloom(bytes32Idx)

```

See for more details and limitations:

{% content-ref url="/pages/3UZKjcwZDptmOenj2Gjd" %}
[Header Subquery](/axiomv2-sdk/sdk-and-repl-reference/axiom-sdk-reference/data-subqueries/header-subquery.md)
{% endcontent-ref %}

### Solidity Nested Mapping Subquery

```typescript
const mapping: Mapping = getSolidityMapping(blockNumber, address, slot)

/**
* Retrieves the value of a specific key in the mapping.
*
* @param key - The key of the mapping. Can be string | number | bigint or
* can be CircuitValue | CircuitValue256
* @returns A `CircuitValue256` representing the value of the key in the mapping.
*/
const val: CircuitValue256 = mapping.key(key)

/**
* Retrieves the value of a specific set of keys in a nested mapping.
*
* @param keys - Each key can be string | number | bigint or
* can be CircuitValue | CircuitValue256
* @returns A `CircuitValue256` representing the value.
*/
const nestedVal: CircuitValue256 = mapping.nested([key1, key2, key3])
```

See for more details and limitations:

{% content-ref url="/pages/OO8BXl9XmyLZH1VMwJf0" %}
[Solidity Nested Mapping Subquery](/axiomv2-sdk/sdk-and-repl-reference/axiom-sdk-reference/data-subqueries/solidity-nested-mapping-subquery.md)
{% endcontent-ref %}

### Receipt Subquery

```typescript
const receipt: Receipt = getReceipt(blockNumber, txIdx);

const txType: CircuitValue256 = receipt.txType();
const blockNumber: CircuitValue256 = receipt.blockNumber();
const txIdx: CircuitValue256 = receipt.txIdx();

// gets the 32 bytes chunk of logsBloom, idx in [0, 8)
const logsBloom: CircuitValue256 = receipt.logsBloom(bytes32Idx)

// retrieves a log entry in the receipt
const log: Log = receipt.log(logIdx)

// gets the address from which the event was emitted from
const address: CircuitValue256 = log.address()

// gets the value of a log topic, with an event given by eventSchema
const topic: CircuitValue256 = log.topic(topicIdx, eventSchema)

// gets a 32 byte chunk of the logs data at the specified offset
const data: CircuitValue256 = log.data(bytes32Idx)
```

See for more details and limitations:

{% content-ref url="/pages/rtkGSNuvXAvnAhhzKhrx" %}
[Receipt Subquery](/axiomv2-sdk/sdk-and-repl-reference/axiom-sdk-reference/data-subqueries/receipt-subquery.md)
{% endcontent-ref %}

### Transaction Subquery

```typescript
const tx: Tx = getTx(blockNumber, txIdx)

const chainId: CircuitValue256 = tx.chainId();
const nonce: CircuitValue256 = tx.nonce();
const maxPriorityFeePerGas: CircuitValue256 = tx.maxPriorityFeePerGas();
const maxFeePerGas: CircuitValue256 = tx.maxFeePerGas();
const gasLimit: CircuitValue256 = tx.gasLimit();
const to: CircuitValue256 = tx.to();
const value: CircuitValue256 = tx.value();
const data: CircuitValue256 = tx.data();
const gasPrice: CircuitValue256 = tx.gasPrice();
const v: CircuitValue256 = tx.v();
const r: CircuitValue256 = tx.r();
const s: CircuitValue256 = tx.s();

const type: CircuitValue256 = tx.type();
const blockNumber: CircuitValue256 = tx.blockNumber();
const txIdx: CircuitValue256 = tx.txIdx();
const functionSelector: CircuitValue256 = tx.functionSelector();

// retrieves a 32 byte chunk of the transaction calldata at a specified offset
const calldata: CircuitValue256 = tx.calldata(bytes32Idx);

// retrieves a 32 byte chunk of the transaction calldata if it was a contract
// deployment transaction
const contractData: CircuitValue256 = tx.contractData(bytes32Idx)
```

To find a the index of a transaction from its transaction hash, open up the transaction in Etherscan, and then click on more details. The txIdx is labeled "Position in Block":

<figure><img src="/files/yvul0ENIwhODvZByVTap" alt=""><figcaption></figcaption></figure>

See for more details and limitations:

{% content-ref url="/pages/shiE59Ow5nSIjPJlndFY" %}
[Transaction Subquery](/axiomv2-sdk/sdk-and-repl-reference/axiom-sdk-reference/data-subqueries/transaction-subquery.md)
{% endcontent-ref %}

### Storage Subquery

```typescript
const storage: Storage = getStorage(blockNumber, address)

// gets the value of the specified slot in the contract's storage
const slotValue: CircuitValue256 = storage.slot(slot);
```

See for more details and limitations:

{% content-ref url="/pages/dy7bs6p7v9OiAiBeKAMe" %}
[Storage Subquery](/axiomv2-sdk/sdk-and-repl-reference/axiom-sdk-reference/data-subqueries/storage-subquery.md)
{% endcontent-ref %}


---

# 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://intrinsic-1.gitbook.io/axiomv2-sdk/sdk-and-repl-reference/axiomrepl-reference/data-functions.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.
