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

Using Sparrow with Tor daemon #83

Closed
kn0wmad opened this issue Mar 28, 2021 · 29 comments
Closed

Using Sparrow with Tor daemon #83

kn0wmad opened this issue Mar 28, 2021 · 29 comments
Labels
enhancement New feature or request medium Medium priority

Comments

@kn0wmad
Copy link

kn0wmad commented Mar 28, 2021

Love the built-in tor support, but this does not play nicely when running the tor daemon for other applications as Sparrow wants port 9050, which is occupied. Would it be possible to offer to use the existing connection instead of Sparrow's built-in option?

@craigraw
Copy link
Collaborator

Yes - just configure the proxy settings: proxy on, host localhost, port 9050. Sparrow will prefer this if it is configured.

@MattDHill
Copy link

There are no proxy settings inside the Core RPC tab. Will inputting them inside the Public Server tab or Private Electrum tab do the trick? Perhaps proxy setting could be abstracted from the various backend options?

@kn0wmad
Copy link
Author

kn0wmad commented Mar 29, 2021

I ought to have mentioned I'm pointing this at a Bitcoin Core node that is not local to the Sparrow machine.

@craigraw
Copy link
Collaborator

craigraw commented Apr 1, 2021

Unfortunately the bwt project which Sparrow uses internally to connect to Bitcoin Core is waiting on proxy support on one of it's dependencies, the rust-bitcoincore-rpc project. Essentially, that project needs to update to a newer version of it's jsonrpc library for Tor proxy support to be possible. You can see the open PR for this here: rust-bitcoin/rust-bitcoincore-rpc#154

This is a good place to track this, so cc'ing @shesek (who is aware of the above)

@kn0wmad
Copy link
Author

kn0wmad commented Apr 19, 2021

May I ask why Sparrow is using BWT to connect to Bitcoin Core? Would it be possible to connect directly via RPC as Specter and FullyNoded do, for example?

@craigraw
Copy link
Collaborator

Sparrow uses the Electrum server protocol to remain independent from the Bitcoin Core wallet. Using the Bitcoin Core RPC directly would effectively mean recreating BWT in some way in order to maintain this independence. If Bitcoin Core ever decided to build an address-based index this would not be an issue - unfortunately this seems very unlikely.

@ProofOfKeags
Copy link

ProofOfKeags commented May 18, 2021

OK so as I understand it, this functionality is delegated to BWT itself, which is packaged as a binary inside of Sparrow? I think I can get the PR above or equivalent functionality into the sparrow stack, I just need to know what the dependency chain is. Swappable transports were implemented in rust's jsonrpc library since 0.12.0. I was just able to create a PR here to get the new transport machinery into the actual bitcoincore rpc library. But it sounds like from up thread that there remains the issue of after this gets merged we need to update BWT to use an optional tor transport. Correct?

@craigraw
Copy link
Collaborator

OK so as I understand it, this functionality is delegated to BWT itself, which is packaged as a binary inside of Sparrow?

Yes correct. Updating BWT shouldn't be an issue, but @shesek would be able to comment better on this.

@6102bitcoin 6102bitcoin added the enhancement New feature or request label May 20, 2021
@6102bitcoin
Copy link
Collaborator

Outstanding Action: Discuss with @shesek the possibility of an "optional tor transport" in bwt
Proposed Priority: Low

@ProofOfKeags
Copy link

I would prefer that it wasn't low priority and am willing to give dev resources to actually writing the code to do so. However, the code is going to be contingent upon getting this merged first.

@craigraw
Copy link
Collaborator

I regard this as Medium Priority (although I'm not recommending this approach - I don't think opening Bitcoin Core RPC over Tor is a great idea for privacy reasons). However I certainly see the need for this, and I know @shesek is keen to implement it in BWT once the necessary support has been added to rust-bitcoincorerpc.

@ProofOfKeags
Copy link

ProofOfKeags commented May 21, 2021 via email

@craigraw
Copy link
Collaborator

The issue is that most places the .onion address and RPC auth will be stored are not password protected - config files etc. Learning the RPC .onion address means you can easily extract all the watched addresses and their balances. Worse, you can do this remotely, which makes it even easier than scanning the Bitcoin Core wallet files themselves.

That said, some many not consider this an attack vector they are concerned about - it's one wouldn't be happy with though.

@ProofOfKeags
Copy link

ProofOfKeags commented May 21, 2021 via email

@craigraw
Copy link
Collaborator

RPC over not-Tor is generally limited to local network attacks, which is not true for RPC over Tor. RPC credentials are usually not encrypted on disk in config files etc.

The standing advice has been to not expose RPC beyond localhost: https://bitcoin.stackexchange.com/questions/69080/rpc-json-outside-localhost

@ProofOfKeags
Copy link

ProofOfKeags commented May 21, 2021 via email

@craigraw
Copy link
Collaborator

Ok this isn’t anything to do with Tor but is an indictment of any kind of remote node.

Electrum servers don't carry this risk, since they index the entire blockchain, and you can't learn anything about a particular wallet by connecting to them.

I really like sparrow and the only barrier to using it is being able to input a remote node.

Thanks - and as I said before I'm keen to support this functionality. Just wanted to point out the risks. Let's make it happen.

@ProofOfKeags
Copy link

ProofOfKeags commented May 21, 2021 via email

@6102bitcoin 6102bitcoin added the medium Medium priority label May 23, 2021
@nyxnor
Copy link
Contributor

nyxnor commented Sep 14, 2021

I express my interest on this feature, but it works with electrum already, so if possible to mention RPC on the title.
I agree with #83 (comment)

@craigraw
Copy link
Collaborator

@ProofOfKeags any progress on this front?

@kn0wmad
Copy link
Author

kn0wmad commented Sep 27, 2021

@ProofOfKeags any progress on this front?

I believe this is stuck in the dependencies still. We are approaching a release that allows archival nodes and will advise our users to go that route to use Sparrow when complete. Until the dependencies get caught up pruned nodes will be unable to use Sparrow unfortunately

@craigraw
Copy link
Collaborator

Until the dependencies get caught up pruned nodes will be unable to use Sparrow unfortunately

Thanks, but I'm a little confused - is use of RPC over Tor in rust-bitcoincorerpc connected to node pruning in some way?

@ProofOfKeags
Copy link

rust-bitcoin/rust-bitcoincore-rpc#180 has been merged.

The library was released at 0.14.0 5 days ago which includes the changes for swappable transports. So this should allow for sending over a sock5 tor connection to the core instance in question.

is use of RPC over Tor in rust-bitcoincorerpc connected to node pruning in some way?

Not at all. They are separate concerns. Though both of them affect our current users. But this issue is strictly about remote node access over tor.

@shesek
Copy link

shesek commented Sep 27, 2021

rust-bitcoin/rust-bitcoincore-rpc#180 has been merged.

Sweet! 🎉 Will be looking into adding SOCKS proxy support to BWT, probably in the coming days.

@6102bitcoin
Copy link
Collaborator

Should this issue be closed?

@craigraw
Copy link
Collaborator

Indeed it should. Thanks for the upstream work.

@kn0wmad
Copy link
Author

kn0wmad commented Nov 23, 2021

rust-bitcoin/rust-bitcoincore-rpc#180 has been merged.

Sweet! tada Will be looking into adding SOCKS proxy support to BWT, probably in the coming days.

Sorry to necrobump, was this support added to BWT?

@shesek
Copy link

shesek commented Nov 23, 2021

Sorry to necrobump, was this support added to BWT?

Yes, SOCKS5 proxy support was added to bwt (bwt-dev/bwt#21, bwt-dev/bwt@97f9edf)

And to Sparrow in v1.51: https://github.com/sparrowwallet/sparrow/releases/tag/1.5.1

@kn0wmad
Copy link
Author

kn0wmad commented Nov 23, 2021

Cheers, take care

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

No branches or pull requests

7 participants