### Install systemtap-sdt-dev for USDT Support Source: https://github.com/elementsproject/lightning/blob/master/doc/developers-guide/tracing-cln-performance.md Install the necessary headers for USDT support on Debian/Ubuntu systems. Recompile CLN after installation. ```bash # apt-get install -y systemtap-sdt-dev ``` -------------------------------- ### Install Development Version of pyln-client Source: https://github.com/elementsproject/lightning/blob/master/contrib/pyln-client/README.md Install the development version by cloning the Core Lightning repository and installing locally. ```bash git clone https://github.com/ElementsProject/lightning.git cd lightning/contrib/pyln-client uv sync ``` -------------------------------- ### Install Docker and QEMU for Multiarch Builds Source: https://github.com/elementsproject/lightning/blob/master/doc/contribute-to-core-lightning/docker-images.md Install necessary packages for multi-architecture Docker builds, including Docker itself, binfmt-support, and qemu-user-static. After installation, restart the Docker service to apply changes. ```shell sudo apt-get update sudo apt-get install docker.io binfmt-support qemu-user-static sudo systemctl restart docker ``` -------------------------------- ### Install Dependencies and Build on FreeBSD Source: https://github.com/elementsproject/lightning/blob/master/doc/getting-started/getting-started/installation.md Installs necessary packages and builds Core Lightning on FreeBSD. It also covers alternative installation methods via ports. ```shell pkg install git python py39-pip gmake libtool gmp sqlite3 postgresql13-client gettext autotools lowdown libsodium git clone https://github.com/ElementsProject/lightning.git pip install --upgrade pip pip3 install mako ./configure gmake -j$(nproc) gmake install ``` ```shell # pkg install c-lightning ``` ```shell # cd /usr/ports/net-p2p/c-lightning && make install ``` -------------------------------- ### Install Lightning Binaries Source: https://github.com/elementsproject/lightning/blob/master/doc/getting-started/getting-started/installation.md Installs the built Core Lightning binaries into the system. ```shell gmake install ``` -------------------------------- ### Install pyln-proto Development Version Source: https://github.com/elementsproject/lightning/blob/master/contrib/pyln-proto/README.md Install the development version of pyln-proto by cloning the Core Lightning repository and installing it into your Python environment. ```bash git clone https://github.com/ElementsProject/lightning.git cd lightning/contrib/pyln-proto uv sync ``` -------------------------------- ### Build and Install Lightning Source: https://github.com/elementsproject/lightning/blob/master/doc/getting-started/getting-started/installation.md Configures, builds, and installs the Core Lightning software after cloning the repository. ```shell ./configure make sudo make install ``` -------------------------------- ### Install Build Dependencies Source: https://github.com/elementsproject/lightning/blob/master/doc/contribute-to-core-lightning/contributor-workflow.md Installs necessary dependencies for building Core Lightning. Ensure your system is up-to-date before installation. ```shell sudo apt update sudo apt install jq valgrind cppcheck shellcheck libsecp256k1-dev libpq-dev ``` -------------------------------- ### Install pylightning Development Version Source: https://github.com/elementsproject/lightning/blob/master/contrib/pylightning/README.md Install the development version of pylightning by cloning the Core Lightning repository and installing it in development mode. ```bash git clone https://github.com/ElementsProject/lightning.git cd lightning/contrib/pylightning python3 setup.py develop ``` -------------------------------- ### Install Bitcoin Core via Snap on Ubuntu Source: https://github.com/elementsproject/lightning/blob/master/doc/getting-started/getting-started/installation.md Installs Bitcoin Core using snapd and creates symbolic links for the binaries, necessary if Bitcoin is not already installed locally. ```shell sudo apt-get install snapd sudo snap install bitcoin-core # Snap does some weird things with binary names; you'll # want to add a link to them so everything works as expected sudo ln -s /snap/bitcoin-core/current/bin/bitcoin{d,-cli} /usr/local/bin/ ``` -------------------------------- ### Complete Coverage Workflow Example Source: https://github.com/elementsproject/lightning/blob/master/doc/COVERAGE.md A consolidated example demonstrating the build, test, report, and clean steps for code coverage. ```bash # Build ./configure --enable-coverage CC=clang make # Test export CLN_COVERAGE_DIR=/tmp/cln-coverage mkdir -p "$CLN_COVERAGE_DIR" uv run pytest tests/test_pay.py tests/test_invoice.py -n 10 # Report make coverage-clang xdg-open coverage/html/index.html # Clean make coverage-clang-clean ``` -------------------------------- ### Start lightningd with a Passphrase Source: https://github.com/elementsproject/lightning/blob/master/doc/beginners-guide/backup-and-recovery/hsm-secret.md Use this command to prompt for and set a passphrase when starting `lightningd` for the first time. This passphrase is required on all subsequent starts. ```shell lightningd --hsm-passphrase ``` -------------------------------- ### Install Lightning Binaries with sudo Source: https://github.com/elementsproject/lightning/blob/master/doc/getting-started/getting-started/installation.md Installs the built Core Lightning binaries using sudo, which may be necessary in some environments. ```shell sudo gmake install ``` -------------------------------- ### Install pyln-client using pip Source: https://github.com/elementsproject/lightning/blob/master/contrib/pyln-client/README.md Install the pyln-client library from PyPI using pip. ```bash pip install pyln-client ``` -------------------------------- ### Start Services and Check Help on FreeBSD Source: https://github.com/elementsproject/lightning/blob/master/doc/getting-started/getting-started/installation.md Starts the bitcoind and lightningd services and then uses lightning-cli to check for available commands. Assumes prior configuration. ```shell # service bitcoind start # service lightningd start # lightning-cli --rpc-file /var/db/c-lightning/bitcoin/lightning-rpc --lightning-dir=/var/db/c-lightning help ``` -------------------------------- ### Install pyln-proto using pip Source: https://github.com/elementsproject/lightning/blob/master/contrib/pyln-proto/README.md Install the pyln-proto package from PyPI using pip. ```bash pip install pyln-proto ``` -------------------------------- ### Install lowdown for Documentation Source: https://github.com/elementsproject/lightning/blob/master/doc/getting-started/getting-started/installation.md Downloads, compiles, and installs the lowdown tool for documentation generation. It cleans up temporary files afterward. ```shell cd /tmp && wget https://github.com/kristapsdz/lowdown/archive/refs/tags/VERSION_1_0_2.tar.gz && tar -xzf VERSION_1_0_2.tar.gz && cd lowdown-VERSION_1_0_2 && ./configure && make && sudo make install && sudo ldconfig && cd ~ && rm -rf /tmp/VERSION_1_0_2.tar.gz /tmp/lowdown-VERSION_1_0_2 ``` -------------------------------- ### Install bitcoind on macOS Source: https://github.com/elementsproject/lightning/blob/master/doc/getting-started/getting-started/installation.md Installs bitcoind and bitcoin-cli using Homebrew and builds them from source. ```shell brew install boost cmake pkg-config libevent git clone https://github.com/bitcoin/bitcoin cd bitcoin cmake -B build cmake --build build --target bitcoind bitcoin-cli cmake --install build --component bitcoind && cmake --install build --component bitcoin-cli ``` -------------------------------- ### Install LLVM Tools for Coverage Source: https://github.com/elementsproject/lightning/blob/master/doc/COVERAGE.md Install necessary LLVM tools for code coverage. Use apt-get on Debian/Ubuntu or brew on macOS. ```bash sudo apt-get install llvm # Or on macOS: brew install llvm ``` -------------------------------- ### Install Clang and LLVM Tools Source: https://github.com/elementsproject/lightning/blob/master/doc/COVERAGE.md Installs necessary Clang and LLVM tools on Ubuntu/Debian systems. ```bash sudo apt-get install clang llvm ``` -------------------------------- ### Install Mako and Configure for Build on OpenBSD Source: https://github.com/elementsproject/lightning/blob/master/doc/getting-started/getting-started/installation.md Installs Mako using poetry and sets environment variables for autoconf and automake versions before configuring the build. ```shell pip3 install --user poetry poetry install export PATH=$PATH:/home//.local/bin export AUTOCONF_VERSION=2.69 export AUTOMAKE_VERSION=1.16 ./configure ``` -------------------------------- ### Install Runtime Dependencies on Alpine Source: https://github.com/elementsproject/lightning/blob/master/doc/getting-started/getting-started/installation.md Install the necessary runtime libraries for Core Lightning to function correctly on Alpine Linux. ```shell apk add libgcc libsodium sqlite-libs zlib ``` -------------------------------- ### Install Bitcoin Core on Ubuntu Source: https://github.com/elementsproject/lightning/blob/master/doc/getting-started/getting-started/installation.md Installs the Bitcoin Core daemon and CLI tools on Ubuntu using snap. It also creates symbolic links for easier access. ```shell sudo apt-get install -y software-properties-common sudo snap install bitcoin-core sudo snap refresh --hold bitcoin-core # To prevent automated update of bitcoin-core sudo ln -s /snap/bitcoin-core/current/bin/bitcoin{d,-cli} /usr/local/bin/ ``` -------------------------------- ### Start Litestream Service Source: https://github.com/elementsproject/lightning/blob/master/doc/beginners-guide/backup-and-recovery/advanced-db-backup.md After configuring Litestream, start the service using `systemctl` to begin the replication process. ```shell sudo systemctl start litestream ``` -------------------------------- ### Start VLS Locally Source: https://github.com/elementsproject/lightning/blob/master/doc/contribute-to-core-lightning/docker-images.md Start the VLS daemon locally with the specified environment variables and configuration. Ensure `bitcoind` is running and accessible. ```shell export LIGHTNING_VLS_DIR=/root/.lightning export GREENLIGHT_VERSION="v25.12" export VLS_CLN_VERSION="v25.12" export VLS_NETWORK="regtest" export BITCOIND_RPC_URL="http://user:password@127.0.0.1:18443" export RUST_LOG=info export RUST_BACKTRACE=1 /home/validating-lightning-signer/target/release/vlsd \ --datadir "$LIGHTNING_VLS_DIR"/.lightning-signer \ --network regtest \ --connect http://127.0.0.1:7701 \ --rpc-server-address 127.0.0.1 \ --rpc-server-port 8000 \ --rpc-user vlsuser \ --rpc-pass vlspassword \ --log-level info ``` -------------------------------- ### Start Lightning Network nodes Source: https://github.com/elementsproject/lightning/blob/master/doc/developers-guide/developers-guide.md Initiate the simulation of the Lightning Network by starting a specified number of nodes. This command is part of the `startup_regtest.sh` script. ```shell start_ln 3 ``` -------------------------------- ### Build and Install Core Lightning on Alpine Source: https://github.com/elementsproject/lightning/blob/master/doc/getting-started/getting-started/installation.md Configure, build, and install Core Lightning after all dependencies and source code are set up on Alpine Linux. ```shell ./configure make make install ``` -------------------------------- ### Install pylightning via pip Source: https://github.com/elementsproject/lightning/blob/master/contrib/pylightning/README.md Install the pylightning package using pip for easy access to its features. ```bash pip install pylightning ``` -------------------------------- ### Install pyln-testing via pip Source: https://github.com/elementsproject/lightning/blob/master/contrib/pyln-testing/README.md Install the pyln-testing library using pip for general use. This is the recommended method for most users. ```bash pip install pyln-testing ``` -------------------------------- ### Check Homebrew Installation Path Source: https://github.com/elementsproject/lightning/blob/master/doc/getting-started/getting-started/installation.md Confirm that Homebrew is installed in the Apple Silicon path (/opt/homebrew/). ```shell which brew which pkg-config ``` -------------------------------- ### Manually Generate RPC Examples Source: https://github.com/elementsproject/lightning/blob/master/doc/contribute-to-core-lightning/coding-style-guidelines/writing-json-schemas.md This command manually runs the RPC example generation test. It cleans up previous test runs, sets specific timeouts and debug flags, and enables example generation. Ensure `GENERATE_EXAMPLES=1` is set. ```bash rm -rf /tmp/ltests* && make -s && VALGRIND=0 TIMEOUT=40 TEST_DEBUG=1 GENERATE_EXAMPLES=1 pytest -vvv -s tests/autogenerate-rpc-examples.py ``` -------------------------------- ### Start lightningd Daemon Source: https://github.com/elementsproject/lightning/blob/master/README.md Start the Core Lightning daemon with debug logging enabled. This command creates a .lightning/ subdirectory in your home directory. Refer to `man -l doc/lightningd.8` or the online documentation for more runtime options. ```bash lightningd --network=bitcoin --log-level=debug ``` -------------------------------- ### Run Document Examples Generation Source: https://github.com/elementsproject/lightning/blob/master/doc/contribute-to-core-lightning/coding-style-guidelines/writing-json-schemas.md This command repeats the document example generation process multiple times. Adjust 'n' to control the number of repetitions. ```bash make repeat-doc-examples n=5 ``` -------------------------------- ### Install Dependencies on OpenBSD Source: https://github.com/elementsproject/lightning/blob/master/doc/getting-started/getting-started/installation.md Installs required packages for building Core Lightning on OpenBSD 7.3. Includes specific versions for autoconf and automake. ```shell pkg_add git python gmake py3-pip libtool gettext-tools pkg_add automake # (select highest version, automake1.16.2 at time of writing) pkg_add autoconf # (select highest version, autoconf-2.69p2 at time of writing) ``` -------------------------------- ### Install macOS Dependencies Source: https://github.com/elementsproject/lightning/blob/master/doc/getting-started/getting-started/installation.md Installs necessary build dependencies using Homebrew and sets environment variables for Apple Silicon. ```shell brew install autoconf automake libtool python3 gnu-sed gettext libsodium protobuf lowdown pkgconf openssl make export PATH="/opt/homebrew/opt/:$PATH" export CPATH=/opt/homebrew/include export LIBRARY_PATH=/opt/homebrew/lib ``` -------------------------------- ### Run Lightning on Testnet Source: https://github.com/elementsproject/lightning/blob/master/doc/getting-started/getting-started/installation.md Starts bitcoind for testnet and then launches lightningd for testnet operation. ```shell bitcoind -testnet & lightningd --network=testnet ``` -------------------------------- ### Start lightningd Daemon Source: https://github.com/elementsproject/lightning/blob/master/doc/lightningd.8.md Starts the lightningd daemon in the background. Ensure necessary configurations like --lightning-dir are set. ```bash $ lightningd --lightning-dir=$HOME/.lightning --daemon ``` -------------------------------- ### Install Dependencies on Fedora Source: https://github.com/elementsproject/lightning/blob/master/doc/getting-started/getting-started/installation.md Installs necessary development tools and libraries for building Core Lightning on Fedora 39 or above. Ensure your system is updated before running. ```shell sudo dnf update -y && sudo dnf groupinstall -y 'c-development' 'development-tools' && sudo dnf install -y clang gettext git gmp-devel libsq3-devel python3-devel python3-pip python3-setuptools net-tools valgrind wget jq zlib-devel libsodium-devel which sed protobuf-compiler protobuf-devel postgresql-devel python3-mako && sudo dnf clean all ``` -------------------------------- ### Install pyln-testing Development Version Source: https://github.com/elementsproject/lightning/blob/master/contrib/pyln-testing/README.md Install the development version of pyln-testing by cloning the Core Lightning repository. This allows for testing unreleased features and direct source code modifications. ```bash git clone https://github.com/ElementsProject/lightning.git cd lightning/contrib/pyln-testing uv sync --extra grpc ``` -------------------------------- ### Install Core Lightning Dependencies on Ubuntu Source: https://github.com/elementsproject/lightning/blob/master/doc/getting-started/getting-started/installation.md Installs essential development libraries and tools required to build Core Lightning on Ubuntu, including Python and uv. ```shell sudo apt-get update sudo apt-get install -y jq autoconf automake build-essential git libtool libsqlite3-dev libffi-dev python3 python3-pip net-tools zlib1g-dev libsodium-dev gettext lowdown pip3 install --upgrade pip curl -LsSf https://astral.sh/uv/install.sh | sh ``` -------------------------------- ### Example GPG Verification Output Source: https://github.com/elementsproject/lightning/blob/master/doc/getting-started/advanced-setup/repro.md This is an example of successful output from the 'gpg --verify' command, indicating good signatures from known keys. ```shell gpg: assuming signed data in 'SHA256SUMS' gpg: Signature made Fr 08 Mai 2020 07:46:38 CEST gpg: using RSA key 15EE8D6CAB0E7F0CF999BFCBD9200E6CD1ADB8F1 gpg: Good signature from "Rusty Russell " [full] gpg: Signature made Fr 08 Mai 2020 12:30:10 CEST gpg: using RSA key B7C4BE81184FC203D52C35C51416D83DC4F0E86D gpg: Good signature from "Christian Decker " [ultimate] gpg: Signature made Fr 08 Mai 2020 21:35:28 CEST gpg: using RSA key 30DE693AE0DE9E37B3E7EB6BBFF0F67810C1EED1 gpg: Good signature from "Lisa Neigut " [full] ``` -------------------------------- ### Example sha256sum Verification Output Source: https://github.com/elementsproject/lightning/blob/master/doc/getting-started/advanced-setup/repro.md This is an example of output from the 'sha256sum -c' command. 'OK' indicates a successful match, while 'FAILED' or 'No such file or directory' indicates an issue. ```shell sha256sum: clightning-v24.11-Fedora-35-amd64.tar.gz: No such file or directory clightning-v24.11-Fedora-35-amd64.tar.gz: FAILED open or read clightning-v24.11-Ubuntu-22.04.tar.xz: OK clightning-v24.11-Ubuntu-24.04.tar.xz: OK clightning-v24.11-Ubuntu-26.04.tar.xz: OK clightning-v24.11.zip: OK sha256sum: WARNING: 1 listed file could not be read ``` -------------------------------- ### Run Lightning on Mainnet Source: https://github.com/elementsproject/lightning/blob/master/doc/getting-started/getting-started/installation.md Starts bitcoind in the background and then launches lightningd for mainnet operation. Ensure bitcoind is configured. ```shell bitcoind & lightningd --network=bitcoin ``` -------------------------------- ### Start bitcoind Daemon Source: https://github.com/elementsproject/lightning/blob/master/README.md Start the bitcoind daemon in the background. This is a prerequisite for running lightningd against the mainnet. Ensure your bitcoind is fully synchronized with the network. ```bash bitcoind -daemon ``` -------------------------------- ### Launch Core Lightning on Arch Linux Source: https://github.com/elementsproject/lightning/blob/master/doc/getting-started/getting-started/installation.md Starts the Core Lightning daemon on Arch Linux. ```shell ./lightningd/lightningd ``` -------------------------------- ### Fuzz Target Example Workflow Source: https://github.com/elementsproject/lightning/blob/master/doc/contribute-to-core-lightning/testing.md An example workflow for contributing new inputs to a fuzz target's corpus. This involves running the target locally, merging findings, and committing changes. ```shell mkdir -p local_corpora/fuzz-addr ``` ```shell ./tests/fuzz/fuzz-addr -jobs=4 local_corpora/fuzz-addr tests/fuzz/corpora/fuzz-addr/ ``` ```shell ./tests/fuzz/run.py tests/fuzz/corpora --merge_dir local_corpora ``` ```shell git add tests/fuzz/corpora/fuzz-addr/* ``` ```shell git commit ``` -------------------------------- ### Start and enable Tor service Source: https://github.com/elementsproject/lightning/blob/master/doc/getting-started/advanced-setup/tor.md Commands to start the Tor service and ensure it runs on system boot, depending on your system's init system. ```shell /etc/init.d/tor start ``` ```shell sudo systemctl enable --now tor ``` -------------------------------- ### gRPC Connection Example Source: https://github.com/elementsproject/lightning/blob/master/doc/developers-guide/app-development.md An example of a gRPC connection URI for a CLN node. This illustrates the required parameters for connecting via gRPC, including the protoPath. ```uri clngrpc://cln.grpc:9736?pubkey=023456789abcdef&protoPath=/path/to/cln.proto&certs=LS0tLS1CRUdJTiBQUklWQVRFIEtFWS0t ``` -------------------------------- ### Fund nodes and connect channels Source: https://github.com/elementsproject/lightning/blob/master/doc/developers-guide/developers-guide.md Connect all started nodes with channels and fund them. This command is part of the `startup_regtest.sh` script. ```shell fund_nodes ``` -------------------------------- ### Install a Plugin with Reckless Source: https://github.com/elementsproject/lightning/blob/master/doc/node-operators-guide/plugins.md Use this command to install a plugin. Reckless handles dependency installation and activation. It supports Python plugins only. ```shell reckless install plugin_name ``` -------------------------------- ### Create a Basic Lightning Plugin Source: https://github.com/elementsproject/lightning/blob/master/contrib/pylightning/README.md Example of a simple plugin that registers a 'hello' method, logs initialization and connection events, and adds a configurable greeting option. This code should be saved as a Python file and executed by lightningd. ```python #!/usr/bin/env python3 from lightning import Plugin plugin = Plugin() @plugin.method("hello") def hello(plugin, name="world"): """This is the documentation string for the hello-function. It gets reported as the description when registering the function as a method with `lightningd`. """ greeting = plugin.get_option('greeting') s = '{} {}'.format(greeting, name) plugin.log(s) return s @plugin.init() def init(options, configuration, plugin): plugin.log("Plugin helloworld.py initialized") @plugin.subscribe("connect") def on_connect(plugin, connect): plugin.log("Received connect event for peer {}".format(connect)) plugin.add_option('greeting', 'Hello', 'The greeting I should use.') plugin.run() ``` -------------------------------- ### Install multiple plugins using reckless Source: https://github.com/elementsproject/lightning/blob/master/doc/reckless.7.md Use this command to install multiple plugins by providing an array of plugin names as the target/subcommand. This command installs 'summars' and 'currecyrate'. ```shell lightning-cli reckless -k "command"="install" "target/subcommand"='["summars", "currecyrate"]' ``` ```json { "id": "example:reckless#2", "method": "reckless", "params": { "command": "install", "target/subcommand": [ "summars", "currecyrate" ] } } ``` ```json { "result": [ "/tmp/l1/reckless/summars", "/tmp/l1/reckless/currencyrate" ], "log": [ "DEBUG: Searching for summars", "DEBUG: fetching from gh API: https://api.github.com/repos/lightningd/plugins/contents/", "DEBUG: fetching from gh API: https://api.github.com/repos/lightningd/plugins/git/trees/294f93d7060799439c994daa84f534c4d1458325", "INFO: found summars in source: https://github.com/lightningd/plugins", "DEBUG: entry: None", "DEBUG: sub-directory: summars", "DEBUG: Retrieving summars from https://github.com/lightningd/plugins", "DEBUG: Install requested from InstInfo(summars, https://github.com/lightningd/plugins, None, None, None, summars).", "INFO: cloning Source.GITHUB_REPO InstInfo(summars, https://github.com/lightningd/plugins, None, None, None, summars)", "DEBUG: cloned_src: InstInfo(summars, /tmp/reckless-726255950dyifh_fh/clone, None, Cargo.toml, Cargo.toml, summars/summars)", "DEBUG: using latest commit of default branch", "DEBUG: checked out HEAD: 5e449468bd57db7d0f33178fe0dc867e0da94133", "DEBUG: using installer rust", "DEBUG: creating /tmp/l1/reckless/summars", "DEBUG: creating /tmp/l1/reckless/summars/source", "DEBUG: copying /tmp/reckless-726255950dyifh_fh/clone/summars/summars tree to /tmp/l1/reckless/summars/source/summars", "DEBUG: linking source /tmp/l1/reckless/summars/source/summars/Cargo.toml to /tmp/l1/reckless/summars/Cargo.toml", "DEBUG: InstInfo(summars, /tmp/l1/reckless/summars, None, Cargo.toml, Cargo.toml, source/summars)", "DEBUG: cargo installing from /tmp/l1/reckless/summars/source/summars", "DEBUG: rust project compiled successfully", "INFO: plugin installed: /tmp/l1/reckless/summars", "DEBUG: activating summars", "INFO: summars enabled", "DEBUG: Searching for currencyrate", "DEBUG: fetching from gh API: https://api.github.com/repos/lightningd/plugins/contents/", "DEBUG: fetching from gh API: https://api.github.com/repos/lightningd/plugins/git/trees/294f93d7060799439c994daa84f534c4d1458325", "INFO: found currencyrate in source: https://github.com/lightningd/plugins" ] } ``` -------------------------------- ### List available commands Source: https://github.com/elementsproject/lightning/blob/master/doc/lightning-cli.1.md Use the 'help' command to list all available commands for the lightning daemon. ```bash lightning-cli help ``` -------------------------------- ### Source startup_regtest.sh script Source: https://github.com/elementsproject/lightning/blob/master/doc/developers-guide/developers-guide.md Load the `startup_regtest.sh` script using `source` to set up necessary aliases for simulating the Lightning Network locally. ```shell source startup_regtest.sh ``` -------------------------------- ### Install pytest-trackflaky with pip Source: https://github.com/elementsproject/lightning/blob/master/contrib/pytest-trackflaky/README.md Install the plugin in editable mode using pip. This is useful for local development. ```bash pip install -e contrib/pytest-trackflaky ``` -------------------------------- ### Launch Nix-Shell for Core Lightning Development Environment Source: https://github.com/elementsproject/lightning/blob/master/doc/getting-started/getting-started/installation.md Starts a nix-shell with all necessary development tools and dependencies for Core Lightning, then runs the configure script and poetry shell. ```shell nix-shell -Q -p gdb sqlite autoconf git clang libtool sqlite autoconf autogen automake gmp zlib gettext libsodium poetry 'python3.withPackages (p: [p.bitcoinlib])' valgrind --run "./configure && poetry shell" poetry install make ``` -------------------------------- ### Basic Plugin Structure with pyln-client Source: https://github.com/elementsproject/lightning/blob/master/contrib/pyln-client/README.md A simple plugin demonstrating how to define methods, handle initialization, subscribe to events, and set options using the pyln.client.Plugin class. ```python #!/usr/bin/env python3 from pyln.client import Plugin plugin = Plugin() @plugin.method("hello") def hello(plugin, name="world"): """This is the documentation string for the hello-function. It gets reported as the description when registering the function as a method with `lightningd`. If this returns (a dict), that's the JSON "result" returned. If it raises an exception, that causes a JSON "error" return (raising pyln.client.RpcException allows finer control over the return). """ greeting = plugin.get_option('greeting') s = '{} {}'.format(greeting, name) plugin.log(s) return s @plugin.init() def init(options, configuration, plugin): plugin.log("Plugin helloworld.py initialized") # This can also return {'disabled': } to self-disable, # but normally it returns None. @plugin.subscribe("connect") def on_connect(plugin, connect, **kwargs): plugin.log("Received connect event for peer {}".format(connect)) plugin.add_option('greeting', 'Hello', 'The greeting I should use.') plugin.run() ``` -------------------------------- ### Manually Regenerate Specific RPC Examples Source: https://github.com/elementsproject/lightning/blob/master/doc/contribute-to-core-lightning/coding-style-guidelines/writing-json-schemas.md This command regenerates examples only for specified RPC methods by setting the `REGENERATE` environment variable. It also includes flags for disabling valgrind, setting a timeout, enabling debug mode, and generating examples. ```bash REGENERATE='getinfo,connect' VALGRIND=0 TIMEOUT=10 TEST_DEBUG=1 GENERATE_EXAMPLES=1 pytest -vvv -s tests/autogenerate-rpc-examples.py ``` -------------------------------- ### Install SQLite on macOS Source: https://github.com/elementsproject/lightning/blob/master/doc/getting-started/getting-started/installation.md Installs SQLite if needed, typically to resolve build errors related to SQLite mismatches. ```shell brew install sqlite ``` -------------------------------- ### Verify PostgreSQL Installation Source: https://github.com/elementsproject/lightning/blob/master/doc/beginners-guide/backup-and-recovery/advanced-db-backup.md Check if PostgreSQL development files are installed by verifying the output of `pg_config --includedir`. ```shell pg_config --includedir ``` -------------------------------- ### Install pytest-trackflaky with uv Source: https://github.com/elementsproject/lightning/blob/master/contrib/pytest-trackflaky/README.md Install the plugin in editable mode using uv. This is an alternative to pip for package management. ```bash uv pip install -e contrib/pytest-trackflaky ``` -------------------------------- ### Install Arch Linux Dependencies Source: https://github.com/elementsproject/lightning/blob/master/doc/getting-started/getting-started/installation.md Installs essential build tools and Python packages for Core Lightning on Arch Linux. ```shell pacman --sync autoconf automake gcc git make python-pip pip install --user poetry ``` -------------------------------- ### Run Core Lightning and Bitcoin Daemon Source: https://github.com/elementsproject/lightning/blob/master/doc/getting-started/getting-started/installation.md Starts the Bitcoin daemon in the background, followed by the Core Lightning daemon, and then displays the help command for lightning-cli. ```shell bitcoind & ./lightningd/lightningd & ./cli/lightning-cli help ``` -------------------------------- ### Install Tor on Debian-based systems Source: https://github.com/elementsproject/lightning/blob/master/doc/getting-started/advanced-setup/tor.md Use this command to install the Tor package on Debian, Ubuntu, and similar Linux distributions. ```shell sudo apt install tor ``` -------------------------------- ### Reproduce Release Locally and Sign Checksums Source: https://github.com/elementsproject/lightning/blob/master/doc/contribute-to-core-lightning/release-checklist.md Locally reproduce the release build for specified platforms and sign the resulting SHA256SUMS file with your GPG key. ```bash tools/build-release.sh bin-Fedora bin-Ubuntu sign ``` -------------------------------- ### Setup QEMU for Multiarch Binaries Source: https://github.com/elementsproject/lightning/blob/master/doc/contribute-to-core-lightning/docker-images.md Configure QEMU to run binaries from multiple architectures within Docker. This command resets QEMU and enables it for multi-architecture support. It requires privileged access. ```shell docker run --rm --privileged multiarch/qemu-user-static --reset -p yes ``` -------------------------------- ### Clone and Initialize Core Lightning for Alpine Source: https://github.com/elementsproject/lightning/blob/master/doc/getting-started/getting-started/installation.md Clone the Core Lightning repository and initialize its submodules to prepare for building on Alpine Linux. ```shell git clone https://github.com/ElementsProject/lightning.git cd lightning git submodule update --init --recursive ``` -------------------------------- ### Install macOS Intel Dependencies Source: https://github.com/elementsproject/lightning/blob/master/doc/getting-started/getting-started/installation.md Installs necessary build dependencies using Homebrew and sets environment variables for macOS Intel. ```shell brew install autoconf automake libtool python3 gnu-sed gettext libsodium protobuf lowdown pkgconf openssl make export PATH="/usr/local/opt/:$PATH" export CPATH=/usr/local/include export LIBRARY_PATH=/usr/local/lib ``` -------------------------------- ### Install uv Python Dependency Manager Source: https://github.com/elementsproject/lightning/blob/master/doc/getting-started/getting-started/installation.md Installs uv, a fast Python package and virtual environment manager, using a curl script. ```shell curl -LsSf https://astral.sh/uv/install.sh | sh ``` -------------------------------- ### Install Rust via rustup Source: https://github.com/elementsproject/lightning/blob/master/doc/getting-started/getting-started/installation.md Installs Rust using rustup, which is required for Cargo lockfile v4 support. The environment variables are then sourced. ```shell curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh source $HOME/.cargo/env ``` -------------------------------- ### Install Additional Development Dependencies for Core Lightning Source: https://github.com/elementsproject/lightning/blob/master/doc/getting-started/getting-started/installation.md Installs extra packages required for development and running tests, including valgrind and libpq-dev. ```shell sudo apt-get install -y valgrind libpq-dev shellcheck cppcheck libsecp256k1-dev lowdown ``` -------------------------------- ### Fund a channel with specific parameters Source: https://github.com/elementsproject/lightning/blob/master/doc/lightning-cli.1.md Example of funding a channel with a specified amount and minimum confirmations, using keyword arguments for clarity. Ensure the peer ID and amount are correctly formatted. ```bash lightning-cli --keywords fundchannel id=028f...ae7d amount=10000sat minconf=0 ``` -------------------------------- ### Initialize backup with NFS mount Source: https://github.com/elementsproject/lightning/blob/master/doc/beginners-guide/backup-and-recovery/advanced-db-backup.md Initializes a backup of the Lightning node database to a specified file path on an NFS mount. Ensure the `backup` plugin and its dependencies are installed. ```bash /path/to/backup-cli init --lightning-dir ${LIGHTNINGDIR} file:///path/to/nfs/mount/file.bkp ``` -------------------------------- ### Example of filtering listtransactions output Source: https://github.com/elementsproject/lightning/blob/master/doc/lightningd-rpc.7.md This example shows how to use the 'filter' member to request only specific fields, such as 'amount_msat' and 'type' from the 'outputs' of transactions. ```json "filter": {"transactions": [{"outputs": [{"amount_msat": true, "type": true}]}]} ``` -------------------------------- ### Build Core Lightning for Production Source: https://github.com/elementsproject/lightning/blob/master/doc/getting-started/getting-started/installation.md Builds Core Lightning for production use, synchronizing dependencies, configuring the build, and installing the binaries. ```shell uv sync --all-extras --all-groups --frozen ./configure RUST_PROFILE=release uv run make sudo RUST_PROFILE=release make install ```