Created
February 7, 2019 18:11
-
-
Save JPaulMora/34a5e11b9c20885019656c926ed38e66 to your computer and use it in GitHub Desktop.
Small node.js snippet to query current monero difficulty from local daemon.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const axios = require('axios'); | |
let header = ''; | |
for (let block = 1685551; block < 1685704; block++) { | |
axios.post('http://127.0.0.1:18081/json_rpc', '{"jsonrpc":"2.0","id":"0","method":"get_block_header_by_height","params":{"height":' + parseInt(block) + '}}').then(resp => { | |
header = resp.data.result.block_header | |
console.log(header.height + ', ' + header.timestamp + ', ' + header.difficulty) | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment