Loop

Time: 5 minutes

To balance channels you have several tools, Loop is one such tool.

Supplies

  • Golang # (update to the latest version before you start).

Installation

First, go to your home directory.

cd ~

Download the source code.

git clone https://github.com/lightninglabs/loop

Enter the directory.

cd loop

Grab the latest version/tag/release.

git checkout v0.19.1-beta

Go to run/cmd.

cd loop/cmd

Install the loopd software.

go install ./...

Test if it succeeded by temporarily starting Loop.

loopd

In the output you will read that Loop is connected to your LND and with Ctrl + C you can stop loopd again.

In addition to the Loop program, a CLI is also installed. You can check it with loop --version.

Firewall

You can access Loop from the outside on two different ports.

sudo ufw allow 8081 comment "Port for REST API of Loop"
sudo ufw allow 11010 comment "Port for RPC from Loop"

Automation

If you want to run Loop in the background you need another service.

sudo nano /etc/systemd/system/loop.service

Paste this in.

[Unit]
Description=Loop
Requires=bitcoind.service
Requires=lnd.service
After=bitcoind.service
After=lnd.service
[Service]
User=ubuntu
ExecStart=/home/ubuntu/go/bin/loopd
Restart=always
TimeoutSec=120
RestartSec=30
[Install]
WantedBy=multi-user.target

Save the changes with Ctrl + X and confirm with Y.

Notify the system of the new service.

sudo systemctl enable loop

Start the loop service as follows.

sudo systemctl start loop

If you want to see if the service was started, run this.

systemctl status loop

If you want a view of the status across multiple sessions, use this command.

sudo journalctl -f -u loop

Updating

Go to the application directory.

cd ~/loop

Update the repository with the latest changes via Git.

git fetch --all

Show the latest version/tag/release.

git describe --tags `git rev-list --tags --max-count=1`

Retrieve the changes from the latest release.

git checkout -f <OUTPUT FROM PREVIOUS STEP> #example v0.19.1-beta

Go to cmd.

cd cmd

Install the loopd software.

go install ./...

Restart the Loop and LiT services (if you have that running).

sudo systemctl restart loop
sudo systemctl restart lit