Skip to content
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

Feature Request: btcd node #302

Open
hsjoberg opened this issue Feb 21, 2020 · 7 comments
Open

Feature Request: btcd node #302

hsjoberg opened this issue Feb 21, 2020 · 7 comments
Labels
enhancement New feature or request up for grabs Anyone can work on this

Comments

@hsjoberg
Copy link
Contributor

I saw that this was included in the TODO, but I would like to open an issue about it so we can discuss and keep track of it.
I would like to be able to use btcd as a backend instead of bitcoind.

As lnd makes use of Neutrino SPV for mobile and embedded devices, it's currently not possible to have a complete test environment using Polar as there's no support for the Neutrino protocol in bitcoind yet.

I could work on this if it hasn't already been started, but I cannot tell when it will be done.

Cheers
Hampus

@hsjoberg hsjoberg added the enhancement New feature or request label Feb 21, 2020
@jamaljsr
Copy link
Owner

Yes, adding support for btcd was an original goal of mine since the beginning. It's been lower priority for me because I felt it important to focus on the features that were specifically requested by users first. It would be great if you wanted to work on this. I have no objections.

I have used btcd for my simnet lightning nodes in the past but have never written an app utilizing its RPC interface, so I do not know if there are any good npm packages available like the one we use for bitcoind. Based on my experience adding c-lightning support, I would assume that this feature will likely require some refactoring of the UI components, redux models, and services. I tried to architect the app to support multiple implementations from the start but I know it's not 100% there today.

Feel free to take a shot at implementing this and let me know if you have any questions. Thanks for your help 👍

@NonsoAmadi10
Copy link
Contributor

Hello @jamaljsr I would like to try my hand on this. But a little question: Other than writing the dockerfile for btcd, Is there a particular file in src folder I can look at because I noticed by default polar checks for the bitcoin core image over the fly

@jamaljsr
Copy link
Owner

Hi @NonsoAmadi10, thanks for offering to give this a go. I think this will require a pretty big update to the codebase, but if you're willing to give it a shot, here's a high level list of things would need to be implemented:

  1. Create a docker image for btcd. Check out the docs to see how I do this for the other implementations now. You should be able to use the bitcoind and lnd Dockerfiles as a reference.
  2. Add a BtcdNode and a BitcoindNode interface which both extend the BitcoinNode interface. You'll likely need to also update a few other dependent interfaces, such as the BasePorts and dockerConfigs. The TS compiler should help find these
  3. Create a BtcdService class that mirrors the BitcoindService in public methods. Of course the implementation would differ. I'm not sure if there's an NPM package to simplify connecting to the node. If not, you may need to add some helper methods. I'd suggest using the REST API over gRPC, otherwise, you'll need to add a IPC proxy because gRPC can only run in the main Electron process. Ex: lndProxyServer & lndProxyClient
  4. Create a BitcoinService interface similar to LightningService which will have implementations for bitcoind and btcd.
  5. Create a BitcoinFactory class similar to LightningFactory which determines which service to use based on the node's implementation
  6. Update the store injections to include the new BitcoinFactory instead of the bitcoindService
  7. Refactor the BitcoindModel store to use the injected BitcoinFactory instead of the bitcoindService
  8. Update the bitcoin components to support BtcdNodes

I think that covers most of what needs to be done. Obviously, the devil is in the details on how to get all of this working. Feel free to ask any more questions.

@penguin4238
Copy link

hey i also looking forward to thie feature

regards

@jamaljsr jamaljsr added the up for grabs Anyone can work on this label Dec 19, 2023
@NonsoAmadi10
Copy link
Contributor

Hi @jamaljsr I am back again lol. I tried my hands on this based on the information but as you know the devil is in the details. I hit a road block:

  1. How do I push the docker image to your docker hub so that I can test locally
  2. I feel I am missing something vital but I don't know what it is yet
  3. I would love to test locally but I need the docker image pushed to the hub

You can see the work I have done so far here. I know you are very busy but I feel this PR is almost ready but I am missing one fine details. Thanks in advance

@jamaljsr
Copy link
Owner

Hey @NonsoAmadi10 thanks for the updates.

You do not need to push to docker hub in order to test. Just build the image and it will be available locally on your machine to use.

docker build --build-arg BTCD_VERSION=<version> -t polarlightning/btcd:<version>  .

@Abdulkbk
Copy link
Contributor

Abdulkbk commented Jul 1, 2024

Hey @jamaljsr, I've decided to take a stab at this.

I noticed that @NonsoAmadi10 has started something, so I'll go through it and pick it up from there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request up for grabs Anyone can work on this
Projects
None yet
Development

No branches or pull requests

5 participants