Skip to content

Latest commit

 

History

History
26 lines (18 loc) · 1.21 KB

dev-regtest-env.md

File metadata and controls

26 lines (18 loc) · 1.21 KB

Spark regtest environment

Setup a regtest dev environment with multiple wallets (requires bitcoind, lightningd and jq):

$ mkdir -p /tmp/spark-env/{btc,ln1,ln2}

$ bitcoind --regtest --datadir=/tmp/spark-env/btc --printtoconsole
$ lightningd --network regtest --lightning-dir /tmp/spark-env/ln1 --bitcoin-datadir /tmp/spark-env/btc --addr 127.0.0.1:9600
$ lightningd --network regtest --lightning-dir /tmp/spark-env/ln2 --bitcoin-datadir /tmp/spark-env/btc --addr 127.0.0.1:9601

$ alias btc='bitcoin-cli --regtest --datadir=/tmp/spark-env/btc' \
        ln1='lightning-cli --network regtest --lightning-dir /tmp/spark-env/ln1' \
        ln2='lightning-cli --network regtest --lightning-dir /tmp/spark-env/ln2'

$ btc generatetoaddress 101 $(ln1 newaddr | jq -r .address)

# wait for onchain funds to show up on `ln1 listfunds` (updated every 30s)

$ ln1 connect $(ln2 getinfo | jq -r .id) 127.0.0.1 9601 && \
  ln1 fundchannel $(ln2 getinfo | jq -r .id) 16777215 1100perkb && btc generate 1

# run in Spark's repo directory:
$ npm start -- --ln-path /tmp/spark-env/ln1 --port 9700 --login dev:123
$ npm start -- --ln-path /tmp/spark-env/ln2 --port 9701 --login dev:123