const RpcAgent = require('bcrpc'); agent = new RpcAgent({port: 18332, user: 'StandUp', pass: '6305f1b2dbb3bc5a16cd0 f4aac7e1eba'}); agent.getBlockCount(function (err, blockCount) { if (err) throw Error(JSON.stringify(err)); console.log(blockCount.result); agent.getBlockHash(blockCount.result, function (err, hash) { if (err) throw Error(JSON.stringify(err)); console.log(hash.result); }); });