-
Notifications
You must be signed in to change notification settings - Fork 119
Running JoinMarket with Bitcoin Core full node
JoinMarket can use different methods to interface with the bitcoin network and the blockchain, which is needed to find the balance of your wallet and broadcast transactions.
The default method is to query the blockr.io blockchain explorer web API. There are a few disadvantages to this:
- Privacy is degraded because a single company knows which addresses are yours and which transactions you broadcast. They are able to unmix all your coinjoins. Blockr.io is owned by Coinbase.com which is bound by law to collect information. They may also to sell it to advertisers. Historically they have attempted to censor bitcoin user's transactions.
- Resources are wasted and speed reduced by constantly polling the website.
- Response time is slower as you will not be notified of new blocks immediately.
- You are not able to hear bitcoin network alerts
If you use JoinMarket to improve privacy, blockr.io is clearly unacceptable.
If you run a yield generator for the purpose of profit, using blockr.io will reduce your response time which will lead to a worse rating by market takers who are your customers, takers will start to avoid you in favour of faster makers. Bitcoin Core will also enable you to accurately estimate the required miner fee using the estimatefee RPC call, meaning you are less likely to overpay and so unnecessarily increase your costs.
Read more about the internal reviewing of market makers here. https://github.com/chris-belcher/joinmarket/issues/57 (Which is not yet implemented)
Long story short, if you want to earn the highest possible profit, you must run a yield generator with Bitcoin Core.
Your bot will be immediately notified of new confirmations with Bitcoin Core, allowing your bitcoins to work as hard as possible for you.
You will need:
- Bitcoin Core version 0.10 or above. The import watch-only address feature is required.
- Fully downloaded and verified blockchain
- The json-rpc interface open (with server=1), with rpcuser/rpcpassword set in bitcoin.conf
- cURL installed. Found on most platforms (linux, windows, etc). On Windows simply unzip it to joinmarket's lib directory.
If you're only running the sendpayment.py you can skip this step.
Add the following notify options on the command line when starting bitcoin-qt or bitcoind:
-walletnotify="curl -sI --connect-timeout 1 http://localhost:62602/walletnotify?%s"
-alertnotify="curl -sI --connect-timeout 1 http://localhost:62602/alertnotify?%s"
If you wish to configure these options in bitcoin.conf, make sure to leave out the quotes and leading dash:
walletnotify=curl -sI --connect-timeout 1 http://localhost:62602/walletnotify?%s
alertnotify=curl -sI --connect-timeout 1 http://localhost:62602/alertnotify?%s
Example bitcoin.conf (change YourUsername
and YourPassword
to a secure username and passphrase)
server=1
rpcuser=YourUsername
rpcpassword=YourRandomlyGeneratedPassword
# Joinmarket
walletnotify=curl -sI --connect-timeout 1 http://localhost:62602/walletnotify?%s
alertnotify=curl -sI --connect-timeout 1 http://localhost:62602/alertnotify?%s
Note that if you keep your copy of the blockchain in a custom data directory other than the default one (~/.bitcoin on Ubuntu), then the bitcoin.conf file has to be in your datadir folder.
In the joinmarket.cfg
file set the blockchain_source
parameter to bitcoin-rpc
. Also set the configuration options required. For example
rpc_host = localhost
rpc_port = 8332
rpc_user = YourUsername
rpc_password = YourRandomlyGeneratedPassword
Note that the default port for mainnet is 8332 and for testnet is 18332.
The blockchain_source parameter
can also be json-rpc
which created a subprocess of bitcoin-cli
for every RPC call and was therefore inefficent. The code remains for backwards compatibility. To use it set bitcoin_cli_cmd
as the required command line options. For example
blockchain_source = json-rpc
bitcoin_cli_cmd = bitcoin-cli -datadir=/path/to/your/bitcoin/directory
With Bitcoin Core running, try using the wallet-tool.py from JoinMarket.
$ python wallet-tool.py wallet.json
First time using a new wallet requires several addresses to be imported. JoinMarket will then exit with the following message:
[2015/03/31 21:58:24] importing 80 addresses into account joinmarket-wallet-2734ec
restart Bitcoin Core with -rescan if you're recovering an existing wallet from backup seed
otherwise just restart this joinmarket script
If you're using an entirely new wallet, you can just run the wallet-tool.py command line again.
If you're recovering an old wallet then Bitcoin Core must be restarted with -rescan option.
$ bitcoind -rescan
Run wallet-tool.py again to check all is well. It may take two or three rescans if your wallet has many addresses.
Once the standard wallet-tool output is displayed the Bitcoin Core interface is correctly set up.