jb55 / node-bitcoin

zero-dependency bitcoin core rpc lib for nodejs
The Unlicense
45 stars 127 forks source link

getWork doesn't return anything #1

Closed neopunisher closed 13 years ago

neopunisher commented 13 years ago

Im not totally sure what im suposed to be passing it but it keeps returning nothing... i just started with bitcoin so it may be my bitcoind... it connects fine and other apis work... im not sure whats up

jb55 commented 13 years ago

It seems json-rpc wasn't showing what errors were occuring, after pulling the latest version, is this what you get when you run the test suite?

cd test && vows api.js ···············✗·

getWork ✗ should not be empty » An unexpected error was caught: Bitcoin is downloading blocks...

✗ Errored » 16 honored ∙ 1 errored (26.438s)

neopunisher commented 13 years ago

i used the api to pull how many blocks it had downloaded and it wasnt up to date... im going to close the issue and ill let you know if i find something wrong... thanks for your help

jb55 commented 13 years ago

No problem, thanks for inadvertently finding a bug :)

neopunisher commented 13 years ago

ok so here is my test.js file

var bitcoin = require('./node-bitcoin'), util = require('util'); var client = new bitcoin.Client('localhost', 8332, 'ccole', 'pass');

client.getBalance(function(err, balance) { if (err) return console.log(err); console.log("Balance:", balance); });

client.getBlockCount(function(err,res){ console.log('blockcount:'+res); }); client.getWork(function(err,res){ console.log('get info'); if (err) return console.log(err); console.log(util.inspect(res)); });

and this is what im getting back

[root@devbox2 bitcoin]# node test.js Balance: 0 blockcount:143259 get info { code: -32601, message: 'Method not found' }

any ideas? all the blocks are downloaded... I started bitcoin with "bitcoind -server -daemon" im on a centos box so im using some rpm because building from source doesnt seem to work... do i need to be hashing to getwork? (use -gen flag)

jb55 commented 13 years ago

That's pretty strange, bitcoind should have the getwork command unless it's an ancient version.

Try this command: strings which bitcoind | grep getwork

Does it return anything?