mirror of
https://github.com/ChristopherA/Learning-Bitcoin-from-the-Command-Line.git
synced 2025-06-08 08:26:17 +00:00
Create 17_3_getinfo.js
This commit is contained in:
parent
698a061c6c
commit
bfefdcdc54
15
src/17_3_getinfo.js
Normal file
15
src/17_3_getinfo.js
Normal 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);
|
||||||
|
})
|
||||||
|
|
||||||
|
});
|
Loading…
x
Reference in New Issue
Block a user