Lightning Loop is a non-custodial service offered by Lightning Labs to bridge on-chain and off-chain Bitcoin using submarine swaps. This repository is home to the Loop client and depends on the Lightning Network daemon lnd. All of lnd’s supported chain backends are fully supported when using the Loop client: Neutrino, Bitcoin Core, and btcd.
In the current iteration of the Loop software, only off-chain to on-chain exchanges are supported, where the Loop client sends funds off-chain in exchange for the funds back on-chain.
The service can be used in various situations:
Future iterations of the Loop software will also allow on-chain to off-chain swaps. These swaps can be useful for additional use-cases:
The Loop client is current in an early beta state, and offers a simple command line application. Future APIs will be added to support implementation or use of the Loop service.
LND and the loop client are using Go modules. Make sure that the
env variable is set to
In order to execute a swap, LND will need to be rebuilt with sub servers enabled.
make install tags="signrpc walletrpc chainrpc" to build and install lnd
with required sub-servers enabled.
Make sure there are no macaroons in the lnd dir
~/.lnd/data/chain/bitcoin/mainnet. If there are, lnd has been started
before and in that case, it could be that
admin.macaroon doesn't contain
signer permission. Stop lnd, delete
*.macaroon files, restart lnd to
regenerate them with the signer permission.
DO NOT DELETE
git clone https://github.com/lightninglabs/loop.git
go install ./...
Swaps are executed by a client daemon process. Run:
loopd attempts to connect to an lnd instance running on
localhost:10009 and reads the macaroon and tls certificate from
This can be altered using command line flags. See
loopd only listens on localhost and uses an unencrypted and unauthenticated
To initiate a swap, run:
loop out <amt_sat>
When the swap is initiated successfully,
loopd will see the process through.
To query and track the swap status, run
loop without arguments.
loopd is terminated (or killed) for whatever reason, it will pickup
pending swaps after a restart.
Information about pending swaps is stored persistently in the swap database.
Its location is
It is possible to execute multiple swaps simultaneously.