Skip to content

Server Installation

Brian Stafford edited this page Jul 27, 2024 · 3 revisions

Server Installation

Server Dependencies

  1. Linux or MacOS
  2. Go >= 1.19
  3. PostgreSQL 11+, tuned and running.
  4. Decred (dcrd) and Bitcoin (bitcoind) full nodes, and any other assets' full nodes, both with txindex enabled.

Set up the database

In a PostgreSQL psql terminal, run

CREATE USER dcrdex WITH PASSWORD 'dexpass';
CREATE DATABASE dcrdex_testnet OWNER dcrdex;

Generate a dcrwallet account public key

The master public key is used for collecting registration fees. Using dcrctl and dcrwallet, create a new account.

dcrctl --wallet --testnet createnewaccount fees

Get the master public key for the account.

dcrctl --wallet --testnet getmasterpubkey fees

Master public keys are network-specific, so make sure to specify the network to both dcrwallet and dcrctl, if not using mainnet.

Place the pubkey string into a new DEX configuration file.

~/.dcrdex/dcrdex.conf

# Testnet extended pubkey
regfeexpub=tpubVWHTkHRefqHptAnBdNcDJ...

# PostgreSQL Credentials
pgpass=dexpass

Or supply the dcrdex executable with the pubkey using:

./dcrdex --{network} --regfeexpub={network specific value}

Note: You can specify configurations for different networks in a separate config file e.g ~/.dcrdex/dcrdex-{network}.conf and provide it to the dcrdex executable using the -C flag:

./dcrdex -C ~/.dcrdex/dcrdex-{network}.conf

~/.dcrdex/ is the default app data directory location used by the DEX server, but can be customized with the --appdata command-line argument.

Run your asset daemons

Only the full node software listed in the client configuration section are supported for the server. The txindex configuration options must be set. Be sure to specify the correct network if not using mainnet.

Create the assets and market configuration file

A sample is given at sample-markets.json. See the market json section of the wiki for more information on individual options.

Build and run dcrdex

From a command prompt, navigate to server/cmd/dcrdex. Build the executable by running go build. The generated executable will be named dcrdex. Run ./dcrdex --help to see configuration options that can be set either as a command line argument or in the dcrdex.conf file. The Exchange Variables section of the specification has additional information on a few key options.

Run the server.

./dcrdex --testnet

from server/cmd/dcrdex.