Skip to content
This repository was archived by the owner on Dec 4, 2018. It is now read-only.
This repository was archived by the owner on Dec 4, 2018. It is now read-only.

Error: Invalid params, response status code: 500 #40

@SeanHai

Description

@SeanHai

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions