Create 17_3_getinfo.js

This commit is contained in:
Shannon Appelcline 2020-09-02 14:01:43 -10:00 committed by GitHub
parent 698a061c6c
commit bfefdcdc54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

15
src/17_3_getinfo.js Normal file
View File

@ -0,0 +1,15 @@
const RpcAgent = require('bcrpc');
agent = new RpcAgent({port: 18332, user: 'StandUp', pass: '6305f1b2dbb3bc5a16cd0f4aac7e1eba'});
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);
})
});