Skip to content
This repository was archived by the owner on May 13, 2022. It is now read-only.

Conversation

@chris-belcher
Copy link
Collaborator

@chris-belcher chris-belcher commented Nov 19, 2016

Use tx_broadcast = tor in joinmarket.cfg to connect to a random bitcoin node on the network, to broadcast a transaction and then disconnect. The DNS seeds are used to find these nodes.

Right now on the bitcoin network, there are an unknown number of sybil nodes which aggressively announce themselves in an effort to attract more people to connect to them. Then they spy on every newly-broadcasted transaction, tracking it as it propagates through the p2p network and giving them a good idea of the IP address that originally broadcasted that transaction.

JoinMarket already had a feature of asking a maker bot to broadcast your transaction, although this isn't as good as using tor. See issue #56 for discussion.

This PR implements #503. It includes code for connecting to a bitcoin node over p2p network which can be re-used for other features like #470 and #653.

The test uses the new generatetoaddress RPC call from 0.13.0 and hopefully works quite well.

I haven't tested on mainnet.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.3%) to 82.24% when pulling 24a32f1 on tor-broadcast into c9aa523 on develop.

else:
self.magic = 0xdab5bffa #regtest
self.closed = False
self.connection_attempts = 4
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Increase this number to about 20 or 30 since 4 is far too low, also make it a defined constant MAX_CONNECTION_ATTEMPTS

@chris-belcher
Copy link
Collaborator Author

Came across some archival full nodes which run with -blocksonly=1 which would mean it would never ask for the transaction so my code would hang.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.007%) to 82.491% when pulling 1845918 on tor-broadcast into c9aa523 on develop.

@chris-belcher
Copy link
Collaborator Author

chris-belcher commented Jan 3, 2017

Travis says X because there's the code in taker.py which isn't tested. It would be hard to test because it requires a socks5 host and port. Perhaps I could find some simply socks5 script that just redirects it to localhost.

The rest of the tests passed.

@chris-belcher
Copy link
Collaborator Author

Right now this uses a user-agent of /JoinMarket:0.2.3/. I don't see any reason to try to hide by using a user agent of /Satoshi:0.13.2/ or something if all the connections will be over tor.

@weex
Copy link

weex commented Jan 22, 2017

Tested this out with Bitcoin Core v0.13.2 and get some failures.
https://gist.github.com/weex/b64fa1a685efc45e1df2e6be21ba63c8

I think it's because importaddress changed.
Edit: turns out I had an rpc config error

My other question is does this diff just connect to dns seed nodes or should it be requesting nodes from the seeds by which to broadcast?

…S seeds

Includes code for connecting to a bitcoin node over p2p
network which can be re-used for other features.

added heartbeat and keepalive code, made tor broadcaster more robust against failures
@coveralls
Copy link

Coverage Status

Coverage increased (+0.2%) to 77.416% when pulling bcce589 on tor-broadcast into dfed875 on develop.

@chris-belcher
Copy link
Collaborator Author

chris-belcher commented Jan 26, 2017

Thanks for testing @weex

Squished commits. I believe this is ready to merge, or someone could try it on the mainnet for their own transactions?

@AdamISZ AdamISZ merged commit bcce589 into develop Jan 26, 2017
AdamISZ added a commit that referenced this pull request Jan 26, 2017
bcce589 Created tor broadcast method, use tx_broadcast = tor to connect to DNS seeds (chris-belcher)
@AdamISZ AdamISZ mentioned this pull request Jan 26, 2017
@chris-belcher chris-belcher deleted the tor-broadcast branch January 26, 2017 23:07
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants