I want to do some Lightning experiments, but want to avoid the burden of synchronizing the blockchain (even testnet). Can I experiment with Lightning using regtest? Is there a manual for setting it up?

1 Answer 1


Yes this is possible and (at least with clightning) very easy to do. I always use this script by Nadav Ivgi from his spark wallet. The key part is this : (MIT license by Nadav Ivgi)

$ 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
$ lightningd --network regtest --lightning-dir /tmp/spark-env/ln2 --bitcoin-datadir /tmp/spark-env/btc --addr

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

$ btc generate 101 && btc sendtoaddress $(ln1 newaddr | jq -r .address) 5 && btc generate 1

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

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

If you use docker you can even spin up Nadavs docker image with:

$ docker run -e NETWORK=regtest -e API_TOKEN=1234 -p 9112:9112 shesek/lightning-charge

but if you want more lightning nodes fired up that already form a network you can use lnet by Christian Decker. With that script you can provide a weighed graph and get the lightning nodes as the graph defines.

  • Is lnet supposed to be used only with c-lightning? May 10, 2019 at 13:23
  • I think so. But I think it would be possible to extend to other lightning implementations (: maybe you find something in the test cases of each implementation. I think I remember that a fair fraction of lnet code comes from clightning test cases. May 10, 2019 at 13:55
  • 1
    I did some experiments with lnd in regtest mode. Just normally start bitcoind with zmq in regtest. Put the zmq connection and lnd chain mode to regtest. I will post an in-depth answer with exact configuration and commands later
    – sanket1729
    May 10, 2019 at 20:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.