In their docs, they showed how to get the author of the newest blocks, but I want to get the author of a specific block. How can I do that?
1 Answer
You can pass a blockHash
to api.derive.chain.getHeader()
, like:
// retrieve the last header (hash optional) <---- Here
const blockHash = '0x36d9aabf232d29eae55ccc299c7a5b13522244bffe2ee7220f830041629586e0'
const header = await api.derive.chain.getHeader(blockHash);
console.log(`#${header.number}: ${header.author}`);