cloudhead / nakamoto

Privacy-preserving Bitcoin light-client implementation in Rust
MIT License
365 stars 61 forks source link

Mobile integration #87

Open thunderbiscuit opened 1 year ago

thunderbiscuit commented 1 year ago

Hi there!

I'm starting to look at ways we could integrate a BIP157/158 client into Android applications (or just mobile in general), and wondered if you have any resources/docs on that somewhere. Has anyone tried it in a sample app, or do you know how you'd like to go about it? I see an open issue about an FFI layer (#14), but wondering if know of any other information you could point me to.

I'm one of the maintainers for bdk-ffi and bdk-android, and I maintain a sample Android app that showcases how to use the Bitcoin Development Kit (the Devkit Wallet). The wallet currently uses Electrum for its chain data, but I'd love to enable Neutrino-like client capabilities.

Related to this is the fact that the BDK library is looking at enabling using Neutrino clients for its blockchain data, and I'd like to help test/implement that using Nakamoto on Android.

Cheers!

cloudhead commented 1 year ago

Hey! I don't have any experience with that currently, but am asking around since a few people are working on mobile wallets on top of nakamoto.

I'm curious what are the obvious limitations you see right now, or where there might be friction?

thunderbiscuit commented 1 year ago

Not sure yet! I need to start playing around with Nakamoto on my desktop to understand better how it works. But let me ping @rajarshimaitra and @notmandatory who I know are working on implementing compact block filters in BDK through Nakamoto.

cloudhead commented 1 year ago

Great, also perhaps @johncantrell97 may want to chime in.

notmandatory commented 1 year ago

@rajarshimaitra is working on a PR for bdk once that's ready we can use it to do some testing via bdk-ffi on mobile, since it will be using the bdk Blockchain trait it should integrate with the bdk Wallet like our existing blockchain clients.

notmandatory commented 1 year ago

I'm curious what are the obvious limitations you see right now, or where there might be friction?

The only potential problem I see right now is that nakamoto is using the Sled db and we've seen incomplete data flushing issues with Sled and BDK on Android (we switched to using sqlite on andorid/swift). I expect we'll want to also add sqlite support for nakamoto. But we can see how it goes with initial testing.

EDIT: I doubled checked and looks like nakamoto is using plain files for block data so we might not need to change anything. We might find some benefit from using a sqlite db to store block data but we can see how testing goes.

thunderbiscuit commented 1 year ago

Just want to link to this PR for those who might come across this issue: bitcoindevkit/bdk-ffi#207