sample CLi to get a block using the RPC interfase + Bitcore

This commit is contained in:
Matias Alejo Garcia 2014-01-06 17:19:14 -03:00
parent 5a6979a911
commit 6f0a6d8b06
3 changed files with 31 additions and 3 deletions

View File

@ -7,4 +7,4 @@ mystery
There is a bitcoind configuration sample at:
```
etc/mystery/bitcoin.conf
```:
```

View File

@ -1,11 +1,12 @@
rpcuser=mystery
rpcpassword=real_mystery
server=1
rpcallowip=127.0.0.1
rpcport=8332
testnet=1
testnet=3
txindex=1
# Allow connections outsite localhost?
# rpcallowip=192.168.0.*

27
util/get_block.js Executable file
View File

@ -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);
});