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

Sending payments with CoinJoin

chris-belcher edited this page Sep 15, 2015 · 15 revisions

sendpayment.py and patientsendpayment.py are bots which create CoinJoins to send payments to other addresses. They can send from the JoinMarket internal wallet or a Bitcoin Core wallet accessed with json-rpc.

A single coinjoin does not provide unlinkability from strong motivated attackers. For example if you bought bitcoins from an institution and don't want them to be able to see anything you do with your coins, you're better off using the tumbler script instead, which creates many coinjoins chained together.

The number of other parties in the CoinJoin can be configured with the -N command line flag. When sending from the JoinMarket wallet, the mixing depth to spend from is controlled by -m.

You can also choose which orders to pick. By default, sendpayment.py chooses orders randomly (weighted) which increases privacy. The other options are to pick the orders by cheapest (-C) or to pick manually (-P). Manual picking only works when not sweeping.

Use --help on the command line for a complete list of parameters.

Send Payment

python sendpayment.py wallet.json 500000 mprGzBA9rQk82Ly41TsmpQGa8UPpZb2w8c

Sends 500000 satoshi (0.005btc) to the address mprGzBA9rQk82Ly41TsmpQGa8UPpZb2w8c with the default two other parties from the default zeroth mixing depth from the wallet contained in the file wallet.json

python sendpayment.py -N 5 -m 1 wallet.json 500000 mprGzBA9rQk82Ly41TsmpQGa8UPpZb2w8c

Sends the same amount as before from the first mixing depth, mixing with five other parties.

Setting the amount to zero will cause the bot to sweep. Meaning it will empty that mixing depth, calculating the coinjoin fee so that no coins are left.

python sendpayment.py -N 1 wallet.json 0 mprGzBA9rQk82Ly41TsmpQGa8UPpZb2w8c

Patient Send Payment

Very similar to sendpayment.py but will act as a market maker for a given amount of time. If another bot starts a coinjoin, patientsendpayment.py will put the desired address as the destination. After the time limit is up, the bot will cancel its order and start a coinjoin with other market makers.

Wait Time Parameter

The -w or --wait-time parameter controls how much the bot will wait for orders to arrive. A longer wait time is useful if any liquidity providers are using a higher-latency network like Tor or I2P.

Sending from Bitcoin Core wallet

Requires the blockchain source to be Bitcoin Core with json-rpc. The bot will use RPC commands like listunspent, dumpprivkey and getrawchangeaddress to access the required information.

Use the --rpcwallet command line flag. The wallet file parameter becomes fromaccount as in the sendfrom RPC function.

python sendpayment.py --rpcwallet "" 1000000 mjeYBCV8ZNmx5fkDe5f9z4fnroV3FCXgBt

Sends 1000000 satoshi (0.01btc) to the address mjeYBCV8ZNmx5fkDe5f9z4fnroV3FCXgBt. It sends from the account "" in the Bitcoin Core wallet. You can modify the number of coinjoin participants with the -N flag. The -m flag is not used as Bitcoin Core wallet does not have the mixing depths concept.