You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 4, 2018. It is now read-only.
when I use the node-bitcoin to access the running bitcoin-core node, I get this error. I use a loop to request 100 or more blocks through the JSON-RPC api.
The bitcoind.conf is: server=1 daemon=1 rpcthreads=10 txindex=1 rpcuser=bitcoin rpcpassword=bitcoin rpctimeout=3600
The main code is :
`var bitcoin = require('bitcoin');
var client = new bitcoin.Client({
host: 'localhost',
port: 8332,
user: 'bitcoin',
pass: 'bitcoin'
});
var fs = require("fs");
fs.readFile('block_num', function (err, data) {
if (err) {
return console.error(err);
}
var i = Number(data)
var k = i+100
for (i ; i < k; i++){
client.getBlockHash(i, function(err, hash, resHeaders) {
if (err) return console.log(err);
client.getBlock(hash, (2), function(err, block){
if (err) return console.log(err);
fs.appendFile('blocks/blk'), JSON.stringify(block,null,2)+"\n", function(err) {
if (err) {
return console.error(err)
}
})
})
})
}
fs.writeFile('block_num', i , function (err) {
if (err) {
return console.error(err);
}
})
}); The error is:{ Error: Invalid params, response status code: 500
at IncomingMessage. (/home/sean/Downloads/node-bitcoin/node_modules/bitcoin/lib/jsonrpc.js:110:17)
at IncomingMessage.emit (events.js:187:15)
at endReadableNT (_stream_readable.js:1094:12)
at process._tickCallback (internal/process/next_tick.js:63:19) code: -32602 }
`
How can I fix it? thanks.
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
when I use the node-bitcoin to access the running bitcoin-core node, I get this error. I use a loop to request 100 or more blocks through the JSON-RPC api.
The bitcoind.conf is:
server=1 daemon=1 rpcthreads=10 txindex=1 rpcuser=bitcoin rpcpassword=bitcoin rpctimeout=3600
The main code is :
`var bitcoin = require('bitcoin');
var client = new bitcoin.Client({
host: 'localhost',
port: 8332,
user: 'bitcoin',
pass: 'bitcoin'
});
var fs = require("fs");
fs.readFile('block_num', function (err, data) {
if (err) {
return console.error(err);
}
var i = Number(data)
var k = i+100
for (i ; i < k; i++){
client.getBlockHash(i, function(err, hash, resHeaders) {
if (err) return console.log(err);
});
The error is:
{ Error: Invalid params, response status code: 500at IncomingMessage. (/home/sean/Downloads/node-bitcoin/node_modules/bitcoin/lib/jsonrpc.js:110:17)
at IncomingMessage.emit (events.js:187:15)
at endReadableNT (_stream_readable.js:1094:12)
at process._tickCallback (internal/process/next_tick.js:63:19) code: -32602 }
`
How can I fix it? thanks.
The text was updated successfully, but these errors were encountered: