Skip to content

Conversation

jonasschnelli
Copy link
Contributor

supersedes #5744

I recognized that this approach of extending RPC calls is more flexible and only needs a few lines of changes.

A new wallet could register for a URI (example: /wallet) and response to incoming JSON RPC calls. The signaling overhead should not affect the RPC overall performance.
URI distinction could also help if it comes to process separation of core and wallet.

Working "example" will follow soon.

@jonasschnelli
Copy link
Contributor Author

PS:
bitcoin-cli is untouched for now. As discussed on IRC it could be possible to have something like bitcoin-cli -w getnewaddress (-w stands for --wallet which would send the commands to /wallet). Unclear for now is how it would handle json type conversion (minor issue IMO).

@jgarzik
Copy link
Contributor

jgarzik commented Apr 12, 2015

I thought about this long ago.

JSON-RPC is really built around a single endpoint through which all information is exchanged. It's essentially a messaging tunnel. This PR changes that model, without apparent need.

It did not seem to make sense to add another level like this, when you can easily just add new methods. Convention "mining.$name" or "wallet.$name" can easily suffice, and registered services/plugins may be triggered there.

@jonasschnelli jonasschnelli force-pushed the 2015/04/rpc_signaling branch 2 times, most recently from 4aa0e1e to b3fc520 Compare April 12, 2015 15:33
@jonasschnelli
Copy link
Contributor Author

Recently there was a discussion on IRC about this topic (gmaxwell, sipa, wumpus) http://bitcoinstats.com/irc/bitcoin-dev/logs/2015/04/10#l1428649319
It came out that a new url endpoint makes most sense.

The signaling in this PR hooks in after the JSON Parsing and before the JSONReply. It basically allows bypassing of the raw RPC function and will reuse the whole HTTP/RPC/JSON stack.

@laanwj
Copy link
Member

laanwj commented Apr 15, 2015

@jgarzik Right, that's also direction I assumed we'd go in for namespacing, but @gmaxwell was arguing against that approach on IRC recently and preferred multiple endpoints.

An argument for multiple endpoints is that it makes it easier to transition to separate processes, as client software would support different URIs already.

@sipa
Copy link
Member

sipa commented Apr 15, 2015

Multiple endpoints probably also makes having different authentication easier?

@laanwj
Copy link
Member

laanwj commented Apr 16, 2015

@sipa Yes. If requests are delegated based on base URI, different endpoints can handle authentication differently.

@jonasschnelli jonasschnelli force-pushed the 2015/04/rpc_signaling branch 5 times, most recently from f4ca426 to aeefd63 Compare April 16, 2015 08:28
@jonasschnelli
Copy link
Contributor Author

Slightly updated:

  • reduced to only one signal (ExtCmdExecute)
  • removed signaling while creating help message (not required when having a different entry point uri)
  • additional uri schemas can be added over a static function instead over signaling (while RPC server is not running to avoid locking)

@sipa
Copy link
Member

sipa commented Apr 24, 2015

Hmm, I'd rather see a single mechanism, where registered modules register for a particular URI - whether that is the root or not?

@jonasschnelli
Copy link
Contributor Author

I agree with @sipa. My goal with this PR was to not touch the current wallet implementation. Therefor i only allowed/added the signaling in non root URI spaces, in hope to get more reviews because its behavior is more save and understandable.

If – and i tried and will try again – the current wallet will become a module, we should completely modularize the JSON RPC request/response handling.
But because most PR has lack of review and attention, i decided to leave the current implementation as untouched as possible and add a 2nd wallet where we have the freedom of experimenting.

Decoupling the PRC dispatch table would also be a option but looks after no interest:

There is also a commit who would modularize the whole wallet:

@sipa
Copy link
Member

sipa commented Apr 24, 2015 via email

@jonasschnelli
Copy link
Contributor Author

I know it somehow looks silly to add changes where there is already the plan (sometime already some code!) to change the changes. But in terms of sane change transitions and reviewability this can make sense.

@sipa
Copy link
Member

sipa commented Apr 24, 2015 via email

@jgarzik
Copy link
Contributor

jgarzik commented Apr 24, 2015

Since consensus seems inclined towards integrating plugin/registration at the URI level, concept ACK

@jonasschnelli
Copy link
Contributor Author

Rebased and added proper locking for vExtURI.

@jonasschnelli jonasschnelli force-pushed the 2015/04/rpc_signaling branch from 3e392f3 to f6465cb Compare July 6, 2015 07:11
@jgarzik
Copy link
Contributor

jgarzik commented Sep 15, 2015

ut ACK

@jonasschnelli
Copy link
Contributor Author

With the current libevent httpd this does no longer work and requires a new concept. Closing for now.

@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants