Docker Setup For Taproot Assets
Taproot Assets now supports transfers over the Lightning Network.
This is still experimental, and you're advised to only attempt it on Testnet.
You should start by reading the documentation for Taproot Assets.
PRELUDE TO DIRECTIONS, SET TO SOFT MUSIC
Some people might say -- why are you doing this in Docker? It's too complicated!
They might be right! But here is my reasoning.
To follow the rest of these directions, you must already have Docker and Docker Compose installed.
Assuming you are working on an Ubuntu or other debian distribution, you can follow these directions to install Docker and Docker Compose.
THE ACTUAL DIRECTIONS
- We assume you are starting with a parent folder:
workspace
1.25) We assume you're working on an Ubuntu machine or other Linux distro, or maybe a Mac if you really have to. Don't even think of trying this on Windows (unless you are very crafty with WSL and have experience running LND under WSL).
1.5) We assume you are already have a bitcoind testnet node running on your machine. One problem with Testnet is that it's nearly impossible now to get Testnet coins. Contact us if you're working on this an need us to send you some Testnet coins. Unfortunately, Taproot Assets is not compatible with "signets" like MutinyNet.
- Clone https://github.com/lightninglabs/lightning-terminal into
workspace
2.5) Now you should have the folder:
workspace/lightning-terminal
cd
into thelightning-terminal
folder (which you just cloned)... ... and check out the appropriate tag... ... right now it is v0.13.991-experimental ... but by the time you are reading this, it might be something else...
-
Make a new folder:
workspace/terminal
-
Make all these subfolders in workspace/terminal
workspace/terminal/.lit
workspace/terminal/.lnd
workspace/terminal/.tapd
workspace/terminal/go-bin
workspace/terminal/src
workspace/terminal/installers
-
Copy the
Dockerfile
anddocker-compose.yml
andlit-testnet.conf
from this page into theworkspace/terminal
folder -
Go into
workspace/terminal
and run this command to start the docker container, and runbash
in that container, so you'll be on the command line in the running container.docker compose -f docker-compose.yml run render-mainnet bash
-
You should now be on the command line in the docker container
-
Hopefully you should be at the path
/home/user/lightning-terminal
in the container -
Now you need to compile lightning terminal
-
Run these commands to compile the Go code into binaries...
make install
make go-install-cli
(you should see lots of console output... wait for a few minutes while the binaries are built)
- Now look in your
workspace/terminal/go-bin folder
.. you should see a bunch of compiled binaries.. ... note that there are separate binaries for lnd, litd, tapd, etc....
-
Type
exit
to leave the docker container -
Launch the docker compose with:
docker compose -f docker-compose.yml up
-
Litd should run automatically when you start the docker container like this. (You can see the
command:
line in the docker compose file, that is what launcheslitd
). -
In a new terminal window, "exec" into the running container with this command:
docker compose -f docker-compose.yml exec litd-testnet bash
16.5) You should on the commmand line in the container again now.
- Now comes the confusing part ;). You need to use three different binaries, with different flags, to do different things. You should experiment with these commands...
lncli commands
lncli --network testnet --rpcserver localhost:10011 --help
litcli commands
litcli --network testnet --tlscertpath /home/user/.lit/tls.cert --rpcserver localhost:8443 --macaroonpath /home/user/.lit/testnet/lit.macaroon --help
litcli commands if you need to do stuff with assets (this is confusing)
litcli --network testnet --tlscertpath /home/user/.lit/tls.cert --rpcserver localhost:8443 --macaroonpath /home/user/.lnd/data/chain/bitcoin/testnet/admin.macaroon --help
tapcli commands
tapcli --network testnet --tlscertpath /home/user/.lnd/tls.cert --rpcserver localhost:10011 --macaroonpath /home/user/.tapd/data/testnet/admin.macaroon --help
-
The first command you will need to run is:
lncli --network testnet --rpcserver localhost:10011 create
... this "create" command will create your LND wallet. Make sure to write down the seed! -
LND, TAPD, and LITD should all now be running, and you should be able to look in the corresponding data folders...
workspace/terminal/.lit
workspace/terminal/.lnd
workspace/terminal/.tapd
.... and you should see that TLS certificates and other necessary files have been created.
docker-compose.yml
services:
litd-testnet:
build:
context: .
dockerfile: Dockerfile
container_name: lit-testnet
volumes:
- type: bind
source: ../../lightning-terminal
target: /home/user/lightning-terminal
- type: bind
source: .lit
target: /home/user/.lit/
- type: bind
source: .tapd
target: /home/user/.tapd/
- type: bind
source: .lnd
target: /home/user/.lnd/
- type: bind
source: ./lit-testnet.conf
target: /home/user/.lit/lit.conf
- type: bind
source: ./go-bin
target: /home/user/lightning-terminal/bin
- type: bind
source: ./src
target: /src
- type: bind
source: ./installers
target: /installers
command: "litd"
environment:
- GOBIN=/home/user/lightning-terminal/bin
- PATH=/usr/local/go/bin:/home/user/lightning-terminal/bin:$PATH
network_mode: host
Dockerfile
FROM ubuntu:22.04
RUN apt-get update && apt-get install -y \
git \
make \
gcc \
bash \
jq \
ca-certificates \
gnupg \
curl \
sudo \
wget \
python3 \
python3-pip \
unzip
COPY ./installers /installers
RUN ls
RUN wget --no-clobber https://go.dev/dl/go1.22.5.linux-amd64.tar.gz -P /installers
WORKDIR /installers
RUN rm -rf /usr/local/go && tar -C /usr/local -xzf /installers/go1.22.5.linux-amd64.tar.gz \
&& rm -rf /installers
RUN apt-get update
RUN apt-get install -y ca-certificates curl gnupg
RUN mkdir -p /etc/apt/keyrings
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_18.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list
RUN apt-get update
RUN apt-get install nodejs -y
RUN npm install --global yarn
ENV PATH=$PATH:/usr/local/go/bin:/home/user/go/bin
RUN useradd -u 1000 user \
&& echo "user:password" | chpasswd \
&& adduser user sudo
# Grant permissions to the user
RUN mkdir -p /home/user/go/pkg \
&& chown -R user:user /home/user/go \
&& chmod -R 755 /home/user/go
RUN mkdir -p /home/user/.cache/go-build \
&& chown -R user:user /home/user/.cache
RUN chown -R user:user /home/user
USER user
WORKDIR /home/user/lightning-terminal
lit-testnet.conf
This is the configuration file for Litd. You can see that it is loaded in the docker-compose.yml file, above.
# LND mode integrated
lnd-mode=integrated
network=testnet
# UI password
uipassword=your_uipassword_here
# Bitcoin configuration for LND
lnd.alias=[PUT SOMETHING HERE]
lnd.bitcoin.active=1
lnd.bitcoin.node=bitcoind
lnd.bitcoind.rpchost=127.0.0.1:18332
lnd.bitcoind.rpcuser=david-foster-wallace
lnd.bitcoind.rpcpass=the-pale-king
lnd.bitcoind.zmqpubrawblock=tcp://127.0.0.1:29000
lnd.bitcoind.zmqpubrawtx=tcp://127.0.0.1:29001
lnd.bitcoin.testnet=true
# LND listen and debug settings
lnd.rpclisten=0.0.0.0:10011
lnd.accept-keysend=true
lnd.debuglevel=trace,GRPC=error,PEER=info,DISC=info,CMGR=info,BTCN=info
## lnd.externalip=[ADD THIS FOR EXTERNAL IP]
## lnd.listen=0.0.0.0:9736 [ADD THIS FOR EXTERNAL IP]
lnd.maxpendingchannels=10
lnd.norest=true
# LND protocol options
lnd.protocol.option-scid-alias=true
lnd.protocol.zero-conf=true
lnd.protocol.simple-taproot-chans=true
lnd.protocol.simple-taproot-overlay-chans=true
lnd.protocol.custom-message=17
## experimental taproot assets stuff
taproot-assets.experimental.rfq.priceoracleaddress=use_mock_price_oracle_service_promise_to_not_use_on_mainnet
taproot-assets.experimental.rfq.mockoracleassetsperbtc=698050000
What does taproot-assets.experimental.rfq.mockoracleassetsperbtc do?
This setting is related in a potentially confusing way to to concept of decimal_display
, which is a parameter you need to provide when minting an asset. It's critical you understand what decimal_display
does. Looking at this pull request can help: https://github.com/lightninglabs/taproot-assets/pull/1059
How Do I Know If I Have All The Binaries Installed?
Run the getinfo
commands with all three binaries....
Note -- instead of the full command, like
tapcli --network testnet --tlscertpath /home/user/.lnd/tls.cert --rpcserver localhost:10011 --macaroonpath /home/user/.tapd/data/testnet/admin.macaroon
... below you see that I am using shell scripts that run that same command and append to it any argument provided to the script... in the examples below, "getinfo" is appended.
user@aw60:/src$ ./litcli-testnet.sh getinfo
{
"version": "0.13.991-experimental commit=v0.13.991-experimental-dirty"
}
user@aw60:/src$ ./tapcli-testnet.sh getinfo
{
"version": "0.4.1-alpha commit=v0.4.1",
"lnd_version": "0.18.0-beta",
"network": "testnet3",
"lnd_identity_pubkey": "020c3b59b1854d31b94c0dd9df1019d251b4cd5565129f7ad16e3ec8c4671afd8c",
"node_alias": "Megalith Assets Testnet",
"block_height": 2871478,
"block_hash": "000000000000000c2868d2567b55d885ea1bd803d385a3d949d577a66c45bca0",
"sync_to_chain": true
}
user@aw60:/src$ ./lncli-testnet.sh getinfo
{
"version": "0.18.0-beta commit=lightning-terminal-v0.13.991-experimental-dirty",
"commit_hash": "3280923f3cb8e0ae10f5858b354e92ebdc37c51f",
"identity_pubkey": "020c3b59b1854d31b94c0dd9df1019d251b4cd5565129f7ad16e3ec8c4671afd8c",
"alias": "Megalith Assets Testnet",
"color": "#3399ff",
"num_pending_channels": 0,
"num_active_channels": 5,
"num_inactive_channels": 3,
"num_peers": 5,
"block_height": 2871478,
"block_hash": "000000000000000c2868d2567b55d885ea1bd803d385a3d949d577a66c45bca0",
"best_header_timestamp": "1722542222",
"synced_to_chain": true,
"synced_to_graph": true,
"testnet": true,
"chains": [
{
"chain": "bitcoin",
"network": "testnet"
}
],
"uris": [
"020c3b59b1854d31b94c0dd9df1019d251b4cd5565129f7ad16e3ec8c4671afd8c@164.90.144.205:9736"
],