This is available in the certificate of the block that you can get by querying the block as msgpack (?format=msgpack
).
In JS:
const algosdk = require("algosdk");
const base32 = require("hi-base32");
const c = new algosdk.Algodv2("", "https://testnet.algoexplorerapi.io", "");
(async () => {
const blk = await c.block(13819291).do();
const blk_hash = base32.encode(blk["cert"]["prop"]["dig"]);
console.log(blk_hash);
})();
Other SDKs work similarly, the client methods are: GetBlock
for Java, block_raw
for Python, BlockRaw
for Go.