Skip to navigation
DigitalOcean Referral Badge

Get $200 credit on DigitalOcean

Hostinger logo

Hostinger: Lightning-fast hosting, unbeatable uptime, top-notch support!

Open extra topbar

lnd Wallet Adapter extension

Connect to an lnd node, and perform transactions on the Bitcoin Lightning network.

This is a Wallet Adapter for Bitcoin and Altcoin Wallets version 6.1.4 or later. Wallet adapters connect the plugin with various wallet APIs. Use this adapter to connect to an lnd node. lnd is a Lightning wallet implementation from Lightning labs.



  • admin can
    • connect to an lnd wallet
      • view version of lnd implementation
      • view public key of connected lnd node
      • view synced block height of lnd node
      • view connectivity errors
      • view inbound and outbound liquidity of node
      • view connected peers count
      • view active channels count
    • attach a currency to the lnd wallet
    • use shortcodes to add a frontend UI to
      • let users deposit funds via Layer 2 invoice
      • let users pay for other things besides deposits via Layer 2 invoice
        • attach PHP code to successful custom payment
      • let users withdraw from their balance to an external invoice
    • modify the messages of the frontend UIs using WordPress filters
  • user can
    • deposit funds on Layer 1 using the [wallets_deposit] UI (this uses passthrough to bitcoin-core backend through the lnd REST API)
    • deposit funds on Layer 2 using the [wallets_lnd_deposit] UI
      • user sees whether payment was successful via UI polling
    • pay for custom PHP actions on Layer 2 using the [wallets_lnd_deposit] UI
      • user sees whether payment was successful via UI polling
    • withdraw funds on Layer 1 using the [wallets_withdraw] UI (this uses passthrough to bitcoin-core backend through the lnd REST API)
    • withdraw funds on Layer 2 using the [wallets_lnd_withdraw] UI
      • user can optionally use a mobile device’s camera to scan an LNURL payreq


This extension connects directly to an LND wallet.

A few things to note before installation:

  • An LND node has multiple options for the wallet backend:
    • A full Bitcoin core node. This takes up a lot of disk space on your server.
    • A lightweight Neutrino wallet. This backend is built in to LND, and does not use a lot of disk space because it does not store the blockchain locally.
    • Btcd
  • An LND node can connect to:
    • Bitcoin
    • Litecoin
  • Modified LND wallets can work with :
    • Decred
    • Vertcoin
    • etc.
  • It is possible, but not recommended to install lnd on its own. In most cases you want to install Lightning Terminal. This is a bundle of software from Lightning Labs which includes LND and also Loop, Pool, and Faraday. These are additional software for managing the wallet via a graphical web interface, and for managing channels. If you only install lnd, you will have to manage your channels from the command line, and this is very much harder.
  • The wallet adapter connects to LND via its REST API. It does not use the gRPC interface.
  • You should study the Builder’s guide to LND, including how to backup your wallet in case your node crashes.

Installing Lightning Terminal

Complete installations instructions for the Lightning Terminal are here:

We are going to install the binary bundle. The bundle includes all the daemons we need:

1 Connect via SSH to your server

2 Ensure that you have tar and wget installed. Run the following command:

sudo apt install tar wget

3 Go to

4 Select the release that’s suitable for your architecture. To find out your CPU’s architecture, use lscpu:

$ lscpu | fgrep -i Architecture
Architecture:                    x86_64

In this case we will select the latest linux-amd64 build.

As of writing these instructions, the latest is v.0.10.1-alpha. Let’s download it to our home directory.

5 Use wget to download the right binary, in this case lightning-terminal-linux-amd64-v0.10.1-alpha.tar.gz:


6 Once downloading completes, extract it with:

tar xfv lightning-terminal-linux-amd64-v0.10.1-alpha.tar.gz

7 Install all the binaries to /usr/local/bin with:

sudo cp lightning-terminal-linux-amd64-v0.10.1-alpha/* /usr/local/bin

Once the binaries are installed, you may delete the downloaded tar file and this directory to save space on your server:

rm -rf lightning-terminal-linux-amd64-v0.10.1-alpha.tar.gz lightning-terminal-linux-amd64-v0.10.1-alpha

8 Create a new configuration file lit.conf for lit (the Lightning terminal bundle).

An example config for ~/.lnd/lnd.conf lnd is here:

Do NOT create this file on your server. We are NOT going to run lnd independently. Instead, we will create a config for litd, the software bundle:

mkdir ~/.lit && touch ~/.lit/lit.conf

The litd config can include configs for lnd, loop, pool, etc, but all lines must be prefixed with the name of the daemon they are for.

The documentation for the lnd config is at:

For example: If you want to use the setting which activates Bitcoin, you would enter the following to ~/.lit/lit.conf:

Note the lnd. prefix above, which indicates that this ~/.lit/lit.conf line is for lnd.

9 Edit the ~/.lit/lit.conf file with your favorite text editor. Create a typical config for litd using the following example settings:








Don’t forget to enter a strong password for the web interface.

10 You can optionally configure Tor for your node.

Follow the instructions to first install Tor, then configure Tor for use with LND. You may end up adding something like the following to your lit.conf:

Again, note the lnd. prefix for setting tor settings.

11 You should not simply run litd from the command line. Instead, create a service for it. Assuming your Linux installation uses systemv, create a new unit file:

sudo touch /etc/systemd/system/litd.service

12 Use your favorite text editor with sudo to fill the file with the following contents:

Description=Lightning Terminal Network Daemon

ExecStop=/usr/local/bin/lncli --network=mainnet stop

​# Replace these with the user:group that will run lnd


​# Try restarting lnd if it stops due to a failure


​# Type=notify is required for lnd to notify systemd when it is ready


​# An extended timeout period is needed to allow for database compaction
​# and other time intensive operations during startup. We also extend the
​# stop timeout to ensure graceful shutdowns of lnd.


​# Hardening Measures
​# Mount /usr, /boot/ and /etc read-only for the process.


​# Disallow the process and all of its children to gain
​# new privileges through execve().


​# Use a new /dev namespace only populated with API pseudo devices
​# such as /dev/null, /dev/zero and /dev/random.


​# Deny the creation of writable and executable memory mappings.



13 Next, enable this unit with:

sudo systemctl enable litd.service

14 Now you can start the service with:

systemctl restart litd.service

Or, alternatively with:

sudo service litd restart

15 Check to see the status of the service. The service should be shown as active (running). You may see something like:

$ sudo service litd status
● litd.service - Lightning Terminal Network Daemon
     Loaded: loaded (/etc/systemd/system/litd.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2023-07-11 16:02:51 EEST; 1min 12s ago
   Main PID: 2081 (litd)
     Status: "Wallet locked"
      Tasks: 8 (limit: 2324)
     Memory: 97.9M
        CPU: 7.073s
     CGroup: /system.slice/litd.service
             └─2081 /usr/local/bin/litd

Press q to exit from the service status.

16 If you want to view the logs for lnd, do the following in another terminal:

tail -f ~/.lnd/logs/bitcoin/mainnet/lnd.log

If you have installed litd with a Neutrino backend, the logs should indicate that lnd is downloading “cfheaders filters”.

17 You should now create a new wallet with:

lncli create

Make sure to write down the seed somewhere safe.

This command has created a new LND wallet at ~/.lnd/data/chain/bitcoin/mainnet/wallet.db.

In the same directory, you will find several *.macaroon files.

Macaroons are authentication credentials similar to cookies that were developed by Google. Macaroon files are used to give access to parts of the LND API. To learn more about LND macaroons, see:

The macaroons are bearer access tokens which give various types of access to your LND wallet. The most permissive macaroon is the admin.macaroon, giving full access to your wallet.

18 Now that a wallet is created, you can use it’s password to unlock it. You must do this manually every time the litd service restarts. For example, if the server restarts, then the litd service will also restart. This is done to ensure that the password for the wallet file is not stored on server.

Unlock the wallet with:

lncli unlock

and enter your wallet password.

You should see:

$ lncli unlock
Input wallet password: 

lnd successfully unlocked!

19 Once you see in the logs:

2023-07-11 16:29:21.168 [INF] LNDC: Waiting for lnd to be fully synced to its chain backend, this might take a while

This means that your wallet is syncing and is not yet ready for use.

While syncing is in progress, we can proceed to connect the wallet to the plugin.

20 After the wallet is unlocked we can run the getinfo command via the command line to see our node’s public key and other information:

lncli getinfo

We can also visit the following URL to enter the graphical interface:

Where should be replaced with the domain name or IP of your wallet server.

If the browser complains about a missing certificate, you can ignore the warning and proceed. If you wish to install the TLS certificate, it is located in ~/.lit/tls.cert.

Use the uipassword that you specified in ~/.lit/lit.conf to login to the UI.

21 Now proceed to Connect to Terminal. Use the Terminal to open channels to the Lightning network.

How you do this is beyond the scope of this article. A good place to start reading about this is:

Installing the lnd Wallet adapter

22 You must install the adapter on a server that has the php-curl module installed and activated. If necessary, you can do the following on the WordPress server:

sudo apt update
sudo apt install php-curl

You should then restart your webserver with sudo service nginx restart or sudo service apache2 restart.

23 Download the latest version of the wallet adapter, from:

24 Login to your WordPress installation where Bitcoin & Altcoin Wallets is already installed, and go to: PluginsAdd newUpload Plugin.

25 Upload the wallet adapter .zip file and activate it.

26 If you are installing Lightning to use with Bitcoin and you already have a wallet for Bitcoin core, you should probably disable the existing wallet.

Similarly, if you are using Bitcoin with the CoinPayments wallet, then remove Bitcoin from your adapter.

This is not strictly necessary, but you likely want to use both Layer1 and Layer2 for Bitcoin via the lnd wallet.

27 Go to WalletsAdd new to create a new Lightning wallet.

28 Enter a title such as “Bitcoin mainnet lnd node”.

29 Set the Wallet adapter for this wallet to DSWallets\LND_Wallet_Adapter.

30 Set the wallet to Enabled and hit the Update button. Fields for the settings that are specific to this adapter will appear.

31 Enter the hostname or IP address to the server running litd.

32 Enter the port number for the REST API, which should be 8080 by default.

33 Bake a new macaroon with the right permissions and enter it to the wallet adapter settings in the Macaroon in hex field. Macaroons are fancy cookies. Think of them as access tokens, similar to cookies. They are long strings of bytes, encoded as hex strings, that give to the bearer of the token access to various endpoints.

You could enter the contents of the admin.macaroon for testing purposes. You can view your admin macaroon as hex with the following command:

xxd -p ~/.lnd/data/chain/bitcoin/mainnet/admin.macaroon | tr -d '\n'

This will make the adapter work. HOWEVER, the admin macaroon is way too permissive, and it is NOT recommended that you use it.

To enhance security, you should bake a new macaroon that allows access only to the REST API endpoints that are used by the adapter. Also, you can restrict the macaroon to be valid only when used from your WordPress IP address.

Here’s the command to bake a more restrictive macaroon (replace with the public IP address of your WordPress site):

lncli bakemacaroon \
    --ip_address \
    uri:/invoicesrpc.Invoices/LookupInvoiceV2 \
    uri:/lnrpc.Lightning/AddInvoice \
    uri:/lnrpc.Lightning/DecodePayReq \
    uri:/lnrpc.Lightning/GetInfo \
    uri:/lnrpc.Lightning/GetTransactions \
    uri:/lnrpc.Lightning/ListInvoices \
    uri:/lnrpc.Lightning/NewAddress \
    uri:/lnrpc.Lightning/SendCoins \
    uri:/lnrpc.Lightning/SendMany \
    uri:/lnrpc.Lightning/SendPaymentSync \
    uri:/lnrpc.Lightning/WalletBalance \
    uri:/lnrpc.Lightning/ChannelBalance \
    uri:/lnrpc.Lightning/QueryRoutes \

This command will print out a long hex string that represents all the permissions we need, plus the IP address filter. Enter this hex sting into the Macaroon in hex field. This gives to the wallet adapter access to the endpoints it needs and no others. Even if a hacker were to obtain this macaroon, it cannot be used to access your wallet from other IP addresses.

35 Enter your TLS certificate for this node and wallet. To find out your public certificate, run this command:

cat ~/.lit/tlc.cert

36 Leave the remaining settings as they are. Hit the Update button.

37 Check the right hand of the screen, under the metabox titled DSWallets\LND_Wallet_Adapter. If the adapter is connected, you should be seeing information about your node. If there is a proble, you will see an error message in red text.

38 If you already have a Bitcoin currency, re-attach it to the new LND wallet. If not, create a new Bitcoin currency and attach it to this wallet.

39 You should be good to go. Proceed to study the adapter’s shortcodes to use the adapter.

That’s it!


This is a free plugin extension available to all subscribers.

This extension requires Bitcoin and Altcoin Wallets version 6.1.4 or later. You cannot use it with previous versions of the parent plugin.

Subscribe for free and get access to all the wallet adapters.


As of Bitcoin and Altcoin Wallets version 6.0.0, the documentation can be accessed from the WordPress admin screens. Look for Wallets Admin Docs in the Admin menu.

Note that the documentation is only shown to administrators (users with the manage_wallets capability).

Previous versions of the plugin and its extensions had documentation in the form of an accompanying PDF file. This has now been replaced with markdown files placed in the source code directories of each component.


Please use the appropriate support forum:

You are welcome to send in any problems, questions, suggestions, thoughts, etc.

For all other communication, such as questions and issues regarding membership, you can email me.

lnd Wallet Adapter extension

Updated on 2023-08-24T11:36:27+00:00, by alexg.