Bisq Easy Mobile #2665
Replies: 14 comments 29 replies
-
We could also consider an alternative approach: We support to run both clearnet and tor (or i2p), so the relay node could run both clearnet and tor and will be accessed via clearnet from the mobile clients. The mobile client need to run then the Bisq p2p network code but it is not a "full" node as it does not accept incoming connections. This distinction would require some extra work in the p2p network layer to treat those 2 classes of nodes differently (might be its not needed as any connection to such a non-full node would just fail). The benefit from such an approach would be that it perfectly matches the existing p2p network design and multiple relays would share the load of the mobile clients. There is still the leaking of IP addresses, but the other concerns should be disarmed to a large extent (still some issues as a small number of full nodes would represent some centralization). The downside is that it requires to run the network module code (and more), thus require to use bisq2 as dependency to the mobile apps. For Android that should not be a major issue as its JVM based. For iOS we would require Kotlin Multiplatform and then it has to be investigated how much extra effort is required to get all working there. Any OS specific part (like sockets) needs its own implementation for iOS. I still estimate it is not that much of an effort as we don't use much of specialized OS specific stuff, but still an effort to be considered. The core difference from that model to the REST-API based, is that here the tradeoffs are limited to a smaller number of peers (>=1) and leaking the IP address to all those full-node peers. Furthermore anyone could run such a full node and without added restrictions that would add some risks to the users to end up a spy-agency node. As the trade-offs and potentially required extra effort for clearnet are a concern we also could investigate the options of Tor for iOS. It might turn out to be not much more effort. |
Beta Was this translation helpful? Give feedback.
-
One area where we might need changes is the way how we manage data. Atm we use our custom file-based persistence framework. We load at startup all data in memory, which is also for desktop already a bit heavy (I guess 80% of the RAM consumption comes from that data) and this will grow over time with more users. We might need to re-consider to use a DB solution and see how we deal with the issue that we don't want to do queries to the DB all the time as it would be too slow for most use cases. All in all I think efforts in the REST API path would lead in the wrong direction to centralized and trusted services and as no code exist for that yet, it would be considerable effort anyway. Furthermore as it would be an alternative code path not used in the desktop app we add risk for missing updates and changes (Bisq1 is suffering from that as well when new changes are not applied and tested at the API). Going the P2P path we reuse our existing code base, maybe it needs some improvements (DB, network) which benefits the desktop as well. We know that tor support on Android works, so the privacy trade-offs can be avoided in that case or be left to the user (with tor startup and re-connections will be slower). For Apple it seems feasible that we can support with KMP and implementation of the required system interfaces like sockets the clearnet p2p version. For Tor it would be some extra effort which need to be considered if worth the costs/risks (no official Tor impl., Apple might block the app at any time and there is no alternative to the App Store). I would suggest we kickstart a POC where we create an android project adding the main dependencies from Bisq2 (network) and try to get just a network node running on clearnet/localhost as a first milestone. After that we can add the remaining dependencies needed for Bisq Easy use cases. If we achieve that, we can extend it to clearnet - remote node running Tor+clearnet and get the real p2p data via that node. Once that is achieved we can get Tor integrated and get the Tor-remote node model working. Next would be to transform that into a KMP project (could be also done initially if not too complicate) and adding iOS integration. After setup is done for iOS we need to get the native implementations for the missing OS specific interfaces (e.g. sockets,...). Get the network with clearnet/localhost working. Then get the cleanet/remote node working. If we arrived at that stage the POC can be considered successful and we can start implementing a minimal viable version of Bisq Easy for mobile. Further tasks:
|
Beta Was this translation helpful? Give feedback.
-
Look no further, I am already 75% done creating a Bisq app. |
Beta Was this translation helpful? Give feedback.
-
The only reason I downvoted this is because the topic did not start with a problem, if there is no problem what is there to solve? Making a less complex, easier to attack, more manageable to the average developer all sounds like a great bandwagon to ride, and I won’t argue that Bisq 2 looks better and is more intuitive but all that means nothing if the protocol is trash. So my question is what is wrong with the current Bisq, if there is something wrong, why can’t a solution be implemented fix it rather than rebuild entirely. I would expect to at least see someone take an attempt to tackle the infamous trilemma on any new developments. Especially if the community it expected to fund them throughout, sometimes the community are excited about an idea but don’t understand the real technical backing.
It’s feasible, there is not too much data to handle if it’s dealt with appropriately, storing protobuffers (as proto3Json) in an SQLite database indexed only by the important keys will be sufficent, even keeping the file system as is. To address the RAM issues I’m sure that mostly from the wallet syncing as they jump back on again, please let me know if that’s not the case because we were having the same problems on the other side of the playpen.
What metrics do you have to support this as being a problem?
I can give you some feedback on this and it’s not great, but it can work. On iOS you get about 1 APi call every 15 minute max, and no background process can stay open. Additionally, that request is only allowed to last between 15-30 seconds. If we consider that it might take that amount of time to bootstrap to Tor or I2P for that message, then by the time a connection is established we may have enough time to important notifications like new trade offers and chat messages. The alternatively is to implement various ways for the end user to receive notifications, none of this would be centralised, if they wanted to recieve email on a new trade or chat message they’d supply their own SMTP servers as part of their node config, or they could supply a matrix and simplex account to receive the notifications. I will actually update this who are interested in this once I’m confirmed done with the iOS side of things but I’m focusing on the privacy devices / OS currently as requested by the XMR community. Finally, you say you have a PoC, are you willing to share it? |
Beta Was this translation helpful? Give feedback.
-
After further discussions I think it is required to lay out more in details the specifics of different models as well as constraints and goals. GoalsMust have features:Offer a full trade experience in the most minimal formThis includes:
Clearnet connectivityEven if we have Tor support the fact that establishing a Tor connection can take considerable time it will hurt the user experience. It has to been seen if keeping Tor connections open when the app is in background is feasible from a resource management point of view. Mobile notifications for relevant trade eventsThis need to be further investigated but as it is a new feature not present in Desktop yet, it is less relevant to our main objective of the current investigation to see what is the best path to bring Bisq Easy from Desktop to mobile. Good to have features:Tor supportTechnically feasible on Android. But will require adjustments on our tor code and build infrastructure. iOS supportiOS support would be good to have, though we need to consider the costs and risks and if those pay off. Support for other mobile OSWe should check out also the distribution rate for alternative systems. Linux based systems or Huawai's mobile OS might become more relevant in future as the US controlled duopoly might have overextended their power position and more users are looking out for less invasive and totalitarian systems. The geopolitical developments require that the Global South develop more of their independent IT infrastructure. Building up reputationIt would be good that the mobile user can build up reputation using their profile ID. As this use case requires to run Bisq 1 we can assume that those users also have Bisq2 installed. Thus the easiest option would be to add a UI feature to Bisq 2 to use an external profile ID (from the mobile app) in the UI for building reputation. The messaging to the oracle node can be then done inside Bisq 2. On the mobile side we only need to export or copy the profile ID (maybe also the private key if needed for sending the data to the oracle). Not supported featuresAt least for a first version we do not plan to support that Desktop users can reuse their profile on mobile and go back and forth between Desktop and mobile. This would require a synchronization mechanism for the private data as well as a lock mechanism to avoid both models are used in parallel. So far I don't see any feasible solution for that beside a server side hosting of the data directory). ConstraintsWe have to keep in mind our limited dev resources when selecting the most feasible model. In case the mobile app cannot re-use a large part of the existing code base we have to keep in mind that maintenance costs and risks from compatibility issues when developing parallel implementations of core features. ModelsFull node modelThis model requires that we can re-use most of the existing Java code base. It is driven by a full P2P network node with Tor support at least for Android but with adjusted configurations in terms of number of connections and other network specific metrics. Using TorIf the mobile node use Tor the privacy and security model is basically the same as with the Desktop version. The main difference will be the lower number of connections for limiting resource costs. Using clearnet (we call that model now Light node model)For clearnet support we need to have some clearnet enabled nodes (any node can run on multiple transports, e.g. clearnet and tor, but for clearnet it must be reachable from outside, which is usually not the case in home environments without manual setup for port-forwarding, but on VPN servers). This requirement will add a bit of burden to Bisq to provide clearnet enabled headless nodes (technically the same as seed nodes). Those have less privacy protection for the operator than Tor-only nodes. The outbound connection to other clearnet nodes is fully functional, just the inbound connection will not work as the mobile node is not accessible by its IP address. This should not cause any problem. It only requires a custom configuration of the peer management as by default it seeks a balanced level of inbound and outbound connections. If another peer sends a direct message as it is the case in the trade process, the send message attempt will fail, but then the message gets encrypted and distributed as mailbox message and broadcasted to the network. By that it reaches the mobile node via their outbound connections and the message gets decrypted and applied. It is the same model as if the peer is offline (not reachable via direct message). Security and privacy risks when using clearnetA malicious clearnet node could hold back messages to the mobile node, which could lead to failures in the trade process and in the worst case to a ban and loss of investment in reputation in case of a seller. Though, this is unlikely as there are other communication channels where a seller could reach out to support. From my POV the privacy and security risks are rather low and do not require a BSQ bond for node operators. Though Bisq need to provide at least the min. number of nodes for sufficient network resilience (I would estimate at least 4 nodes). PersistenceThe persistence model used in Bisq 2 is likely not appropriate to mobile and we need to build some abstractions around that. I don't expect that this is a major roadblock. Candidates for implementing that modelFrom preliminary research it seems Gluon is the most promising candidate to make that model feasible. Kotlin Multiplatform cannot use dependencies in form of jar files, but would require to port the Bisq 2 code base to Kotlin and to use specific libraries (e.g. for networking and concurrency) to enable compilation to the iOS target. There would be for sure more issues on the path with 3rd party libraries we use as well with crypto libraries. The effort and associated risk with such a huge change is from my POV outside our possibilities. In case we drop iOS support we have more options to go just Android only. In that case a plain Android project might be the most feasible option. Delegated node model (we used before "Light node model" but that is better suited to the full node model with clearnet)In that model we would delegate the networking part to a relay node and use a REST API between the mobile client and the relay node. It still will require to re-implement a considerable part of the code base (crytpography, proof or work, offer domain, trade process, payment methods, persistence). If that model is chosen we cannot just reuse Bisq 2 code for those areas as those will have further dependencies, but rather we need to re-implement a minimal version of all the required features. This is considerable effort and lead to a parallel code base with future costs for maintenance and compatibility risks. Relay nodeA relay node would be a headless Bisq node with a REST API exposed via clearnet and Tor. Security and privacy concernsThe public data can be accessed without privacy issues beside that the relay node learns about the mobile node's IP address in case of clearnet. Similar as in the full node model, I do not see severe security risks and the privacy risk can be lowered by using Tor. Candidates for implementing that modelKMP might be a good candidate here, as it makes it easier to copy Java code from Bisq 2, convert it to Kotlin and reduce it to the minimal needed as a strategy to re-implement a big part of the code base. As that code base does not contain the P2P network part one hurdle is removed, but still a lot remain and I would assume we only learn by doing it how much effort it really will be. I estimate its considerable effort. For sure there is high risk of uncertainty of the overall effort. Thin client modelThat model consists of a full node with a server offering a REST API (headless or Desktop) and the mobile client as thin UI client. Candidates for implementing that modelThe mobile client can be implemented in any technology. KMP might be a good candidate here as well. There is no requirement to re-use or re-implement Bisq 2 code. Use casesThat model could to be used in a "friends and family" context for on-boarding newbies. An experienced Bisq user provides that full node/server and the newbie connects to that, fully trusting that provided node (as its for friends and family that should not be a concern). The other model would be that users run their own private server and use it for themself, thus rendering the privacy and security issues obsolete (beside the secure connection to the API). QuestionsThe main question here is the usefulness and size of potential market (in case of friends and family use case). So this option seems to me mostly a "nice to have" add-on, without much potential to extend to new markets or users. I would also assume users would be disappointed that Bisq Easy has not brought the full trade experience without the need to run a full node to mobile. ConclusionMy personal conclusion is that the Full node model offers the most benefits with least costs. It is as close we can get to have the same user experience, level of privacy, security and decentralization as the Desktop version. It enables us to reach to new users and markets where Desktop computers are not much used. The main hurdle here is, if there is a feasible technical solution possible. Our first hope for KMP failed unfortunately and it has to be seen if the remaining candidates which allow reuse of java based source code in mobile environment can hold their promise. The Light node model, is for me a bad compromise on all levels and to introduce a parallel implementation is for me basically a no-go. The Thin client model is technically the easiest and most feasible but does not provide the mobile experience one would expect (you dont want to run your Whatsapp Desktop client when using it on mobile). I consider the added value and options to reach new users and markets as rather limited and to me it is questionable if the costs justify the gains in that model. |
Beta Was this translation helpful? Give feedback.
-
@HenrikJannsen thanks for summarizing the options discussed so deeply, bringing also the knowledge from Bisq infrastructure in. I'm still digesting this big post, for now I'm just gonna drop some small contribs:
|
Beta Was this translation helpful? Give feedback.
-
hi @cbeams, thanks for your feedback and videos. Here my response: Multiple aspectsI think we are dealing with multiple aspect and best to tackle them separately.
APIThe benefit and need for an API is undisputed. The only question is the priority and when it really is needed. So far we had not sufficient use cases for it beside the existing API for oracle node and monitoring. Full node model@Rodave got some results with CodenameOne but it would require Java 11 (now we use Java 22), which is probably a prohibitive requirement. To limit the full node model to Android is a very feasible option. It requires Java 17 which was until recently the target version for Bisq 2. To revert the Java 22 feature changes is not that much work (I assume a couple of hours). There will be for sure some more issues (persistence for instance) but I think those are all feasible to resolve and I do not see any real critical showstopper so far. Note, that this model allows the user to use tor or clearnet. The clearnet option requires that Bisq (or the user) runs a headless node with clearnet + tor enabled. This should be a minor dev effort and also an acceptable cost for providing that infrastructure. Details need to be worked out but my estimation is that this does not cause any showstopper. Thin client modelAs it seems that for iOS the full node model is unfeasible, the only 2 options are to either drop iOS or to use the thin client model. The Thin client model can be then also added as optional mode for Android, giving the user more flexibility. Onboarding friends and familyI would consider that as a new product based on Bisq Easy and the mobile Thin client model as well as some additional features (relay/proxy node, hierarchical user management, xPub key support,...). Bisq Easy was itself an experiment and for some features like the Learn section the market-fit test is still pending. Mobile UIFor sharing code we could use KMM. I am not familiar enough to estimate the extra effort/complexity to enable KMM UI for a pure Android project as well as on the iOS side. I suspect that make things and build process at least more complex. Potential next stepsI think first we should figure out if we want to continue to investigate the feasibility of the cross platform options. Maybe @rodvar could give his conclusion from what he learned so far. In case we drop that effort, I think next thing is to verify the assumption that a pure Android project is feasible for re-using Bisq 2 code base in a time-boxed POC trial. Once (and if) that is confirmed, we can look into the best solution for the UI code (KMM or native or other). For the Thin client model the precondition is the API. So we should start to find a dev/team who are committed to that task. Once the API is sufficiently implemented for some mobile use cases one of the mobile devs could take on the integration. Once the Thin client model is in place we can move towards the Onboarding friends and family product. Of course we can do stuff in parallel as far we can afford it. |
Beta Was this translation helpful? Give feedback.
-
My 2 satoshis in all of this: TL/DR;
Some other notes worth mentioningIt is not correct that Marketshare for iOS its 50/50 with Android. That was the case many years ago but in recent years the Android has eaten the apple in 70%+. However, its worth mentioning that in developed countries it's still 50/50 or slightly inclined towards Apple. (more data on this) Once again I would like to back @cbeams in terms of his overall idea and big picture of why, for whom and what are we building. His videos are full of a lot of spot on phrases too long to write down. At the same time, I would like to back @HenrikJannsen in the sense that compromising the security & privacy of Bisq is a no-go by all means So it all beg the question, can we build a secure API/infra that allows us to just focus on thin shared code mobile solution which is obviously the most cost-efficient/effective solution in terms of time and money? If the answer is yes which looks like it is from recent convs that it is, then I would just focus on:
And leave the full node Android project out of the "Bisq Easy Mobile" discussion if that makes sense? And then see if we can do both in parallel or if we need to choose, then I would definitely solve "Bisq Easy Mobile" first in words of @cbeams (hope I remember properly from the video) Cheers! |
Beta Was this translation helpful? Give feedback.
-
It is a bit frustrating to me how quickly the model which mirrors best the essence of Bisq gets dropped. Bisq never went the easy or proven/industry way. And managed to invent new solutions and overcome challenges. I don't think that the mobile app is as challenging as many other things we achieved like the DAO,... I suggest we make a survey to learn more about our users and contributors preferences. And just to make clear, those 2 models are not exclusive but a matter of priorities and cost/benefit ratio. I totally support that we do both. But I totally disagree to drop the full node model before we have even tried. I think I have explained sufficiently about technical backgrounds and laid out my arguments. I leave if from here and log off from that discussion and focus on other areas or if I find time give myself a shot for the Android full node model. |
Beta Was this translation helpful? Give feedback.
-
I just tried out to get Bisq 2 common code base (copy/paste src code, not as jars yet) complied in Android Studio. Was not hard. There have been few classes which use not supported APIs and 2 where we used features not supported in Java 17. I also got all gradle dependencies and protobuf compilation running. Of course nothing tested for functionality but just wanted to see how difficult it is to get stuff compiled. Sure lot more stuff to do (e.g. proto lite,...), but I am confident I can get up to the network module in the next days. For the not supported classes we can move those to a new module in Bisq 2 which will not be used.
|
Beta Was this translation helpful? Give feedback.
-
Hi everyone, new here!! Well I read some bits of the convo above, and I could agree on using KMP either with composeUI or combine swiftUI + ComposeUI accordingly. I don't have much clue on running full node so wouldn't know about it. If everything has been decided, could we make issues? |
Beta Was this translation helpful? Give feedback.
-
hey @nis-ship-it thanks for joining the conversation! That's great to hear, we can't wait to start full-on dev on this. Issues will start to be created at some point this week along with completing a bit more on the README docs aiming to help people joining the project as much as possible to contribute valuable work, so stay tuned! The Issue creation (or Work Breakdown) will be useful to have a rough estimation of how much time is needed to get to a beta stage for the 3 apps, we want to make sure to run this through the DAO voting so that the most staked in people in Bisq validate the general idea. What can you do at this stage? Please check the project README, download the bisqapps KMP code and follow the get started guide and let us know of any issues that you 'll find (along with the details of the hardware you are using). Stay tuned! 💪 |
Beta Was this translation helpful? Give feedback.
-
Update for the work on the full node model: Completed:
Next steps:
Open discussion:
|
Beta Was this translation helpful? Give feedback.
-
Potential future protocol supportThe scope for Bisq Mobile is currently limited to Bisq Easy. As we saw in recent discussions this was not obvious to others and the question about support for potential future trade protocols should be discussed here more in details. To make clear why Bisq Easy is "easy" to support on mobile there are the 2 main factors:
Those factors are not present with other protocols. As details about other protocols beside MuSig are less clear at that stage, lets focus on MuSig only. Though it can be expected that other protocols like Bisq Lightning come with even more challenging requirements. MuSig (conceptually similar to Bisq 1 multiSig)The trade protocol requires integration of a wallet, and due requirements for MuSig a custom wallet implementation which will likely be done in Rust. For the blockchain date retrieval it can be that we use a Java based implementation and it might even utilize our P2P network. Full node mode on AndroidFor a standalone mobile app those requirements come with severe challenges.
From my POV the cost/benefit ratio is not justified to implement that. Thin client modeHere we have to separate between the self-hosted model and the "Uncle Jim" model. Thin client mode connected to self-hosted full nodeIn that model the mobile app is a pure remote control to the full node. Thus the Bitcoin wallet is part of the full node and the requirements for the mobile app are just UI and API calls, thus not representing any technical or conceptual challenge. The only challenge is on the UX side, as the MuSig protocol is much more complex and comes with extra required features like arbitration and payment account management. But I consider those as solvable challenges. Thus I consider for that model it would be feasible to support other future protocols. Thin client mode connected to full node hosted by a trusted party ("Uncle Jim")In that model it is assumed that the wallet is on the mobile app side for limiting security risks and liability to the full node provider. As the thin client model is intended for both Android and iOS the integration effort for the wallet would be required for both the Android and iOS environment, which pose a significant effort and challenge. From my POV bases on assumptions for the wallet tech stack I consider that a prohibitive cost for the gained results. Reconsider the mobile deployment optionsSo far we had in mind that one mobile app will come on Android with the option to run as full node or as thin client. For iOS only as thin client. The thin client mode connected to full node hosted by a trusted party ("Uncle Jim") requires 2 extra features:
The thin client mode connected to self-hosted full node does not need those features. Considering the different scopes we could see the mobile apps as 3 different apps in fact:
This does not mean that we should deploy 3 apps, but to be aware that those are kind of 3 different apps and we might model it in the app, so the user can switch between those 3 flavors. |
Beta Was this translation helpful? Give feedback.
-
Ideas about options for a Bisq 2 mobile app has been discussed in #298 while Bisq 2 was still in development.
This new discussion should focus now on the concrete and more limited scope of providing a minimal version of Bisq Easy as mobile application for both Android and iOS and discuss it more in details.
Feature scope for phase 1
Feature scope for phase 2
Relay node
Network interface
Public data
BisqEasyOfferbookMessage
)UserProfile
)AuthorizedMarketPriceData
): Alternatively we could ping the price nodes, but it would open an additional privacy leak if clearnet is used, thus delegating it to the relay node seems the better approach.AuthorizedProofOfBurnData
,AuthorizedBondedReputationData
,AuthorizedAccountAgeData
,AuthorizedSignedWitnessData
): As this data has comes with some complexity how the resulting reputation score is calculated we delegate that probably to the relay which provides aggregated reputation score data.Private data
If the mobile user use clearnet, private messages are delivered as follows:
A private message sent from the mobile client to a desktop user is sent as
ConfidentialMessage
to the relay. ThereceiverKeyId
is the relevant pointer to the receiver. This is an ID only known to the receiver. The relay sends it to the gossip network as mailbox message not as direct message to the receiver. The relay acts as publisher of that data. The receiver will get the mailbox message if they are online from the gossip network, decrypts and processes it.A private message sent from a desktop user to the mobile client is sent to the mobile users onion address (even if the mobile user use clearnet). As the mobile user is not using Tor it fails (fast) and the message gets send as mailbox message via the gossip network. The relay node receives that and forwards it to all their mobile clients. The mobile client checks if the mailbox messages has their key ID and if so decrypt and process the message. At some point the mobile client sends the remove message to the relay so that the mailbox message gets removed. We need to add some random delay here to avoid privacy issues.
Privacy implications
If the Tor mode is used, I think the privacy implications for the mobile user are very limited. For http requests to the relay the relay node does not learn about the mobile users onion address. The hidden service connection can be used only for data sent from the relay to the mobile client.
If clearnet is used and the mobile user is not using their own releay node, the relay node learns about the IP address of the user.
Pubic data are sent to all users the same way, thus there is nothing extra the user reveals. For received private messages it is the same ,as mailbox messages are just public data everyone gets delivered.
Only when sending a private message, the relay learns about the communication between the mobile user and some unknown Bisq Easy user with a certain
receiverKeyId
. ThereceiverKeyId
is not publicly know and associated to any onion address or user profile. But from repeated messages the replay can learn that a trade happens (obvious anyway as that is the use case). With observing differentreceiverKeyIds
the number of trades can be derived. The mobile user could distort that by publishing fake messages with non existing ids, but that would harm the network as mailbox messages without real receiver would stay until the TTL is triggered in the network and need to be loaded by any node.We could though add a new model to create new IDs after each message (or a pool when communication starts), thus each message will have a new ID and only the 2 parties know how about it. We have to be careful though that a missing message would not fatally interrupt the chain and making further communication impossible. But I guess there are ways how to achieve that with sufficient resilience. With such a solution the issue that the relay can learn about the number of trade is mitigated.
Another issue is the removal of a received mailbox message of the mobile user. The relay node would learn that a certain mailbox message (which contains the
receiverKeyId
was successfully decrypted by the mobile user and therefor knows theirreceiverKeyId
. To avoid that the mobile user can randomly delay the remove message so that this correlation is broken.Those mitigations will not provide the same privacy protection as the Tor mode, but beside that the relay learns about the IP address the privacy implications are rather small.
Security
The mobile user need to trust to some extent the relay node.
A malicious relay node could:
Conclusion
I think Bisq Easy can be implemented as a mobile version even with the clearnet option with a privacy/security to convenience trade-off acceptable for many users. For the more privacy focused users there is the option to run their own relay node (less convenient) or if they are Android users to use the Tor mode. If that is not enough or possible its best to stick with the desktop version.
Beta Was this translation helpful? Give feedback.
All reactions