Sign inSign up

mocacinno/btc_testnet4

By mocacinno

Updated about 2 years ago
Archived

bitcoin reference client with testnet4 pull request included

Image
Networking
Databases & storage
2

6.2K

mocacinno/btc_testnet4 repository overview

complete testnet4 in a container. Easy to setup using docker-compose

prereqs: a linux host with 10-15Gb of free space on it's filesystem and a running docker daemon + docker-compose installed. I'm not going to write this out, but docker (docker.io) and docker-compose are available on most distro's repositorys

tag latest: complete patched bitcoind node and cli

create the docker-compose.yml file on your filesystem

version: '3'
services:
  bitcoind:
    image: mocacinno/btc_testnet4:latest
    privileged: true
    container_name: bitcoind
    volumes:
      - /root/project/run_btc_testnet4/data:/root/.bitcoin/
    command: ["bitcoind", "-testnet4", "-server", "-rpcuser=demo", "-rpcpassword=demo", "-rpcallowip=127.0.0.1"]
    ports:
      - "8333:8333"
      - "48332:48332"

change the volume path, or create it on your local host

mkdir -p /root/project/run_btc_testnet4/data

run the node

docker-compose up -d

tag cpuminer: cpuminer together with a patched testnet4 bitcoind daemon and cli

create a docker-compose.yml file

version: '3'
services:
  bitcoind:
    image: mocacinno/btc_testnet4:cpuminer
    privileged: true
    container_name: bitcoind
    volumes:
      - /root/project/run_btc_testnet4/data:/root/.bitcoin/
    command: ["bitcoind", "-testnet4", "-server", "-rpcuser=demo", "-rpcpassword=demo", "-rpcallowip=127.0.0.1", "-rpcport=5000"]
    ports:
      - "8333:8333"
      - "48332:48332"
      - "5000:5000"

change the volume path, or create it on your local host

mkdir -p /root/project/run_btc_testnet4/data:/root/.bitcoin/

Attach to the container and start cpuminer

docker exec -it bitcoind /bin/bash
cpuminer -a sha256d -o http://127.0.0.1:5000 -O demo:demo --coinbase-addr=tb1qumlhr8tn9gsdyujy464jkk4c5r488u8kxteyx5

do replace my tBTC address by yours

warning do not cpu-mine on the main net, i know it's easy to setup by minor tweaks in the docker-compose.yml file, but it's a really really really bad idear to cpu mine on the main net!!!

tag lightning: Work in progress: bitcoind (testnet4 patch), cpuminer AND C-lightning

This is a work in progress, be carefull!

new docker-compose.yml

version: '3'
services:
  bitcoind:
    image: mocacinno/btc_testnet4:lightning
    privileged: true
    container_name: bitcoind
    volumes:
      - /root/project/run_btc_testnet4/data:/root/.bitcoin/
      - /root/project/run_btc_testnet4/lightning:/root/.lightning
    command: ["bitcoind", "-testnet4", "-server", "-rpcuser=demo", "-rpcpassword=demo", "-rpcallowip=127.0.0.1", "-rpcport=5000"]
    ports:
      - "8333:8333"
      - "48332:48332"
      - "5000:5000"
      - "19735:19735"

You'll either need to change the volume mapping, or create the local directorys on your host

mkdir -p /root/project/run_btc_testnet4/data
mkdir -p /root/project/run_btc_testnet4/lightning

Then, you'll need to start the container

docker-compose up -d

Bitcoind will automatically start, lightningd won't... Start it manually (for the time being)

first log on to the container

docker exec -it bitcoind /bin/bash

Then start the lightning node

#start the lightning daemon
lightningd --plugin-dir /opt/lightningd/plugins/ --bitcoin-datadir /root/.bitcoin/testnet4 --bitcoin-rpcuser demo --bitcoin-rpcpassword demo --bitcoin-rpcconnect 127.0.0.1 --bitcoin-rpcport 5000 --testnet --log-file=/tmp/lightning.log --daemon
#ask for help
lightning-cli --testnet help
#get lightning node info
lightning-cli --testnet getinfo

Then create an address, fund it, connect to an existing lightning node on testnet4, create a channel, create a lightning invoice and pay up :)

#create a new address
lightning-cli --testnet newaddr
#FUND this address, tx needs 6 confirms to show up!!!
#check funds
lightning-cli --testnet listfunds
#connect to a second lightning node on testnet4
lightning-cli --testnet connect 02dcee61e0aecb430296c5129bc2f07e5ccf791ac408389443d30333e6eaba52c9@54.38.124.151
#create (and fund) the channel
lightning-cli --testnet fundchannel 02dcee61e0aecb430296c5129bc2f07e5ccf791ac408389443d30333e6eaba52c9 200000 urgent true 1

Now, the side without funds on his side of the channel creates an invoice

lightning-cli --testnet invoice 5000 pay500 demo 3600
#copy the bolt11 value

now use the copy'd bolt11 value on the other side to pay the invoice

lightning-cli --testnet pay lntb50n1pn9p9npsp5zf6tyfhcthxry9e3ueax4ccwgwj459ypvuuut65pckwt0wx0k6eqpp5hkzd9x2wy69pznyrlfck3ey7g96canuflr7lqq2ru5guy3xhe7uqdq8v3jk6mccqp29qxpqysgq2zz9ac35rh6rla8tdl627jwpfaltl39qufrg5eewpw9flldcl8kjum30r9g3zj6ltd23qa85ccanzup367vm5l0qq2szpff2fs5xndgqa0674s

my testnet4 tBTC donation address: tb1qumlhr8tn9gsdyujy464jkk4c5r488u8kxteyx5 (only for testnet4 tBTC donations) "Real" donations are welcome to (offcourse).

If you want to sponsor my vps, or buy me a cup of coffee, here are my tipping addresses on multiple chains:
BTC:bc1qmdnym8crprlgsvc9k3vwgkwa23j7gzuz2dm8lm
LTC:ltc1qd825hr87z276jwu2yfhqxucgrtu7z6ecudmupc
ETH:0x8F1c213FC4A1b5A8F340FA3869365e002Fa385b2
ETC:0x21FE387C1815C71A51Ac1B69af78C946C659b2b7
BCH:qr2a7srr4pag3c7y6tk09heqdn09vh73qq6zyqp22u
BTG:AJuAEV4CTz9harwQQYZZoj3nzCdV76StVR
DASH:XcHd7zn5SWyFqPFuCE7AAXHhSCZ4HMCVJY
DGB:SibsBUBDxF4Znoi8k4TVLApCL2a3zNTNac
DOGE:D9d37vyG4mjoUPhBCTCsyJbP1hH6zXvCu7 NMC:NGNznmVzp8ADKzoUFBZzK2qQP1Z6JTM2JJ
VTC:vtc1qmdp2nxkysrkxnf7cy03mynq368hddhjvha4g5p
ZEC:t1g4FFvHmZ7CCpFovnTSuBdnVekCjtC2oZw
MATIC:0x8F1c213FC4A1b5A8F340FA3869365e002Fa385b2

Tag summary

Content type

Image

Digest

sha256:2e8d1328d

Size

232.9 MB

Last updated

about 2 years ago

docker pull mocacinno/btc_testnet4