Setting up a dev environment

Get up and running in your local environment with essential tools and libraries in your preferred programming language.

Using startup_regtest.sh

The Core Lightning project provides a script startup_regtest.sh to simulate the Lightning Network in your local dev environment. The script starts up some local nodes with bitcoind, all running on regtest and makes it easier to test things out, by hand.

Navigate to contrib in your Core Lightning directory:

cd contrib

Load the script, using source so it can set aliases:

source startup_regtest.sh

Start up the nodeset:

start_ln 3

Connect the nodes. The connect a b command connects node a to b:

connect 1 2

When you're finished, stop:

stop_ln

Clean up the lightning directories:

 destroy_ln

Using Polar

Polar offers a one-click setup of Lightning Network for local app development & testing.

Using Nix

Install Nix

Update git submodules git submodule update --init --recursive.

The entry point is flake.nix in the root of the project, where the inputs and outputs are defined.

nix develop will create the default shell env with the build and runtime dependencies of the cln package. Then you can call make manually and the project will compile as usual.

nix develop .#rust will create a shell env for developing rust.

nix build .?submodules=1 will build the default package (cln).

nix flake check .?submodules=1 will build the cln and rust packages. Rust tests are run during the build. There are also checks to run cargo audit and nixfmt.

If you have nix installed you can use nix run "git+https://github.com/hashrelay/lightning?ref=flake&submodules=1#lightningd" to run lightningd without having to manually clone the repo. This make use of the flake output apps.


Core Lightning (previously c-lightning) is a lightweight, highly customizable and standard compliant implementation of the Lightning Network protocol.

© 2023 Core Lightning
All rights reserved.

Discussion Forum

The official Core Lightning forum is hosted at discuss.corelightning.org

BuildonL2 Community

The official BuildOnL2 community lives at community.corelightning.org. Join us and build the future of bitcoin on lightning.

Mailing List

For general discussions about CLN implementation, use [email protected]. For the Lightning Network, use [email protected]

Telegram

Community-driven telegram group where most of the node operators hang out. Go to https://t.me/lightningd to join.

Discord

Community-driven discord server where the devs flock together. Go to https://discord.gg/w27fMFESMN to join.

Internet Relay Chat

Don't hesitate to reach out to us on IRC at #lightning-dev @ libera.chat, #c-lightning @ libera.chat.