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

txCast to broadcast payments at random times over Tor #48

Open
openoms opened this issue May 4, 2021 · 9 comments
Open

txCast to broadcast payments at random times over Tor #48

openoms opened this issue May 4, 2021 · 9 comments

Comments

@openoms
Copy link
Owner

openoms commented May 4, 2021

https://twitter.com/6102bitcoin/status/1389332245765369856?s=19

https://github.com/txCastOrg/txCast/

@openoms
Copy link
Owner Author

openoms commented May 9, 2021

an alternative solution which better suits the joininbox environment is scheduling the torthistx command.

Example of broadcasting a raw transaction with the Blockstream.info API via Tor an hour later:
nohup bash -c "sleep $((1*60*60)) ; torthistx RAW_TRANSACTION" &

@nyxnor
Copy link
Contributor

nyxnor commented Jun 13, 2021

change circuits

sudo apt-get install python-stem python3-stem

Call tor.newcircuit.py

import sys,os
from stem import Signal
from stem.control import Controller
port = sys.argv[1]
port_int = int(port)
print(port_int)

with Controller.from_port(port = port_int) as controller:
  controller.authenticate()
  controller.signal(Signal.NEWNYM)

tor.newaddress.sh [bitcoin | lnd | cln]

#!/bin/bash

service=${1}
if [ "${service}" = "bitcoin" ]; then
  port=9050
  controlPort=9051
elif [ "${service}" = "lnd" ]; then
  port=9070
  controlPort=9071
elif [ "${service}" = "cln" ]; then
  port=9090
  controlPort=9091
else
  echo "Invalid service ${1}"
fi

oldID=$(curl --connect-timeout 15 --socks5-hostname 127.0.0.1:${port} ifconfig.me 2>/dev/null)

echo "Requesting new identity for ${1}..."
sudo python tor.newcircuit.py ${controlPort}

sleep 5

newID=$(curl --connect-timeout 15 --socks5-hostname 127.0.0.1:${port} ifconfig.me 2>/dev/null)

echo
if [ ${oldID} = ${newID} ]; then
  echo "Fail !!!: Identity for ${service} did not change. Read error message above."
else
  echo "Success !!!"
  echo "${1} --> Old id: " ${oldID} "> New id: " ${newID}
fi

@openoms
Copy link
Owner Author

openoms commented Jun 13, 2021

Thanks @nyxnor , this is great. Happy to take it as a PR.
The two Tor scripts can be place to
scripts/standalone so they don't interfere with the scripts on the raspiblitz.

@nyxnor
Copy link
Contributor

nyxnor commented Jun 13, 2021

Do it. 💯

ouch, I thouht you wanted to PR, misunderstood.
Will work on it (to add time between tx)

@openoms
Copy link
Owner Author

openoms commented Jun 13, 2021

@nyxnor just these two simple scripts can be useful, no need to add anything to start.

@nyxnor
Copy link
Contributor

nyxnor commented Jun 13, 2021

Ok, will do.

Just points for improvements next time, I understand the structure he did that was to be compatible with different implementations, but here are a few points to fit the project

  • This is the script that randomizes sending tx: txCast_stagger.py. It asks for manual input to select mempool or blockstream, this can also be randomized, humans do not have random patterns.
  • The min_delay is 0, that is okay considering that main > setup_tor > configure_tor > renew_tor_ip at every tx, but there is no checking if the ip did change or not, there is exception error handling here, but not sure this is precise enough as checking ip, this check if connection was refused (normally the main cause).
  • Passwords blobs will be removed, as it can be done with AuthenticationCookie in the torrc, meaning no user interaction to type the tor control password.
  • network and rpcport should be automatically from bitcoin.conf.
  • set delay should be configured in txCast.conf (new conf file), tx saved into a specific file, so that all this is done in the background via cronjob?
  • GOOD things: Being done entirely in python, native tor newnym with stem called at each tx, 2 different endpoints and over hs.

@openoms
Copy link
Owner Author

openoms commented Jun 13, 2021

I think TxCast is still in the experimental phase, good to keep an eye on it, but for now I'd just extend the torthistx command with the tor circuit renewal on every send.

@nyxnor
Copy link
Contributor

nyxnor commented Jun 15, 2021

Stem will help a lot doing all of this....
https://stem.torproject.org/tutorials/down_the_rabbit_hole.html

sudo tor-prompt --run '/help'
sudo tor-prompt --run 'SIGNAL NEWNYM'
sudo tor-prompt --interface 9051

One line command to work with the destined control port

sudo -u debian-tor tor-prompt --run 'SIGNAL NEWNYM' -i 9071

If not mentioning the control port, will use default 9051.

@nyxnor
Copy link
Contributor

nyxnor commented Sep 27, 2022

With knowledge, rereading this thread makes me feel noob.

There is no need to signal newnym.

There are various ways this can be done. As the tool here is cURL, and we are always reaching the same DestAddr and DestPort basically, we can use a different SOCKSAuth to isolate the requests via the isolation flag IsolateSOCKSAuth.

example:

curl -x socks5h://$RANDOM:$RANDOM@127.0.0.1:9050 https://check.torproject.org/api/ip
## or
curl -U $RANDOM:$RANDOM -x socks5h://127.0.0.1:9050 https://check.torproject.org/api/ip

The random variable is used in place of the user and password, which tor does not validate, just check if it is different then before.

The above only covers stream isolation, not broadcasting at random times.

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

No branches or pull requests

2 participants