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

Route bitcoinj over jtoryproxy #534

Closed

Conversation

dan-da
Copy link
Contributor

@dan-da dan-da commented Jul 21, 2016

This pull request is in response to #488. At this point, the code is generally working as intended but needs review by others.

Summary of Changes

  • Routes bitcoinj traffic over internal Tor proxy (or not) based on user pref.
  • Defers walletService init until internal tor is started, but only when useTor pref is on.
  • Changes SafeSocks setting in torrc from 1 to 0 to allow bare IPs over Tor.
  • Enables remote DNS lookup when using socks5 proxy, eg Tor.
  • parses and makes use of --btcSeedNodes arg.
  • code is in place but commented out for user to specify other socks5 proxy, eg i2p, ssh, vpn. it just needs GUI or CLI prefs added. See MainViewModel.

Testing

I have run the code with the following permutations:

  • Tor Disabled, no seedpeers.
  • Tor Enabled, no seedpeers.
  • Tor Enabled, using seedpeers.
  • Tor Disabled using seedpeers.

In all cases, the wallet service was able to get connected and function seemingly normally.

I have NOT yet been able to verify that bitcoinj is not somehow leaking connections outside Tor, via DNS or otherwise. If anyone knows a good tool for logging all outbound connections made by a process during its lifetime on linux, please let me know. wireshark and tcpdump are possibilities, but tcpdump is snapshot oriented and wireshark doesn't know anything about PID.

Suggestions for verification methodology appreciated. We should make sure it is not leaking before making a release.

Notes

  • The code has been written in such a way that bitcoinj only sees a Socks5 proxy. There is nothing Tor specific about it. This means that we can (and I think should) add a mechanism for user to specify socks5 host/port. This way, the wallet could be used over i2p, ssh, vpn, etc if desired.
  • I still get various types of connection errors when going over Tor, but still connections get made.
  • I still see occasional "Connection not allowed by ruleset" messages and always when this happens the IP is in ipV6 format, so apparently DNS is handing these back also. research required.
  • I don't always get the green icon indicating that the wallet is ready at startup. This may just be a timing issue, due to walletService init being deferred. I'm not sure.
  • I've tried to comment the code to highlight issues or areas for improvement.
  • At present, we are only using the hostname seeds from bitcoinj NetworkParameters. I considered making use of the IP seeds also, but decided that is outside the scope of this issue.

Future Improvement

  • .onion addresses do not work, eg as seedNodes. The PeerAddress class in bitcoinj throws null pointer exception if fed an unresolved hostname. It might be as simple as fixing that, or might require significant changes in bitcoinj.
  • bitcoinj does not include .onion seeds in the parameters for each network, so those classes would need to be added to support it.

Bounty

@ManfredKarrer At such time as you think this code is worthy of the bounty, you can make payment to the address I've sent you privately. Here's my public key fingerprint to prove I am the same person.

5C0E F833 79CB 892F 3FC9 1519 744D D69B 94E9 CC1A

@dan-da
Copy link
Contributor Author

dan-da commented Jul 21, 2016

oops, I made this against master instead of Development. closing and will make a new one.

@dan-da dan-da closed this Jul 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants