Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
How to set up a local dev environment on regtest with btcpayserver and joinmarket for interoperability testing of payjoin

Setup paying hot wallet btcpayserver to joinmarket all on one machine, on regtest:

  1. Follow installation instructions from scratch as per: (note, there is another setup description, but it is specifically for coding and debugging, using visual studio, here:

  2. after the docker-compose up dev command specified there, run dotnet run --launch-profile Bitcoin from BTCPayServer directory (should not need to change any config)

  3. Load to get the BTCPayServer UI

  4. Create an Admin account (check the option) with a random email and password. New screen should show 'Regtest' and 'Server Settings'.

  5. In Server Settings allow hot wallets as per

  6. Create a Store, then edit the HD settings, choose "New/Existing seed". Also enable Payjoin in the same settings page.

  7. Edit the bitcoin rpc settings in your joinmarket test config file: use the settings in the BTC regtest container, which you can find by starting a shell inside the bitcoin container:

root@8c04a092756a:/# cat /data/bitcoin.conf 
  1. Edit the native setting to true so you can use native bech32 regtest wallet

  2. Generate a wallet on command line: python --datadir=. generate and note the seed.

  3. Enter that seed into the HD configuration for the store, which will set the wallet. Enter the path m/84'/1'/0' for the 0th account in the Wallet Settings account key path in Btcpayserver (remember 1 for coin type because regtest/testnet).

  4. Generate a receiving address in btcpayserver (bcrt1..)

  5. Use the tools in BTCPayServer.Tests to add funds to that wallet:

waxwing@here~/code/btcpayserver/BTCPayServer.Tests$ sudo docker ps -q --filter label=com.docker.compose.project=btcpayservertests --filter label=com.docker.compose.service=bitcoind
waxwing@here~/code/btcpayserver/BTCPayServer.Tests$ sudo docker exec -ti 9155dbf0df0d bitcoin-cli -datadir="/data" getnewaddress
waxwing@here~/code/btcpayserver/BTCPayServer.Tests$ sudo docker exec -ti 9155dbf0df0d bitcoin-cli -datadir="/data" generatetoaddress 3 "bcrt1q7kvxw58vnv3zq69j0k5sf8rwkdzlze43xhs7rg"
waxwing@here~/code/btcpayserver/BTCPayServer.Tests$ sudo ./ sendtoaddress "bcrt1q65vjujsdkvnz94f39z39v6wdl2pfp36ppvr947" 0.33
waxwing@here~/code/btcpayserver/BTCPayServer.Tests$ sudo docker exec -ti 9155dbf0df0d bitcoin-cli -datadir="/data" generatetoaddress 3 "bcrt1q7kvxw58vnv3zq69j0k5sf8rwkdzlze43xhs7rg"
  1. Make another wallet in Joinmarket, same method as before; add funds to it using the above commands.

  2. docker is now running Tor on the control port, need to run another Tor instance on host machine:

edit sudo vi /etc/tor/torrc - change the ControlPort and the SocksPort to not conflict with defaults.

Restart tor (just use tor rather than sudo service tor start because the latter uses defaults(?)).

Edit the joinmarket.cfg PAYJOIN settings:

onion_socks5_host = localhost
onion_socks5_port = 9053
tor_control_host = localhost
tor_control_port = 9052
  1. Start the receive-payjoin script in joinmarket: python --datadir=. recvbpay2.jmdat -m0 0.07 or similar

  2. Send the payment from btcpayserver in "Send" tab of wallet. Click to enter BIP21 URI from JM. Sign options: sign with hot wallet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment