[bisq-network/proposals] Use a GRPC API as core API and use wrappers around for other API types (#136)

Chris Beams notifications at github.com
Mon Nov 11 19:09:58 UTC 2019


## How to run the code for this proposal

Here's a quick primer on how to sync up to these changes and exercise the fledgling gRPC API for yourself (@chimp1984, I'm not sure if this was written down elsewhere; I couldn't find it if so).

### At the command line
```
cd $YOUR_LOCAL_BISQ_CLONE
git remote add chimp1984  # this shortcut syntax assumes you have `hub` installed
git fetch chimp1984
git checkout grpc
./gradlew build
./bisq-desktop --appName=Bisq-grpc-demo --desktopWithGrpcApi=true
idea .  # open the project in IDEA
```

### In IDEA
 - Open `BisqGrpcClient` and run its `main` method
 - Type `getVersion` into the console, notice that `1.2.3` is returned
 - Type `getBalance` into the console, notice that `0.00` is returned
 - See the `switch` statement in `BisqGrpcClient` for all supported commands


## Proposal feedback
I think the proposal makes sense. Having a 'core' RPC API on top of which any further API (RESTful HTTP, JSON-RPC, etc) can be layered seems workable, and is actually what I originally suggested way back in this [March 2018 slide deck](https://docs.google.com/presentation/d/1296AcVUqaPgjbtUMpLBDAwoYxjmOPEtSLLPJhCwtE9Y/edit#slide=id.g34bd40372f_2_2).

I don't have much to say about the implementation as I haven't spent enough time looking at and thinking about it. From a UX perspective, though, I'd like to see the following:

1. a `--daemon` option to the main (bisq-desktop) binary that allows it to run headlessly with the core (gRPC) API enabled. So passing `--daemon` would imply passing `--desktopWithGrpcApi=true` and would suppress the UI. This is consistent with running the Bitcoin Core desktop client with `--daemon` enabled in order to run it in the background without launching the UI at all.

2. Ideally, we would ship a `bisqd` shell script that implies `--daemon` as well (just as Bitcoin Core ships with a `bitcoind` binary), but it's not strictly necessary for getting started.

3. The `--desktopWithGrpcAPI` option should be renamed to `--server` or `--rpcserver`. This is consistent with the way you can run the Bitcoin Core desktop client with `--server` in order to enable its JSON-RPC server while also launching the UI.

With the `--daemon` and `--server` options in place, any external gRPC client can be written to exercise the API and as suggested in https://github.com/bisq-network/events/issues/32#issuecomment-532153973, I'd like to see us ship a `bisq-cli` utility for convenient access to the API and to serve as a reference client how to program against it. It could start out by talking gRPC directly, and if we grow a JSON-RPC API down the road, it could perhaps be ported to that, as I think it's what many people writing, say, a trading bot would want to use and have a reference for.

> There is still the question open if we should have 2 desktop modules (one without API and one with API embedded) to don't add those dependencies to all Bisq users even if the API is not enabled.

Agreed, NACK on having 2 desktop clients. The proposed core API would be just that: quite core to the project. It would be terrible UX to have to ship and explain two clients, and I see no significant threat in adding these minimal dependencies into the mix.

Thanks for putting this together, @chimp1984!

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/bisq-network/proposals/issues/136#issuecomment-552573467
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20191111/f877c711/attachment.html>


More information about the bisq-github mailing list