-
Notifications
You must be signed in to change notification settings - Fork 125
albyhub: add module #794
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
base: master
Are you sure you want to change the base?
albyhub: add module #794
Conversation
My testing todo list (WIP)
One thing I skipped was generating a secret for JWT_SECRET, because I don't quite understand when it would ever be necessary and don't use it myself. |
Thanks! Alby Hub is a great fit for nix-bitcoin. |
Long-term: absolutely yes! I'd say most of the time I should be able to turn around updates or maintenance fixes within a few days. This summer I was inundated with work, side projects, and other commitments which is why the PR has sat as a draft for a few weeks. I actually still use hub as my daily driver for nostr zaps, so I’ve been actively keeping the package up to date over the past couple of months. Getting everything working initially took some effort, but now that it’s stable the ongoing maintenance hasn’t been too heavy. While I do occasionally get pulled into other projects, I’m confident I can continue fitting the maintenance work into my routine. This summer was crazy though. If it’s helpful, I’ve got some notes on updating the package that I’d be happy to share somewhere. There's still some rough spots, like I think the fuzziest part is having to pick an ldk-node commit based on commit date. It turned into an unexpected rabbit hole at first, but once I finally got the package working, I realized I’m pretty much adopting it for the long haul! |
… client (which Hub uses) apparently doesn’t understand the socks5h scheme in HTTP_PROXY/HTTPS_PROXY, so even if I set env vars like `HTTPS_PROXY=socks5://127.0.0.1:9050` this is going to want to leak DNS. I'll have to do some testing to confirm this and then try to think of a workaround. All the other packages in nb seem to have native support for tor. I might need to open an issue upstream.
…fmt. Kindof a messy commit that I should have peice-mealed out better.
… user sets a password, which ends up overwriting whatever we generate.
Thank you for putting this together! |
tl;dr a lot of testing finally yielded (possibly) a little progress here. and I need to do a lot of testing and cleanup hub's go http client honors HTTP(S)PROXY and supports SOCKS5 proxies configured through env vars. go-nostr's HTTP/WebSocket stack honors HTTP(S)PROXY but does not support SOCKS5 proxies I haven't run any tests for ldk-node yet, but it has client libs lightning-net-tokio which supports socks but not http proxies, and reqwest which is an http client. There's also bdk_esplora in ldk-node, but esplora-client should be talking to localhost only anyway. socks5 env vars like
torsocks does not work for hub's go http client:
Then I tried to get creative. Since go-nostr doesn't support socks5, tried using an http proxy. I used privoxy, even though tor now also has a using env vars to utilize both tor socks5 + privoxy http proxy (ie.
Regarding ldk-node, Lightning P2P via lightning-net-tokio does not honor ALL_PROXY/HTTP(S)PROXY and won’t be torified by those env vars alone. so I think both go-nostr and ldk-node either need torsocks, or socks support configured/added directly to their tcp client library. ldk-node uses several dependencies with uneven support for proxy configuration:
I also tried ugly hacks like using both env vars and torsocks, which can result in double proxying. go-nostr was still broken in that configuration. ldk-node might work if all proxy vars are configured to use tor socks5, or we use torsocks. But torsocks won't work with Go's http client (in hub), so that leaves us with the best option of using socks5 env vars and leaving go-nostr in a broken state. I think the next move is to submit a PR to go-nostr to add socks5 support. Oh wait, maybe part of the issue is that you can't do websocket connections over an http tunnel. I tried another workaround where I bridge the websocket connections to get them to talk over socks5 using this syntax:
That's go-nostr -> websocat -> tor. The big downside being that there's no TLS between hub and websocat, but that's inside the local environment at least. I stopped seeing those errors, so maybe it works. I'll continue testing as time permits. quick thoughts on some cleanup I should probably do: I don't think anything cares about all_proxy, so I'll probably remove that. I should probably cleanup the service.albyhub.after properties is probably overkill and should be removed too. the getPublicAddressCmd option is probably pointless in nix-bitcoin too. i should probably dump privoxy and use tor's HTTPTunnelPort option. then I should use that for the boltz api calls instead of websocat. Apologies for the commit spam, I only realized this morning that I can just test my changes without pushing them somewhere by using |
the websocket bridge workaround adds more complexity (and maintenance overhead) than I like and breaks the UX of NWC setup, since the user gets a localhost relay address rather than the configured relay uri. the right move here is to get PRs merged upstream to add socks5 support for websockets to the GO HTTP client libs for go-nostr. |
type = with types; nullOr str; | ||
default = | ||
if config.services.mempool.enable then | ||
"http://${nbLib.addressWithPort config.services.mempool.address config.services.mempool.port}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is missing the /api path.
"http://${nbLib.addressWithPort config.services.mempool.address config.services.mempool.port}" | |
"http://${nbLib.addressWithPort config.services.mempool.address config.services.mempool.port}/api" |
Thanks for working on this!
I created this issue on go-nostr: nbd-wtf/go-nostr#191 |
Project description
This app was previously nostr-wallet-connect which implemented protocols (nip-47 and lud16, among others) for controlling an lnd lightning wallet over the distributed network protocol called nostr. The Alby "hub" expands the scope of the project to include support for more lightning wallet backends in addition to lnd: pheonixd and an internal ldk node.
While Alby started out providing custodial lightning software, they have since developed more self-custodial software such as this.
In full transparency, I've observed some rough edges in the build process, some of which have been smoothed out by deploying this as a nix package. Many other rough edges were smoothed out by updates over the last six months, so I have a lot more confidence in this project as of late.
Metadata