New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integrate HTTP API to bisq-network #22
Comments
One other thing to consider are integration tests. Once we remove main class from api those tests might get problematic. |
My plan is to have the API-only mode pure headless. So that should be ok for the integration tests, right? |
But as far as I understood you want to have Main class in |
I added a demo project [1] for a gRPC example with 2 simple requests and a dummy placeholder for a Bisq daemon (access to core). UPDATE: |
I started to add 2 projects to Bisq [1,2] and added basic setup for a BisqDaemon [3] and a new DesktopMain [4] class which supports 2 new option keys: desktopWithHttpApi and desktopWithGrpcApi. I think it is cleaner to use a separate main class [5] for the HTTP-API-only (headless) case, so current plan is to not support the API-only version in the same main class which supports the combination Desktop + API. It is all WIP, but wanted to share early the direction.... [1] https://github.com/ManfredKarrer/bisq-grpc/tree/api-integration |
I have yet to fully catch up on this proposal. Over the last weeks, I've written up and had a number of conversations with @blabno and @mrosseel about doing a proper proposal for getting the HTTP API integrated, and I want to reference some of those discussions quickly here:
I have other priorities I'm focused on right now, and @ManfredKarrer I'm glad to see that you're diving in here to get stuff done, but I want to state frankly that I'm worried about this work. We've had a hard time aligning on what should be done and how it should be done, and I don't want to see a lot of further implementation work on the integration itself until we can get high-level agreement about what users are going to experience and what the minimum set of requirements for getting the HTTP API out of incubation and into production are. That's why I've been pushing for a proposal, but the proposal as written above jumps pretty quickly into low-level implementation details. What I think everyone needs to get crystal clear on is:
I'm concerned that the proposal as written above focuses mostly on (2) and (4) above, and doesn't address (1) and (3). And really, I don't think that (4) needs to be spelled out in too much detail in a proposal. Those are code changes, and that's what pull requests are for. What's important is that we get aligned on the high-level stuff, the UX stuff, the the security and code review stuff, and the overall quality control stuff here. Actually doing the code changes to integrate should be relatively trivial after that, so please let's back up and deal with first things first. Somebody needs to take the time to write up a proper proposal that deals with all this stuff, so that we don't keep going around in circles about it. As I wrote in https://docs.bisq.network/proposals.html:
This is why I asked @blabno and @mrosseel to take the time to write this proposal early in the process. In the meantime, there has been a lot of work done based on my initial comments about what should probably go into that proposal, e.g. truncating the bisq-api repository history, repackaging stuff to In our most recent conversation about this, @blabno made it clear that he would in fact write such a proposal, but it's not clear to me, @ManfredKarrer, whether your proposal here was something you basically did on your own, without awareness of that conversation that @blabno, or if this proposal was in fact intended to be the same, all-inclusive proposal that I've been pushing for all along. @ManfredKarrer, you wrote above:
I am not concerned about there being too many modes / combinations. I believe that for the first step toward integration, there should be an option in bisq-desktop to enable the HTTP API service, and that's it. No headless mode/option yet. Take things one step at a time. We know it will require further refactoring to get to a place where bisq-core can be run standalone with the HTTP API enabled and no ties whatsoever to bisq-desktop. Until that is possible, bisq-desktop should not try to "fake" any headless mode. When it is possible, people will literally be able to run bisq-core from the command line like a proper unix daemon, and they'll also be able to run bisq-desktop in 'headless server mode', but doing so will just be a very lightweight and convenient shortcut to running bisq-core headlessly in the way I just described above. @ManfredKarrer, are you familiar with the getting started guide that @blabno has been writing at bisq-network/bisq-docs#54? Here is the latest deployment preview of it: https://deploy-preview-54--bisq-docs.netlify.com/http-api-monitor-offers.html. Notice how the doc currently tells the user to build mrosseel/bisq-api from source and to start everything up via For reasons I mentioned above, there doesn't need to be any other option for running headlessly, etc at this point. The question is what is the simplest possible initial integration that we can do that makes it possible for the interact programmatically with their Bisq node via the new HTTP API. We also need to align, of course, on the exact implementation details of the integration: whether bisq-http-api is a separate repository, or whether it gets integrated into bisq-core; what the package naming should look like; whether we should consider anything at all with gRPC yet; and so forth. All of these details should be fleshed out in this proposal, and IMO preferably before we do much more coding / implementation work on anything. We can save so much time and effort by writing this stuff down and aligning on it first. |
@cbeams: Regarding proposal: I started on that work and proposal as I felt that @blabno was stuck in getting the current code base connected with the recent code base and how to integrate the startup process in a way that the headless API version, the Desktop+ API and the Desktop-only version can work. I agree to all your points and my intention was not to write that kind of proposal but only to deliver a refactoring of the startup process (MainViewModel mostly) so that they are not blocked anymore to work on top of the current Bisq master. When starting coding I got a bit further and added support for a simple dummy gRPC server/client and a BisqDaemon (headless full features Bisq - not implemented much there though). My plan was actually to make a small simple user case with gRPC like getting the real Bisq balance via gRPC calls and if that model works well the same should be possible for the HTTP-API stuff. Regarding how to start the HTTP-API: Regarding headless versions: The other areas where they have atm duplicated code from the UI ViewModels to avoid the dependency to JavaFX I would not touch but it would be for me one "exit criteria of incubation" to get rid of that duplicated code and have properly refactored all those areas to core classes. That should be mostly rather trivial technical refactoring, expect the create and take offer parts which might be a bit more complex. But I think all in all it is no terrible much effort and I estimate that can be done in about 1 week. Regarding the option key: Regarding integration: Regarding design: The HTTP-API could either use BisqDaemon directly or startup gRPC and use that to access Bisq. I assume using BisqDaemon directly is a preferred approach but both are possible. But the setup for the gRPC is not really much and would be a valid alternative. But the main work will be to define all protobuffer data and as long that is not implemented in gRPC it would be not feasible. The Desktop creates the BisqDaemon and in case the HTTP-API is enabled via options it passes it to the HTTP-API as well as to the JavaFX Application so both operate on the same process and instance of BisqDaemon. If BisqDaemon also provides a high level API for all the typically required access methods (I would orient on the current HTTP-API feature set like in BisqProxy) is an open question. I think I prefer to use the existing APIs in the domains (e.g. OpenOfferManager,...) as otherwise there is a huge class which flattens all domains into one place. It would be a Facade to make access to the more complex and distributed APIs in the specific domains easier but I am not sure if that is needed and if it would just introduce more maintenance costs, etc.... But I have not a 100% clear/strong opinion regarding that so far. Regarding:
Conclusion: My plan was not to integrate that in Bisq as long the code base is not fully reviewed, accepted and meet our acceptance requirements. My suggested solution would be that I continue to deliver a base structure where they can start to integrate it with the current Bisq master in my repository. They can fork from my repo and do the required work to make the HTPTP-API work in that design. That way we can bring the API work in sync with master and get rid of that block regarding the startup process and the hacks how to start Bisq with the API in combined and headless mode. |
I close that proposal as it is implemented in the |
Hello, does Bisq have an HTTP API? |
To integrate the Bisq HTTP-API work from @mrosseel and @blabno I suggest following proposal.
Adjust the BisqAppMain and BisqExecutable so that it can configure the correct startup for 3 different modes:
The HTTP-API comes with it's own option keys which will be supported as well. The details how that will be done is not decided yet.
A big part of startup code is currently in MainViewModel and that has to be refactored to the core project.
The HTTP-API specific code would be added in a new project (bisq-http-api). There it might have initially still duplicated code which got extracted from ViewModel classes. That should be cleaned up over time by refactored code where code which is used now both from the UI and the API will be refactored to classes inside core, so we get rid of those code duplication.
An open question is we should already prepare also support for a grpc API model. I suggest to not do that now but once it is implemented.
One concern of @blabno is that we get too many different combinations of possible combinations how to run the app. I don't see that as an issue at least at the current state of basically possible 3 options. The grpc API would add another option but I doubt that all possible combinations makes sense. So from a first thought on it I assume there will be added 2 new options: grpc-only and grpc+Desktop. I don't see a use case to run both grpc + HTTP-API together. It might be well the case that the HTTP-API will wrap the grpc inside.
@cbeams, @mrosseel, @blabno: What is your opinion about that proposal?
The text was updated successfully, but these errors were encountered: