Posts

Showing posts with the label How can I check the hash of a bitcoin block?

How can I check the hash of a bitcoin block?

How can I check the hash of a bitcoin block? Let's pick an example bitcoin block: #499583 This is the block: http://ift.tt/2yK7Pzg It starts with 00000020164a1e4a7f34b96b0e201d.... I'm trying to hash it so that the hash is 000000000000000000677c4077da7c9f01dde5f332ba2fbff962ee699714d5da again. This is my Javascript-Code: var Bitcoin = require('bitcoinjs-lib'); var request = require('request'); var crypto = require('crypto'); function getRawBlock(blockHash) { return new Promise((resolve, reject) => { request('http://ift.tt/2AX6FGK' + blockHash, // hitting an insight API to get the full block (error, response, body) => { try { var block = JSON.parse(body); // result is in JSON resolve(block.rawblock) } catch (error) { reject(error) } }) }) } getRawBlock('000000000000000000677c4077da7c9f01dde5f332ba2fbff962ee699714d5da') .then((rawBlock) => { var ...