How to get on DCRDEX MVP

Richard Red
Decred
Published in
7 min readOct 28, 2020

With the recent initial MVP release of DCRDEX, there are some people who would like to use it and are finding it difficult. I’m not so comfortable with command line apps myself, but managed to get on the DCRDEX without too much trouble (I found it easier than using CSPP), so thought maybe my perspective on where the stumbling blocks are could come in helpful.

There is an installer command which will do most of the setup for you, but you will still have to pull some levers manually to get everything ready. I’m going to talk through what the installer is doing in case it doesn’t work 100% for you, I had a minor issue with it myself because I had already made a start on the bitcoind sync.

Requirements for accessing DCR/BTC market on DCRDEX:

  • Fully synced Decred node. Only the command line version of Decred node (dcrd) and wallet (dcrwallet) are supported. You will need at least 1 DCR in the account you wish to use for DEX, to pay the one-time registration fee of 1 DCR with the dex.decred.org server. Syncing dcrd and setting up a wallet with dcrwallet is fast (takes a few hours to download and process the chain), dcrinstall walks through this process.
  • Fully synced Bitcoin node. bitcoind — the command line version of Bitcoin core, is possibly the only one that is 100% supported at this stage. If you don’t have a bitcoind node synced already, this is the part that’s going to take the longest — it could take 24–48 hours and involves downloading around 400gb of data. The Bitcoin node can however be pruned, so shouldn’t take more than 20–25gb of hard drive space — the chain data will be downloaded but pruning bitcoind will discard everything it doesn’t need to keep. The installer is set up to sync a pruned node.
  • DCRDEX installed (easy) and linked to your Decred/Bitcoin wallets. DCRDEX client requires minimal setup and should more or less just run. It will need access to a working Decred wallet with at least 1 DCR to pay the entry fee for the only known DCRDEX server (dex.decred.org). This involves setting up things like the RPC user and password for your node, and directing it to the appropriate location for data and configuration — which the installer will do for you.

The easiest way to get everything working is if things are in their default locations on the same computer or virtual machine, in which case the installer will do much of the work for you.

Points of clarification:

  • The first DCRDEX release is an MVP, things like Decrediton integration will come later. For now the point is to get the core of it working smoothly without issues.
  • DCRDEX clients (you) connect to a DCRDEX server (Company 0 are running one at dex.decred.org, other people can also run these servers by following the instructions in the repository). Users make and take orders by telling this server what they want to do (buy or sell). The server’s job is to know when a buyer and seller have reached mutually agreeable terms and signal them to execute the atomic swap on chain.
  • At present, neither Decred nor Bitcoin “simple payment verification” nodes can use DCRDEX. This can be added in future, but is not a launch feature. DCRDEX needs access to the Decred and Bitcoin chains so that it can know when your atomic swapping partner has initiated the process and take over on your end.
  • Once you get the various nodes running and wallets open, you can open a local web page in a browser and be presented with a basic but recognizable GUI trading interface, with order books and a chart. You won’t need to go back to the command line once DCRDEX is all up in your wallets, because it’s going to do everything for you. When you’re ready to spend those freshly DEXed DCR/BTC/LTC, but you can send them back to a more familiar wallet with a helpful “withdrawal” button on the Wallets tab — just enter the address to send to.
  • When you make a trade on DCRDEX, you will be making two on chain transactions (three if you pre-size the inputs), one on each chain, which means paying a transaction fee on each chain. The lot size of 40 DCR has been selected so that the transaction fee for a trade should not exceed 1% of the value of the trade, but this is obviously contingent on (BTC) chain congestion and fee rates.
  • You can see the DCRDEX order books on dcrdata’s market page now.
All this and more awaits you on the DCRDEX server, if you can get the client set up and connected

Resources

  • https://dex.decred.org/ — get the DCRDEX client here, at present it is bundled with v1.6.0 (release candidate 1) of Decred command line node and wallet software, because these latest versions are required to use DCRDEX.
  • The DCRDEX GitHub repository has good instructions (cheers Brian Stafford) for both the quick start installer method, and more advanced manual step by step installation instructions that cover things like building from source and setting up the nodes/wallets manually. The simple instructions there are the instructions I followed, and this is the place to check for important notes about known issues or things to avoid.
  • Guide to installing Decred CLI from docs site, and also a guide on how to do things like unlock the wallet and use dcrctl to perform various wallet operations, like creating a new account or making a transaction. If you’re new to Decred CLI, start here, but you’ll only need to use a handful of commands to get on DEX.
  • There are many guides related to running a Bitcoin full node, find one that covers bitcoind specifically, and for your Operating System. e.g. one for Linux. The DCRDEX instructions include key steps like setting up an encrypted Bitcoin wallet using bitcoind.

Getting on DCRDEX — with dcrinstall

The code snippets are mostly from other sources, reproduced here for convenience.

  1. Download the installer for your OS
  2. Run dcrinstall-linux-amd64-v1.6.0-rc1 --dcrdex — or whatever the installer for your OS is called.
  3. It will download Decred v1.6, latest DCRDEX and Bitcoin release binaries. It will also unpack these and leave them ready for you to start.
  4. Run bitcoind on the command line to start syncing, wait a few days. Because you installed this with DCRDEX, settings like server = 1 are set, and pruning is enabled, so bitcoind will throw away all the data it doesn’t need to keep.
  5. Make a Bitcoin wallet that you want to use with DEX, and you should probably encrypt it. From here (creates and encrypts a wallet called “dex”):
./bitcoin-cli createwallet dex
read -s BTCPASS
./bitcoin-cli -rpcwallet=dex encryptwallet $BTCPASS

6. Run dcrd on the command line to start syncing Decred chain. You can set dcrd up to run as a service or give back the terminal, but by default you’re going to need to leave the terminal window where dcrd is running open.

7. Run dcrwallet, if it doesn’t detect a wallet it will invite you to create a new wallet or import a seed (33 words)

8. Create an account to use with DEX. Accounts are like sub-wallets within a Decred wallet, they have their own balances and it requires an on chain transaction to move funds between accounts. For privacy purposes, accounts do not leave any particular signature on chain that they are part of the same wallet (but as with all transactions it’s easy to see where an account was funded from).

./dcrctl --wallet createnewaccount dex  
./dcrctl --wallet getnewaddress dex

9. Send the account enough DCR to pay the registration fee (minimum 1 DCR)

10. Once you have a wallet created/loaded, leave that terminal open.

11. Navigate to the DCRDEX folder, and run dexc

12. From this point the dcrdex guide seems quite straightforward, with pictures! It involves paying the registration fee, setting a DCRDEX password, and completing the integration of your Decred and Bitcoin wallets (which should just be a matter of entering account/wallet names and unlock passwords)

Notes

Leave dcrd, dcrwallet and bitcoind running while dexc is running. If you have open orders it is important to remain connected to DCRDEX with wallets ready. If you do not respond appropriately when someone matches your order, your reputation with the server will be penalized. If you need to shut down the DEX, cancel all your open orders first and close dexc before the wallets.

It is important to keep the dexc.db file (in ~/.dexc/mainnet/dexc.db on linux), as this is where your DCRDEX identity key-pair is stored. If you lose this, you will not be able to connect without paying another 1 DCR registration fee, and you will lose any trading history you had built up.

DCRDEX limits order size for new users as an anti-griefing measure, as you successfully complete trades the amount you can trade at once increases, according to a basic reputation system.

It is currently not advised to use the “pre-size funding inputs” option — this would split your BTC/DCR into chunks so that it is not all locked while orders are open, but it takes on chain transactions to do this, and fees have been prohibitively high on the Bitcoin side recently.

Checks

If it’s not working, check the following requirements:

Is dcrd running?

Is dcrwallet running with the wallet open? (wallet doesn’t have to be unlocked, but if public key encryption is enabled that needs to be decrypted).

Is bitcoind running?

Is the bitcoin wallet you want to use loaded?

If all that fails, join the DEX room on Matrix and there are people who can assist.

If there is something missing from this guide that could have helped you get on DCRDEX, let me know and I’ll consider adding it.

--

--

Richard Red
Decred
Editor for

Writing about cryptocurrency/blockchain projects that are doing something interesting with regard to governance. Decred contributor.