sample CLi to get a block using the RPC interfase + Bitcore
This commit is contained in:
parent
5a6979a911
commit
6f0a6d8b06
|
@ -7,4 +7,4 @@ mystery
|
||||||
There is a bitcoind configuration sample at:
|
There is a bitcoind configuration sample at:
|
||||||
```
|
```
|
||||||
etc/mystery/bitcoin.conf
|
etc/mystery/bitcoin.conf
|
||||||
```:
|
```
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
rpcuser=mystery
|
rpcuser=mystery
|
||||||
rpcpassword=real_mystery
|
rpcpassword=real_mystery
|
||||||
server=1
|
server=1
|
||||||
rpcallowip=127.0.0.1
|
|
||||||
rpcport=8332
|
rpcport=8332
|
||||||
testnet=1
|
testnet=3
|
||||||
txindex=1
|
txindex=1
|
||||||
|
|
||||||
|
# Allow connections outsite localhost?
|
||||||
|
# rpcallowip=192.168.0.*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var RpcClient = require('../node_modules/bitcore/RpcClient').class();
|
||||||
|
|
||||||
|
|
||||||
|
var block_hash = process.argv[2] || '0000000000b6288775bbd326bedf324ca8717a15191da58391535408205aada4';
|
||||||
|
|
||||||
|
var rpc = new RpcClient({
|
||||||
|
user: 'mystery',
|
||||||
|
pass: 'real_mystery',
|
||||||
|
protocol: 'http',
|
||||||
|
});
|
||||||
|
|
||||||
|
var block = rpc.getBlock(block_hash, function(err, block) {
|
||||||
|
|
||||||
|
console.log("Err:");
|
||||||
|
console.log(err);
|
||||||
|
|
||||||
|
|
||||||
|
console.log("Block info:");
|
||||||
|
console.log(block);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue