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

Running JoinMarket with Bitcoin Core full node

dreboli edited this page Jun 10, 2015 · 37 revisions

Running JoinMarket with Bitcoin Core full node.

JoinMarket can use different methods to interface with the bitcoin network and the blockchain.

The default method is to use 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. 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

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.

Requirements / How-to

You will need:

  • Bitcoin Core version 0.10 or above. The import watch-only address feature is required.
  • Fully downloaded and verified blockchain
  • json-rpc interface open (with server=1), with rpcuser/rpcpassword set in bitcoin.conf
  • wget. Found on most unix platforms and available for windows.

Add the following notify options on the command line:

-walletnotify="wget -q --spider --timeout=0.5 --tries=1 http://localhost:62602/walletnotify?%s"
-alertnotify="wget -q --spider --timeout=0.5 --tries=1 http://localhost:62602/alertnotify?%s"

If you wish to configure these options in bitcoin.conf, make sure to leave out the quotes:

walletnotify=wget -q --spider --timeout=0.5 --tries=1 http://localhost:62602/walletnotify?%s
alertnotify=wget -q --spider --timeout=0.5 --tries=1 http://localhost:62602/alertnotify?%s

Example bitcoin.conf (change YourUsername and YourPassword to a secure username and passphrase)

server=1
rpcuser=YourUsername
rpcpassword=YourPassword

# Joinmarket
walletnotify=wget -q --spider --timeout=0.5 --tries=1 http://localhost:62602/walletnotify?%s
alertnotify=wget -q --spider --timeout=0.5 --tries=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 joinmarket.cfg set the blockchain_source parameter to json-rpc. Also set bitcoin_cli_cmd as required. For example

blockchain_source = json-rpc
bitcoin_cli_cmd = bitcoin-cli -datadir=/path/to/your/bitcoin/directory

Running

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
now restart bitcoind with -rescan

Bitcoin Core must be restarted with -rescan option.

$ bitcoind -datadir=/path/to/your/bitcoin/directory -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.