LtbLightning / bdk-flutter

Bitcoin Development Kit - Flutter Package
MIT License
63 stars 28 forks source link

bdk-flutter in pure dart #11

Closed aniketambore closed 1 year ago

aniketambore commented 2 years ago

Hello,

I've a question out of curiosity as I can see the core methods is actually written in rust and binded with dart using flutter_rust_bridge.

My question is, what's stopping us from developing the complete bdk-flutter package using pure dart?

MrUnfunny commented 2 years ago

Hey @aniketambore, Wouldn't this mean rewriting entire bdk logic in flutter? Given that we don't have any reliable core Bitcoin package in flutter, it's going to be even more challenging.

aniketambore commented 2 years ago

It will be more challenging though, but I think most of the algorithms for implementing bdk logic in pure dart are already created and available in pub.

So it would be a good support and reference guide for writing entire bdk-flutter in pure dart (correct me if I'm wrong).

MrUnfunny commented 2 years ago

I'm currently just learning about bitcoin and don't have much experience but I don't think there is any reliable bitcoin core package on pub. The closest that I could find is bitcoin_flutter but it is very outdated. There is another updated fork of the same package, coinslib but I had some issues with this too. So, IMO we'll first need a core bitcoin package in dart.

aniketambore commented 2 years ago

What I mean by algorithms is not already implemented bitcoin packages, but the core cryptographic or bips which is implemented in pure dart such as secp256k1, ECDSA, Big & Little Endian, DER Signature, Base58, Bech32, ripemd160, etc...

Also I think we cannot call bitcoin_flutter outdated because it really has most of the concepts in place, but there are actually lots of version solving failed error because of its unsound null safety (maybe). But the library itself is great reference guide.

BitcoinZavior commented 2 years ago

Rewriting bdk in Dart or writing a package similar to bdk in Dart will be a huge task, the key objective of using BDK in bdk-flutter is to leverage the effort already spent in building BDK and also to take advantage of the robust nature of BDK as it's been tested numerous times.

bdk-flutter utilises rust bdk as its core library similar to how node js modules utilise c and c++ code as the core. It's a very common architecture for creating reusable modules and packages.

aniketambore commented 2 years ago

Okay, that sounds great to me. Thank you for your work on this!

MrUnfunny commented 2 years ago

Hey @BitcoinZavior, Is there any specific reason why you wrote rust code by yourself instead of using bdk-ffi like bdk-swift and bdk-kotlin? Was it to change API to match your needs or is there some problem with integrating bdk-ffi?

i5hi commented 1 year ago

@MrUnfunny bdk-swift and bdk-kotlin will not give you c-bindings that are easily compatible with flutter.

As of today, this library is much closer to the actual bdk api and it will be getting closer moving forward.

BitcoinZavior commented 1 year ago

Thanks @i5hi