decred / dcrdex

The Decred Decentralized Exchange (DEX), powered by atomic-swaps.
Other
188 stars 100 forks source link

Client Development - Fall 2023 #2483

Open buck54321 opened 1 year ago

buck54321 commented 1 year ago

As we move into the future of client development, this working draft of a task list can be used for coordination.

Please comment below to help me add or remove items, clarify direction, improve language, etc.

I expect we will have sufficient discretionary funding to expand the first section below. What can I add?

Targets for funding in current proposal

There are a number of initiatives that could be funded under the current client dev proposal.

Features and new assets

UI Development


🌕 Moon shots / Proposals needed

🌟 Asset features


🌟 Browser extension

I've prototyped a browser extension that connects to an instance of dexc. Why though?


🌟 Lightning network integration

Bitcoin and Decred. Start with some basic channel management. Add features like Bison Relay and Taproot Assets. One target is a Bison Relay-backed trollbox on DEX markets.


🌟 Monero wallet

I think we should figure out how to do a Monero wallet, but not for trading at first. The community loves Monero, and implementing a wallet will prepare us for adding a Monero trading protocol to DEX. I'm open to allocating substantial efforts towards wallet development to make a native light wallet work.


🌟 Point-of-sale system

This could be an entirely new front end to our current client stack. It could also be a view in our existing app, but a dedicated front end has advantages in terms of marketability, as it can be packaged into a dedicated, single-purpose app.


🌟 Offloading client management

How can we facilitate offloading of time-sensitive and resource-intensive processes? Can we unburden the user of responsibility for 1) blockchain syncing, 2) trade settlement, 3) lightning channel policing, etc. I think we can. I see future development along these tracks as progressing through series of larger and larger target markets, each with solutions that have unique security and privacy tradeoffs. These are all variations of what I'll call below the remote dexc server.

  1. The hacker. Our initial target is tech-savvy. This mode is just administration of a dexc instance on a remote server. In this operating mode, the user opts for built-in SPV wallets, as these wallets minimize sync times, networking, and storage requirements. You can already do this, of course. You just gotta get a static IP and some bandwidth. Maybe add a little nginx for TLS.

    • How can we make it easier for users to configure a remote dexc server?
    • How can we make it cheaper for the user to operate in this mode?
    • How can we secure communications?
  2. The collective. Really, our full-node RPC wallets are our best wallets, assuming we have access to a synced trusted full node. If we have to run the full node ourselves, it's probably not worth the costs. But if we can share the duties of server/node administration among a group, then at some group size the economics of it start to make sense. For hosting of remote dexc clients you could have an efficient system in which a large number of clients can run with relatively low resource utilization. The collective model requires a fair amount of meat-space coordination. Members have to secure server space and access to full nodes. While the administrative work load is, ideally, distributed among all members, in reality, most work will be done by a few. So, especially for larger groups, the incentives are not well-aligned. This likely limits this mode of operation to small groups of dedicated members.

    • How can we ease configuration for new, technically-unsavvy members?
    • How can we make it easier and cheaper to connect the dexc server to full nodes? (e.g. can we securely tunnel to members' private nodes?)
    • How can we improve system resiliency?
  3. The service. We build off of the collective model by introducing paid administration. In this model, access to the remote dexc server is paywalled, but there is an increased expectation of uptime and customer service.

    • How do we return just wallet responsibilities to the client? The simple approach of a remote dexc instance means that all wallet keys are generated and stored on the server. That doesn't work at this scale, so we'll need clients to be able to handle private key operations. It's not as simple as the dexc server offering access to full nodes. The user's dexc instance (or equivalent) still needs to run on the server to accomplish the goal of offloading. There's a needle to thread here to optimize privacy. Something like "remote signing", with a solution for the need for server-led trade settlement without a connected client.
    • How can we best protect user privacy, even against the server operator?
    • Can we do this with a purely crypto-based payment model? Can this be powered by lightning micro-transactions?

🌟 Ticket splitting and DEX mesh role expansion?

Could DEX somehow facilitate P2P ticket splitting? If we have a healthy DEX network, it seems like a great place to coordinate between participants. What other services could the DEX network facilitate. Lightning watchtowers? Mixing? Can the DEX mesh provide auxiliary services while maintaining a limited role in administration of said services? Can DEX's reputation tracking system be used more widely?


🌟 Mobile wallet?

Some questions persist. @itswisdomagain thinks we can do it.

My personal view is that even SPV wallets are gonna be finnicky and at-times resource intensive for mobile. I think a better overall solution would come from the Offloading Client Management roadmap above, in which case the mobile app could be basically a targeted browser window. Webview or whatever.

JoeGruffins commented 1 year ago

On mobile, I feel like maybe a lightweight client makes the most sense. The user needs to be ready to sign swap transactions when it's time, so hard to imagine a service having much to do? Unless you let the service sign for you... but that would be going against what we are trying to make imo. Unless there is a way to make a tx that says this amount can only be traded in this way and pre sign it. Probably doable with an eth contract but can't imagine how to with utxo. Then client also needs to be partially aware of what's going on in order to refund if the service went offline.

On offloading, the first option is already doable! I am doing that within my home network and it works well. Refining that process, even if it's just writing a readme would not be much work. Hard to imagine what The collective would look like. As I said above, how much does The service really add? If we are only talking about trading, the key holder has to be ready and aware anyway. I guess if there are a lot of extra things added? Maybe a light version with only trading basics and a loaded version should be buildable if the goal of a service is mobile trading?

Monero, lets do it. Cake Wallet has a lightweight version that works on mobile even. The build process is involved but I think it gives us something working to emulate/copy.

On current proposal, anything you want me to focus on? Staking is to the UI part that I think you are hammering out. If no suggestions nothing really jumps out at me but I'll pick something and ask if that's alright to work on.

buck54321 commented 1 year ago

What I'd call "delegated transaction signing" would definitely be a challenge, and may be impossible without a trusted party, but all other scenarios are just your own instance of dexc running on a remote server, so you would still be signing your own transactions. It would just allow you the freedom to shut down your client app whenever you wanted without risking penalty or having your order revoked.

There are a couple of UX roadblocks I'm looking to solve.

1) We're basically telling the user "once you place an order, your ability to shut down or move the machine on which you just placed the order is now substantially reduced." In terms of mobile, we'd essentially be telling people that once they place an order, they shouldn't move around too much. That's almost certainly a deal-breaker for a lot of people. 2) Sync times. It may not be a big deal to us, but it's a big wrench in the gears at a time when we're trying to make a good first impression with our app.

I think either of these alone might be debilitating for adoption in the face of other options. I can download Exodus wallet and use it virtually right away. I can create an account on Coinbase, go through all of their KYC/AML process, and be trading in like 15 minutes; faster than syncing our SPV wallets. When I look at those options, I see immense risks to privacy and security, but many or most others probably just see a smoother experience.

Maybe a light version with only trading basics and a loaded version should be buildable if the goal of a service is mobile trading?

Hmm. What would be the difference?

On current proposal, anything you want me to focus on? Staking is to the UI part that I think you are hammering out. If no suggestions nothing really jumps out at me but I'll pick something and ask if that's alright to work on.

Feel free to suggest goals that you find important. Aside from what's listed, you can always update docs and review code. Reach out on Element if you're not sure.

JoeGruffins commented 1 year ago

Hmm. What would be the difference?

Just light wallets and trading, and just a library I suppose. In my mind you need to place an order, they shouldn't move around too much as you said, so everything should be done there in the phone. But if "delegated transaction signing" is an option... The dex allows people to control their coins completely. BUT if some users wanted to forgo security to trade, that does give all the "responsible" users more ppl to trade with. And maybe the new users migrate to local wallets after trying less secure trading.

norwnd commented 1 year ago

Just personal opinion, integrating new tokens/blockchains (along with simple UI to browse those) would make the most impact in terms of DEX adoption. In particular Solana seems to be primed for winning "peoples chain" race, and interestingly there are decent chances it's decentralized enough (compared to what most people who did not spend much time analysing/comparing think of it).

ukane-philemon commented 1 year ago

While that's good because it keeps maintenance and design costs low, it's bad because it look like crap. Let's upgrade.

We can always come up with a sleeker UI for the settings page but it proly won't blend with the other pages, I think.

xaur commented 1 year ago

Please comment below to help me add or remove items, clarify direction, improve language, etc.

This is a bit boring compared to features mentioned above but I'd invest in release management and onboarding flows.

1. Make the release process documented (at least privately) and strict to not miss any steps, so that when we announce the release on Twitter/Telegram/etc. all docs, links, and packages would be up-to-date. Moving all docs in the main repo was a great step to avoid "the dcrdocs mistake" (no clear ownership => stuff is always outdated). But there is more work to do, e.g. v0.6.3 was in half-baked state for several weeks and we weren't sure if it's ready for ANN.

Now most of the steps are done but AUR packages, asset list in website footer, and now Decrediton v1.8.0 links are still outdated. Going forward the app will commit to more OS Packages (which would be great for adoption!) and we will have more stuff to forget about. Release routine is not fun but chaos tends to spread if not addressed. If it helps I can submit a release checklist template based on the steps above.

2. Streamline and simplify onboarding flows.

Choices and navigation are hard for newcomers. Eliminate unnecessary choices and guide through remaining choices. Pay attention to what newcomers complain about, record it, and fix any issues. Imagine where non-devs and non-sysadmins would get stuck (or better, hire them to test UX and report the pains).

Example areas to improve:

3. Reproducible builds.

Explore if it's possible to piggyback on existing build infra in the release tool and achieve reproducible builds for DCRDEX.

buck54321 commented 1 year ago

@xaur I'd really like to deputize you for coordinating releases. Up for the job?