Finding block's proposer with new API V2

Just for the sake of completeness if somebody comes to this thread, here is the way to get the proposer with the JS SDK:

const algosdk = require("algosdk");

const c = new algosdk.Algodv2("", "https://testnet.algoexplorerapi.io", "");

(async () => {
  const blk = await c.block(13819291).do();
  const proposer = algosdk.encodeAddress(blk["cert"]["prop"]["oprop"]);
  console.log(proposer);
})();

Other SDKs work similarly, the client methods are: GetBlock for Java, block_raw for Python, BlockRaw for Go.

3 Likes