Skip to main content

Clone the source code locally

tip

You have several ways of doing this:

  • Clone via HTTPS
  • Clone via SSH
  • Download via Github CLI
  • Download the zip package from the repository

We recommend HTTPS because it is the easiest to set up in the wild, and by users who are new to all this. Although, we strongly recommend using an SSH connection when interacting with GitHub. If you are to this and are interested read more about it here.

git clone -b testnet-alpha-1 https://github.com/fleek-network/lightning.git <DIRECTORY-NAME>

At time of writing, we are checking the branch name testnet-alpha-1 that corresponds to the testnet phase. Here's an example of what it'd look like when sticking to the recommended path location:

git clone -b testnet-alpha-1 https://github.com/fleek-network/lightning.git ~/fleek-network/lightning

Change directory to Lightning source code

cd ~/fleek-network/lightning

Install Docker

tip

We're using Ubuntu Linux. You'll have to make the required tweaks for your preferred Linux Distro. Find the list of support operating systems here.

sudo apt update

Next, install the required packages to let apt use packages over HTTPS:

sudo apt install \
apt-transport-https \
ca-certificates \
software-properties-common

Add the GPG key for the official Docker repository to your system:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

Add the Docker repository to apt sources and update the package database with the Docker packages from the new added repository:

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu jammy stable"

Set to install from the Docker repo instead of the default Ubuntu repo:

apt-cache policy docker-ce

Finally, install Docker:

sudo apt install docker-ce

Once complete you should be able to run it via the CLI, as such:

docker -v

Here's the output (versions might differ a bit from the time of writing):

Docker version 24.0.6, build ed223bc

Docker setup verification

The following command's output will indicate if Docker's working correctly:

sudo docker run hello-world

You should get a "Hello from Docker!".

Check the Dockerfile

You should have changed directory to the projecto directory.

If you run a cat Dockerfile, you should have content similar to:

FROM rust:latest as builder
ARG PROFILE=release
WORKDIR /lightning

RUN apt-get update
RUN apt-get install -y \
build-essential \
cmake \
clang \
pkg-config \
libssl-dev \
gcc \
protobuf-compiler

...

Build the Docker image

Build the image named as lightning from our Dockerfile:

sudo docker build -t lightning -f ./Dockerfile .

Docker Container

Create ~/.lightning configuration directory:

mkdir $HOME/.lightning

Run the lightning-node container:

sudo docker run \
-e OPT="in" \
-p 4200-4299:4200-4299 \
-p 4300-4399:4300-4399 \
--mount type=bind,source=$HOME/.lightning,target=/home/lgtn/.lightning \
--mount type=bind,source=/var/tmp,target=/var/tmp \
--name lightning-node \
-it lightning
info

Provide one of the following options "in" or "out" to opt-in or opt-out of network participation, otherwise it'll default to "in". To learn more about network participation control read the section Lightning CLI Opt.

Generate keys

sudo docker exec -it lightning-node lgtn keys generate

View logs

To view the logs of a Docker container in real time, use the following command:

sudo docker logs -f lightning-node
Helder Oliveira
Helder OliveiraSoftware Developer + DXGot questions? Find us on discord!