Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var startBlock = 13078996;
- function check() {
- var http = new XMLHttpRequest();
- var url = 'https://bsc-dataseed.binance.org/';
- var params = '{"jsonrpc":"2.0","id":256,"method":"eth_blockNumber","params":[]}y';
- http.open('POST', url, true);
- //Send the proper header information along with the request
- http.setRequestHeader('Content-type', 'application/json');
- http.onreadystatechange = function() {//Call a function when the state changes.
- if(http.readyState == 4 && http.status == 200) {
- var result = JSON.parse(http.responseText);
- console.log(startBlock - parseInt(result.result, 16));
- }
- }
- http.send(params);
- }
- setInterval(function(){ check(); }, 300);
Add Comment
Please, Sign In to add comment