archive_v1_hashByHeight - Bittensor RPC Method
Get the block hash for a given block height from the archive RPC on Bittensor using the new JSON-RPC v2 spec.
Returns the block hash for a given block height (number) via the new JSON-RPC v2 archive API. Because Substrate chains can have forks, a single height may correspond to more than one block hash on non-finalized parts of the chain. For finalized blocks there is always exactly one hash per height.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
height | number | Yes | The block number (height) to look up. |
Response
| Field | Type | Description |
|---|---|---|
result | array | Array of hex-encoded block hashes at the given height. Typically one element for finalized blocks; may contain multiple for non-finalized forks. Returns an empty array if the height is beyond the chain tip. |
Code Examples
Use Cases
- Block resolution -- Resolve a block number to a hash before querying
archive_v1_body,archive_v1_header, orarchive_v1_call. - Sequential block scanning -- Iterate through blocks by height for indexing pipelines, converting each height to a hash before fetching block contents.
- Fork detection -- Identify forks by checking whether a height returns multiple hashes on the non-finalized chain.
Notes
- This method is part of the new JSON-RPC v2 specification and may not be available on all node configurations.
- Heights beyond the finalized tip may return multiple hashes due to chain forks.
- On public shared RPC endpoints the archive namespace may be disabled or rate-limited.
Related Methods
archive_v1_header-- Get the header once you have a block hasharchive_v1_body-- Get the block body once you have a block hasharchive_v1_finalizedHeight-- Get the latest finalized heightchain_getBlockHash-- Legacy method to resolve block number to hash