Deployment diagram

Installation

Building the docker container on the local machine

Running the node

Creating a new Lightning wallet

Importing a VPN profile using the pritunl UI client



To use Xena Exchange dAccs, you have to deploy a Lightning node (forked by Xena Exchange) to your server. We recommend running the node in a docker container, although this is not mandatory.


Deployment diagram



Installation


  • Install Docker: Linux, Windows, Mac

  • Install pritunl (a VPN client): official documentation, all platforms

  • Contact us via Telegram https://t.me/xenasupport or drop us an email at support@xena.exchange to obtain the VPN configuration to access the Lightning and Bitcoin nodes.

    • The support team will respond with a link that must be passed to the pritunl client to set up the connection

  • If you prefer to use your local Bitcoin node, make sure your have one up and running (official bitcoind node: Linux, Windows, Mac)

    • The node is needed by the Lightning node just to observe the blockchain. It does not need to store the private keys of any wallets.

    • Note that the node will download the whole blockchain (> 200 Gb of data as of now, may take up to a week to download and sync before becoming operational)

  • Prepare a local directory that will be used as the data directory for the Lightning node (the keys of your Lightning wallet will be stored here, along with other information)

    • It’s advised to ensure the directory is backed up on a regular basis

    • If you have an existing backup, copy it into this directory. In this example, we will use “/local/mount/path”

  • Build a docker image or use an existing one https://hub.docker.com/r/xenaexchange/lnd

  • Set up and run the Xena Exchange Lightning node in the docker

  • CLI binaries for different platforms can be downloaded here: https://github.com/xenaex/daccs-cli/releases


Building the docker container on the local machine

  • Proceed to https://github.com/xenaex/lnd (the repository containing Xena Exchange’s Lightning fork)

  • Download the docker file and the docker-entrypoint.sh and build the docker container with yours Github credentials.


docker build --build-arg USER=<login> --build-arg PASS=<password> -t xenaexchange/lnd </path/with/downloaded_dockerfile_and_docker-entrypoint>


Running the node 


# docker run arguments:
# --name: name of the docker container
# -v: path-to the local Lightning data directory
# -p: expose the RPCaddress in order to use it in the dAccs client (--lnd-host argument)
# -d: name of the buildt lnd image to run
#
# lnd node arguments:
# --rpclisten: RPCaddress to listen to, will be exposed via a -p argument
# --tlsextraip: lnd node will generate a tls certificate for that address
# --bitcoin.active, --bitcoin.node=bitcoind, --bitcoin.mainnet: tells lnd node that we will use the Bitcoin Mainnet network through bitcoind implementation
# --bitcoind.rpchost, --bitcoind.rpcuser, --bitcoind.rpcpass: address and credentials for the Bitcoin node
# --bitcoind.zmqpubrawblock, --bitcoind.zmqpubrawtx-: zmq addresses of the Bitcoin node
# check out https://github.com/bitcoin/bitcoin/blob/master/doc/zmq.md for more info about the Bitcoin usage of zmq

docker run \
--name lightning-client-node \
-v /local/mount/path:/blockchain \
-p '0.0.0.0:10009:10009' \
-d xenaexchange/lnd \
--nobootstrap \
--rpclisten=0.0.0.0:10009 \
--tlsextraip=0.0.0.0 \
--maxpendingchannels=10 \
--bitcoin.active \
--bitcoin.node=bitcoind \
--bitcoin.mainnet \
--bitcoind.rpchost=10.140.0.2:8332 \
--bitcoind.rpcuser=bitcoind_rpc_user \
--bitcoind.rpcpass=bitcoind_rpc_password \
--bitcoind.zmqpubrawblock=tcp://10.140.0.2:28332 \
        --bitcoind.zmqpubrawtx=10.140.0.2:28333


*for MacOS use the command "-it -v /var:/blockchain \" for the directory settings. 


After running, the container will create the “/local/mount/path/data/chain/bitcoin/mainnet/admin.macaroon” and “/local/mount/path/data/tls.cer” files. When using the Xena Exchange dAccs CLI, pass the paths to these files to the --lnd-macaroon and --lnd-tls-cert arguments.



Creating a new Lightning wallet


Use the Lightning CLI command to create a new wallet. Provided that your Lightning node is running in the docker container named “lightning-client-node” and the node is configured to use the mainnet network, execute the following command:


docker exec -it lightning-client-node lncli --network=mainnet --lnddir=/blockchain create


Importing a VPN profile using the pritunl UI client


  • Copy the link you have received from support and past it in the “Import Profile URI” dialog box:



  • Go to the menu and click “Connect”:



If the connection has been established successfully, you will see the time on the “online for” counter increasing.