2

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 1

3

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}`);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.