graze / guzzle-jsonrpc

JSON-RPC 2.0 client for Guzzle
https://packagist.org/packages/graze/guzzle-jsonrpc
MIT License
93 stars 61 forks source link

Make compatible with bitcoind. #3

Closed ethernomad closed 10 years ago

ethernomad commented 10 years ago

This commit lets graze/guzzle-jsonrpc communicate with bitcoin/bitcoin: https://github.com/bitcoin/bitcoin/issues/3508

Not sure which piece of software is in the wrong.

adlawson commented 10 years ago

This is an implementation of a JSON-RPC 2.0 client. From @gavinandresen's response in bitcoin/bitcoin#3508 and it would seem they use version 1.1 of the spec and these two specifications (and therefore these two libraries) are incompatible.

The response I validate is specified in the latest spec http://www.jsonrpc.org/specification#response_object.

I'm happy for you to fork this library to be compatible with 1.1, but it's not something we're looking at implementing in this library.

Thanks, though, for bringing the incompatibilities to our attention :+1:

ethernomad commented 10 years ago

Ah yes - thanks for pointing that out. There is a proposal for bitcoind to use v2: https://github.com/bitcoin/bitcoin/issues/2960

I think I'll maintain the fork to work with bitcoind until they upgrade.

gavinandresen commented 10 years ago

Is the "jsonrpc" field required? The 2.0 spec seems unclear:

jsonrpc A String specifying the version of the JSON-RPC protocol. MUST be exactly "2.0".

... but does not explicitly state that it is REQUIRED.

adlawson commented 10 years ago

[...] the Server MUST reply with a Response, except for in the case of Notifications. The Response is expressed as a single JSON Object, with the following members:

  • jsonrpc
    A String specifying the version of the JSON-RPC protocol. MUST be exactly "2.0".

(Source: http://www.jsonrpc.org/specification#response_object)

The way I interpreted this was:

Therefore, if the server provides a Response, it is defined with a jsonrpc field with no mention of it being optional. I presume this is to distinguish between v2.0 and any other version, with v1.x being defined without a version in the Response.

I'm inclined to continue including it in the validation. Thanks, though, for the feedback, @gavinandresen!