Skip to main content

getBlockHash

Retrieves the hash of the latest block.

Queries the connected Aleo node, so it hits the network. Gives a chain-tip identifier as a hash; getBlockNumber gives the tip as a height instead.

Usage​

import { createPublicClient, http } from '@provablehq/veil-core'

const client = createPublicClient({
transport: http('https://edge.provable.com/api/v2', { network: 'mainnet' }),
})

const hash = await client.getBlockHash()
// 'ab1...'

Returns​

string

Hash (ab1...) of the block at the current chain tip.