πŸ‘¨β€πŸ’»-Developers
This guide is intended to help developers who want to contribute to opendexd. Developers who want to build services on top of opendexd, should check out the node's API Documentation.

Contribution Guidelines

Be sure to read the Contribution Guidelines before starting to work or opening a Pull Request.
The following development environments are known to be compatible with opendexd and are recommended for developers that are unsure what tools to use.

Visual Studio Code

​Visual Studio Code is a cross-platform code editor that's compatible with most popular programming languages and extensible via a large collection of plug-ins.
Visual Studio Code Plugins
Consider using the following plugins for working with opendexd.
Visual Studio Code Environment Config
Adding the two files from this gist into a .vscode folder within the folder where you've cloned opendexd will automatically provide debug configurations and general settings that are helpful when developing opendexd.

opendexd Setup

Auto-restart opendexd on file change

Auto restart on every file change under dist folder with nodemon:
1
nodemon --watch dist -e js bin/opendexd
Copied!
With some sample args disabling lndbtc/lndltc:
1
nodemon --watch dist -e js bin/opendexd --lndbtc.disable=true --lndltc.disable=true
Copied!

Connect opendexd to testnet

We recommend to connect the opendexd instance you are developing on to testnet. Combined with above restarting mechanism, this lets you instantly see how your changes behave in a real-world trading environment.
  1. 1.
    Start testnet with default settings as described here.
  2. 2.
    Once the environment is up and running, exit from the cli session by typing exit or open a second terminal.
  3. 3.
    Stop the opendexd container with docker stop testnet_opendexd_1.
  4. 4.
    Copy the testnet lndbtc & lndltc folders into some path that you can easily access. E.g. into your home directory:
1
sudo cp -R ~/.opendex-docker/testnet/data/lndbtc ~/
2
sudo cp -R ~/.opendex-docker/testnet/data/lndltc ~/
Copied!
  1. 1.
    Ensure that you own the copied folders:
1
sudo chown -R <youruser> ~/lndbtc
2
sudo chown -R <youruser> ~/lndltc
Copied!
  1. 1.
    Create/change opendex.conf in ~/.opendexd to contain the following:
1
[lnd.BTC]
2
cltvdelta = 40
3
disable = false
4
host = "localhost"
5
nomacaroons = false
6
port = 20009
7
certpath = "/home/<youruser>/lndbtc/tls.cert"
8
macaroonpath = "/home/<youruser>/lndbtc/data/chain/bitcoin/testnet/admin.macaroon"
9
[lnd.LTC]
10
cltvdelta = 576
11
disable = false
12
host = "localhost"
13
nomacaroons = false
14
port = 21009
15
certpath = "/home/<youruser>/lndltc/tls.cert"
16
macaroonpath = "/home/<youruser>/lndltc/data/chain/litecoin/testnet/admin.macaroon"
17
[connext]
18
disable = false
19
host = "localhost"
20
port = 18000
Copied!
  1. 1.
    Now you can start your local opendexd instance and it should connect to the running testnet docker environment. You can check that everything works with ~/opendexd/bin$ ./opendex-cli -p 18886 getinfo.

References

Last modified 1mo ago