Bitcoin in Practice

Run a Lightning node (Core Lightning)

You’ve seen how the Lightning Network works and how to use it — now let’s run the machinery yourself, so you can route payments and depend on no one. Core Lightning (CLN) is one of the main implementations — lean, spec-compliant, and built around plugins. It rides on the fully-verifying Bitcoin node you set up earlier.

How it fits together

A Lightning node (lightningd) sits on top of a Bitcoin node. It watches the chain through your bitcoind, holds its own on-chain wallet to fund channels, and talks the Lightning protocol to other nodes. So the prerequisite is the node you just built — ideally NOT pruned, because Lightning sometimes needs to fetch older blocks to verify and enforce channels.

Install Core Lightning

A few routes, easiest first:

  • Turnkey. Umbrel, Start9, RaspiBlitz and myNode can install and manage CLN for you.
  • Release binaries. Download the .deb packages for your Ubuntu/Debian version from the Core Lightning releases page (and verify them, as with Bitcoin Core).
  • From source. The most control — install the build dependencies, then compile:
# Build from source (Debian/Ubuntu)
sudo apt install -y git build-essential libsqlite3-dev python3 python3-pip \
     net-tools zlib1g-dev libsodium-dev gettext
git clone https://github.com/ElementsProject/lightning.git
cd lightning
./configure
make            # this takes a while
sudo make install

How CLN talks to bitcoind

Core Lightning reaches your Bitcoin node over RPC. You can give it the RPC username and password directly, OR point it at bitcoind’s data directory so it reads the auto-generated .cookie file instead (no password in your Lightning config at all). CLN polls bitcoind over RPC — unlike some implementations, it does not need ZeroMQ.

The configuration file

CLN reads ~/.lightning/config for global settings, plus a per-network file at ~/.lightning/bitcoin/config for mainnet. Here’s an annotated starting config:

# ~/.lightning/config

# --- Which network ---
network=bitcoin        # mainnet. Use testnet / signet / regtest to practise first — strongly recommended.

# --- Reach your Bitcoin Core node ---
bitcoin-rpcconnect=127.0.0.1   # where bitcoind is
bitcoin-rpcport=8332           # bitcoind’s RPC port
bitcoin-rpcuser=alice          # must match bitcoin.conf …
bitcoin-rpcpassword=change-me  # … or delete both and use the cookie instead:
# bitcoin-datadir=/home/alice/.bitcoin   # read bitcoind’s .cookie file — no user/password needed

# --- Node identity (shown on network explorers) ---
alias=my-cln-node      # a friendly name, up to 32 characters
rgb=1a4eff             # your node’s colour, as a hex code

# --- Where to listen and what to announce ---
addr=127.0.0.1:9735    # listen locally (a private node). For a PUBLIC node, announce a reachable address:
# announce-addr=YOUR.PUBLIC.IP:9735   # tell the network where to find you (forward port 9735)
#
#   Better for privacy — run over Tor (no port-forwarding, hides your IP):
# proxy=127.0.0.1:9050            # send outbound traffic through Tor’s SOCKS proxy
# addr=statictor:127.0.0.1:9051   # create a stable .onion address and announce it (Tor control port)
# always-use-proxy=true

# --- Logging ---
log-level=info         # io · debug · info · unusual · broken
log-file=/home/alice/.lightning/lightningd.log

# --- REST API (the bundled clnrest plugin — lets apps/mobile wallets control your node) ---
# clnrest-port=3010
# clnrest-protocol=https

# --- Fees you charge to forward other people’s payments through your channels ---
# fee-base=1000       # flat fee per forward, in millisatoshis
# fee-per-satoshi=1   # proportional fee, in parts-per-million

Practise on a test network first. Set network=regtest or network=signet and open channels with worthless coins until the commands feel natural. Real Lightning channels lock up real bitcoin, and mistakes on mainnet cost money.

First run and your first channel

lightningd --network=bitcoin     # start it (reads the config above)
lightning-cli getinfo            # your node id, alias, and whether it’s in sync

lightning-cli newaddr            # get an on-chain address, then send it some bitcoin to fund channels
lightning-cli connect NODE_ID@HOST:9735            # connect to a peer
lightning-cli fundchannel NODE_ID 1000000          # open a 1,000,000-sat channel with them

Once the funding transaction confirms, the channel is open — and payments across it are instant and cost a fraction of a satoshi. You’re now running your own money: a full node enforcing the rules, and a Lightning node moving value at the speed of the internet.

That’s the whole stack, end to end — from a private key to a self-sovereign payment network you operate yourself. Before the final habits that keep it all safe, three grown-up matters most guides skip: your privacy, your heirs, and the taxman. Privacy first.

Key takeaways

  • The Lightning Network is a layer on top of Bitcoin: open a payment channel and send unlimited instant, near-free payments, settling on-chain only when you close it.
  • Core Lightning (lightningd) runs on top of your Bitcoin node, connecting to bitcoind over RPC (username/password, or its .cookie file); an unpruned node is recommended.

Check yourself

What does the Lightning Network solve?

How does Core Lightning talk to your Bitcoin node?

Spotted an error or have feedback on this lesson? Suggest a correction ↗

Comments

Powered by Nostr — reply from any Nostr client, and zap the lesson over Lightning.