jb55 / node-bitcoin

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

replaced local json-rpc with node-jsonrpc2 #8

Closed mcandre closed 12 years ago

mcandre commented 12 years ago

jsonrpc2 is now available on NPM; the local version used by node-bitcoin has some weird errors (undefined:1), so I substituted a more stable json-rpc library.

jb55 commented 12 years ago

I'm all for switching to a more stable library, but it seems the library changes the behavior of the callbacks. For instance, when there is a bitcoin-related error it puts it in the data part of the callback. Whereas the current library put both json-rpc and bitcoin related errors in the error callback (which is a bit more intuitive to me).

Also I haven't been able to replicate the undefined:1 error. What version of the bitcoin client are you using?

mcandre commented 12 years ago

Latest (1.1.3).

Cheers,

Andrew Pennebaker www.yellosoft.us

On Thu, Feb 2, 2012 at 3:53 PM, Bill Casarin < reply@reply.github.com

wrote:

I'm all for switching to a more stable library, but it seems the library changes the behavior of the callbacks. For instance, where there is a bitcoin-related error it puts it in the data part of the callback. Whereas the current library put both json-rpc and bitcoin related errors in the error callback (which is a bit more intuitive to me).

Also I haven't been able to replicate the undefined:1 error. What version of the bitcoin client are you using?


Reply to this email directly or view it on GitHub: https://github.com/jb55/node-bitcoin/pull/8#issuecomment-3786215

freewil commented 12 years ago

the undefined:1 error is almost certainly caused by invalid rpc username/password being sent to the bitcoin client. In this case the bitcoin client will return HTML looking something like this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<HTML>
<HEAD>
<TITLE>Error</TITLE>
<META HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=ISO-8859-1'>
</HEAD>
<BODY><H1>401 Unauthorized.</H1></BODY>
</HTML>

I would like to see us replace the jsonrpc server, but I'm not sure if this quick fix will be backward-compatible.