decred.org/dcrdex@v1.0.5/docs/wiki/Server-Installation.md (about) 1 # Server Installation 2 3 ## Server Dependencies 4 5 1. Linux or MacOS 6 2. [Go >= 1.23](https://golang.org/doc/install) 7 3. [PostgreSQL 11+](https://www.postgresql.org/download/), [tuned](https://pgtune.leopard.in.ua/) and running. 8 4. Decred (dcrd) and Bitcoin (bitcoind) full nodes, and any other assets' full nodes, both with `txindex` enabled. 9 10 ## Set up the database 11 12 In a PostgreSQL `psql` terminal, run 13 14 ```sql 15 CREATE USER dcrdex WITH PASSWORD 'dexpass'; 16 CREATE DATABASE dcrdex_testnet OWNER dcrdex; 17 ``` 18 19 ### Generate a dcrwallet account public key 20 21 The master public key is used for collecting registration fees. 22 Using [dcrctl](https://docs.decred.org/wallets/cli/dcrctl-basics/) 23 and [dcrwallet](https://github.com/decred/dcrwallet), 24 create a new account. 25 26 `dcrctl --wallet --testnet createnewaccount fees` 27 28 Get the master public key for the account. 29 30 `dcrctl --wallet --testnet getmasterpubkey fees` 31 32 Master public keys are network-specific, so make sure to specify the network 33 to both `dcrwallet` and `dcrctl`, if not using mainnet. 34 35 Place the pubkey string into a new DEX configuration file. 36 37 ### ~/.dcrdex/dcrdex.conf 38 39 ```ini 40 # Testnet extended pubkey 41 regfeexpub=tpubVWHTkHRefqHptAnBdNcDJ... 42 43 # PostgreSQL Credentials 44 pgpass=dexpass 45 ``` 46 47 Or supply the dcrdex executable with the pubkey using: 48 49 ```sh 50 ./dcrdex --{network} --regfeexpub={network specific value} 51 ``` 52 53 **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: 54 55 ```sh 56 ./dcrdex -C ~/.dcrdex/dcrdex-{network}.conf 57 ``` 58 59 *~/.dcrdex/* is the default **app data directory** location used by the 60 DEX server, but can be customized with the `--appdata` command-line argument. 61 62 ## Run your asset daemons 63 64 Only the **full node** software listed in the [client configuration](https://github.com/decred/dcrdex/wiki/Client-Installation-and-Configuration#optional-external-software) 65 section are supported for the server. The `txindex` configuration options must 66 be set. Be sure to specify the correct network if not using mainnet. 67 68 ## Create the assets and market configuration file 69 70 A sample is given at 71 [*sample-markets.json*](server/cmd/dcrdex/sample-markets.json). See the 72 [**market json**](https://github.com/decred/dcrdex/wiki/Server-Admin#markets-json) section of the wiki for 73 more information on individual options. 74 75 ## Build and run dcrdex 76 77 From a command prompt, navigate to **server/cmd/dcrdex**. Build the executable 78 by running `go build`. The generated executable will be named **dcrdex**. Run 79 `./dcrdex --help` to see configuration options that can be set either as a 80 command line argument or in the *dcrdex.conf* file. The 81 [**Exchange Variables**](https://github.com/decred/dcrdex/blob/master/spec/admin.mediawiki) section of the specification has 82 additional information on a few key options. 83 84 **Run the server.** 85 86 `./dcrdex --testnet` 87 88 from **server/cmd/dcrdex**.