> For the complete documentation index, see [llms.txt](https://docs.ternoa.network/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ternoa.network/build-1/javascript/ternoa-js-library-utilities/on-chain-data-at-a-specific-blockhash.md).

# On-chain data at a specific blockhash

Ternoa-js provides the capability to query chain state at a specific/custom passed blockhash

{% hint style="info" %}
If you are not familiar with the process of creating a transaction on the Ternoa chain, we highly suggest first reading the Getting Started section of the documentation with a focus on:&#x20;

* [The Ternoa-js architecture ](/getting-started/javascript-sdk/ternoa-js-library/architecture.md)
* [The Ternoa-js workflow](/getting-started/javascript-sdk/ternoa-js-library/workflow.md)
  {% endhint %}

{% hint style="info" %}
To learn more about how to access the Ternoa-js API & make custom interactions with the Ternoa chain read these sections:&#x20;

* [Access Ternoa API](/build-1/javascript/ternoa-js-library-utilities/installation-and-initialization.md#accessing-the-ternoa-api)
* [Make custom requests](/build-1/javascript/ternoa-js-library-utilities/customs-extrinsics-and-queries.md)
  {% endhint %}

```typescript
const api = getRawApi()
const lastHeader = await api.rpc.chain.getHeader();
const apiAt = await api.at(lastHeader.hash);
```

Once you have access to the apiAt a specific blockhash, you can perform any operation. For example to query a balance:&#x20;

```typescript
 const balance = await apiAt.query.system.account("//REPLACE BY THE ADRESS");
```

{% hint style="info" %}
Useful resources from Polkadot{.js} documentation:&#x20;

* [Read storage, at a specific blockhash](https://polkadot.js.org/docs/api/examples/promise/read-storage-at)
* [State at a specific block](https://polkadot.js.org/docs/api/start/api.query.other/#state-at-a-specific-block)
  {% endhint %}
