Was this page helpful?
Setup CLN Service
Configure Service
Configure the CLN service on the CLNHOST.
Add cln user and group:
sudo /usr/sbin/groupadd cln
sudo /usr/sbin/useradd -g cln -c "Core Lightning" -m cln
sudo adduser cln dialout # (`SERIAL` only)
sudo mkdir -p ~cln/.lightning
sudo chown -R cln:cln ~clnCreate a cln config file:
sudo -u cln bash << 'EOF'
cat > ~cln/.lightning/testnet-config << EOL
log-level=info
bitcoin-rpcuser=rpcuser
bitcoin-rpcpassword=6ffb57ab46aa726
bitcoin-rpcconnect=127.0.0.1
bitcoin-rpcport=18332
experimental-anchors
experimental-offers
EOL
EOFEdit the file, change the bitcoin-rpcpassword value to match your bitcoind-testnet.
sudo -u bitcoin grep rpcpassword ~bitcoin/.bitcoin/bitcoin.conf
sudo -u cln vi ~cln/.lightning/testnet-configAdd the following lines only if you are using SERIAL:
subdaemon=hsmd:remote_hsmd_serial
max-concurrent-htlcs=4Add the following line instead if you are using SOCKET:
subdaemon=hsmd:remote_hsmd_socketConfigure your firewall/router to forward an external port to the
CLHOST. Add the following lines to the config, the announce-addr
should be set to the external firewall address/port.
bind-addr=0.0.0.0:19735
announce-addr=23.93.101.158:19735
Create ~cln/.lightning/testnet-setenv:
sudo -u cln bash << 'EOF'
cat > ~cln/.lightning/testnet-setenv << EOL
VLS_PORT=17701
VLS_SERIAL_PORT=/dev/vls-stm32
VLS_NETWORK=testnet
# If your SOCKET signer is remote, have the proxy listen to all interfaces.
# Alternatively, set up a secure tunnel to the signer.
# VLS_BIND=0.0.0.0
BITCOIND_RPC_URL=http://rpcuser:6ffb57ab46aa726@localhost:18332
RUST_LOG=info
BITCOIND_CLIENT_TIMEOUT_SECS=60
# Dynamically set VLS_CLN_VERSION
VLS_CLN_VERSION=$(/usr/local/bin/lightningd --version)
export VLS_PORT VLS_SERIAL_PORT VLS_NETWORK BITCOIND_RPC_URL RUST_LOG BITCOIND_CLIENT_TIMEOUT_SECS VLS_CLN_VERSION VLS_BIND
EOL
EOFEdit the file, change the BITCOIND_RPC_URL value to match your bitcoind-testnet:
sudo -u bitcoin grep rpcpassword ~bitcoin/.bitcoin/bitcoin.conf
sudo -u cln vi ~cln/.lightning/testnet-setenvMake sure cln owns everything:
sudo chown -R cln:cln /home/cln/Install systemd unit file:
sudo cp ~/lightning-signer/vls-hsmd/vls/contrib/howto/assets/cln-testnet.service /etc/systemd/system/
sudo systemctl daemon-reloadInstall log rotation config file (edit to suit preferences):
sudo cp ~/lightning-signer/vls-hsmd/vls/contrib/howto/assets/cln-testnet.logrotate /etc/logrotate.d/cln-testnetEnable the service for automatic start on system boot:
sudo systemctl enable cln-testnetIf you want to start the service now:
sudo systemctl start cln-testnetView status:
sudo systemctl status cln-testnetView logs:
sudo journalctl --follow -u cln-testnetResources
Community
© 2025 VLS Developers