You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
693 B
32 lines
693 B
'use strict';
|
|
|
|
var run = function() {
|
|
// Replace '../bitcore' with 'bitcore' if you use this code elsewhere.
|
|
var bitcore = require('../bitcore');
|
|
var RpcClient = bitcore.RpcClient;
|
|
var hash = '0000000000b6288775bbd326bedf324ca8717a15191da58391535408205aada4';
|
|
|
|
var config = {
|
|
protocol: 'http',
|
|
user: 'user',
|
|
pass: 'pass',
|
|
host: '127.0.0.1',
|
|
port: '18332',
|
|
};
|
|
|
|
var rpc = new RpcClient(config);
|
|
|
|
rpc.getBlock(hash, function(err, ret) {
|
|
if (err) {
|
|
console.error('An error occured fetching block', hash);
|
|
console.error(err);
|
|
return;
|
|
}
|
|
console.log(ret);
|
|
});
|
|
};
|
|
|
|
module.exports.run = run;
|
|
if (require.main === module) {
|
|
run();
|
|
}
|
|
|