• Stars
    star
    186
  • Rank 207,316 (Top 5 %)
  • Language
    Go
  • License
    Other
  • Created over 5 years ago
  • Updated 13 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

The Decred Decentralized Exchange (DEX), powered by atomic-swaps.

DCRDEX

Build Status ISC License GoDoc

What is DEX?

The Decred Decentralized Exchange (DEX) is a system that enables trustless exchange of different types of blockchain assets via a familiar market-based API. DEX is a non-custodial solution for cross-chain exchange based on atomic swap technology. DEX matches trading parties and facilitates price discovery and the communication of swap details.

Matching is performed through a familiar exchange interface, with market and limit orders and an order book. Settlement occurs on-chain. DEX's epoch-based matching algorithm and rules of community conduct ensure that the order book action you see is real and not an army of bots.

Trades are performed directly between users through on-chain contracts with no actual reliance on DEX, though swap details must be reported both as a courtesy and to prove compliance with trading rules. Trades are settled with pure 4-transaction atomic swaps and nothing else. Because DEX collects no trading fees, there's no intermediary token and no fee transactions.

Although trading fees are not collected, DEX does require a one-time registration fee to be paid on-chain. Atomic swap technology secures all trades, but client software must still adhere to a set of policies to ensure orderly settlement of matches. The maximum penalty imposable by DEX is loss of trading privileges and forfeiture of registration fee.

Contents

Getting Started

To begin using the DEX to trade, you need the client application. There are a few simple options for obtaining the software. The standalone DEX client is strongly recommended as it is the easiest to setup and generally has the most up-to-date downloads. Pick just one method:

  1. Download the the standalone DEX client for your operating system for the latest release on GitHub.
  2. Use your operating system's package manager. See OS Packages for more info.
  3. Use Decrediton, the official graphical Decred wallet, which integrates the DEX client, and go to the DEX tab.
  4. Use the Decred command line application installer, dcrinstall. Not recommended unless you already have this in your workflow.
  5. Build the standalone client from source.

See the Client Installation and Configuration page on the wiki for more information and a detailed walk-through of the initial setup.

Almost everyone will just want the client to trade on existing markets, but if you want to set up a new DEX server and host markets of your choice, see Server Installation.

OS Packages

We are in the process of adding the application to various OS package mangers:

  • Arch Linux (AUR). e.g. $ yay dcrdex. Accessible to Arch-based distros like Manjaro.
  • MacOS. Homebrew cask coming soon.
  • Windows. winget package coming soon.
  • Debian/Fedora. apt repository coming soon.

Important Stuff to Know

Trades settle on-chain and require block confirmations. Trades do not settle instantly. In some cases, they may take hours to settle. The client software should not be shut down until you are absolutely certain that your trades have settled.

The client has to stay connected for the full duration of trade settlement. Losses of connectivity of a couple minutes are fine, but don't push it. A loss of internet connectivity for more than 20 hours during trade settlement has the potential to result in lost funds. Simply losing your connection to the DEX server does not put funds at risk. You would have to lose connection to an entire blockchain network.

There are initially limits on the amount of ordering you can do. We'll get these limits displayed somewhere soon, but in the meantime, start with some smaller orders to build up your reputation. As you complete orders, your limit will go up.

If you fail to complete swaps when your orders are matched, your account will accumulate strikes that may be lead your account becoming automatically suspended. These situations are not always intentional (e.g. prolonged loss of internet access, crashed computer, etc.), so for technical assistance, please reach out on Matrix.

Fees

DEX does not collect any fees on the trades, but since all swap transactions occur on-chain and are created directly by the users, they will pay network transaction fees. Transaction fees vary based on how orders are matched. Fee estimates are shown during order creation, and the realized fees are displayed on the order details page.

To ensure that on-chain transaction fees do not eat a significant portion of the order quantity, orders must be specified in increments of a minimum lot size. To illustrate, if on-chain transaction fees worked out to $5, and a user was able to place an order to trade $10, they would lose half of their trade to transaction fees. For chains with single-match fees of $5, if the operator wanted to limit possible fees to under 1% of the trade, the minimum lot size would need to be set to about $500.

The scenario with the lowest fees is for an entire order to be consumed by a single match. If this happens, the user pays the fees for two transactions: one on the chain of the asset the user is selling and one on the chain of the asset the user is buying. The worst case is for the order to be filled in multiple matches each of one lot in amount, potentially requiring as many swaps as lots in the order. Check the dex specification for more details about how atomic swaps work.

DEX Specification

The DEX specification details the messaging and trading protocols required to use the Market API. Not only is the code in in the decred/dcrdex repository open-source, but the entire protocol is open-source. So anyone can, in principle, write their own client or server based on the specification. Such an endeavor would be ill-advised in these early stages, while the protocols are undergoing constant change.

Contribute

Looking to contribute? We need your help to make DEX #1.

Nearly all development is done in Go and JavaScript. Work is coordinated through the repo issues, so that's the best place to start. Before beginning work, chat with us in the DEX Development room. The pace of development is pretty fast right now, so you'll be expected to keep your pull requests moving through the review process.

Check out these wiki pages for more information.

Source

The DEX specification was drafted following stakeholder approval of the specification proposal.

The source code for the DEX server and client are being developed according to the specification. This undertaking was approved via a second DEX development proposal.

FAQS

  • How can I integrate new assets? To add new assets, follow the instructions here and see existing implementations here.

More Repositories

1

dcrd

Decred daemon in Go (golang).
Go
724
star
2

atomicswap

On-chain atomic swaps for Decred and other cryptocurrencies.
Go
505
star
3

dcrwallet

A secure Decred wallet daemon written in Go (golang).
Go
207
star
4

decrediton

Cross-platform GUI for Decred.
JavaScript
195
star
5

dcrdata

Decred block explorer, with packages and apps for data collection and storage. Written in Go.
Go
129
star
6

politeia

Go
110
star
7

decred-release

Decred binary releases.
Go
86
star
8

dcrdocs

Documentation for Decred.
Shell
81
star
9

dcrstakepool

Stakepool for Decred.
Go
73
star
10

politeiagui

JavaScript
62
star
11

dcraddrgen

dcraddrgen is a simple offline address generator for Decred.
Go
60
star
12

decred-binaries

Binary archives for Decred releases.
56
star
13

dcps

Decred Change Proposals (DCPs).
40
star
14

dcrweb

Decred website code.
SCSS
37
star
15

cspp

Decred CoinShuffle++
Go
33
star
16

dcrpool

decred mining pool
Go
31
star
17

dcrtime

Decred anchored timestamp client, proxy, and server.
Go
28
star
18

tinydecred

Python tools for Decred
Python
27
star
19

vspd

A Voting Service Provider (VSP) for the Decred network.
Go
19
star
20

dcrwebapi

Go
18
star
21

dcrtimegui

Timestamp files with blockchain
JavaScript
15
star
22

dcrdesign

Decred Design System
15
star
23

pi-ui

Politeia UI library
JavaScript
14
star
24

contractor-mgmt

Contractor management system written in Go that uses politeiad as a backend
Go
12
star
25

tumblebit

Go
11
star
26

dcrseeder

Decred Seeder
Go
11
star
27

dcrros

Go
10
star
28

dcrdocker

Dockerfiles for Decred.
10
star
29

decred-php-api

PHP API for the Decred Cryptocurrency
PHP
9
star
30

umbrel-app-store

8
star
31

dcrpayments

mono repo that houses various libraries/utilities for accepting Decred payments
PHP
8
star
32

base58

Go
7
star
33

RFPs

Decred Request For Proposals (RFPs).
7
star
34

dcrvotingweb

Demo for Decred hard fork voting.
CSS
6
star
35

dcrdevdocs

Decred Development Documentation
Shell
5
star
36

dcraddrscanner

Kotlin
5
star
37

dcrlnlpd

Go
5
star
38

release

Go
4
star
39

decred-magento-plugin

Decred API for Magento
PHP
4
star
40

dexweb

HTML
3
star
41

testnetfaucet

Decred testnet faucet.
Go
3
star
42

dcrbounty

SCSS
3
star
43

dcrctl

Command-line client for interacting with the JSON-RPC servers of dcrd and dcrwallet
Go
3
star
44

haste

2
star
45

cmsgui

JavaScript
2
star
46

dcrtest

Go
2
star
47

dcrdex-assets

static assets for dcrdex
Go
1
star
48

dcrblog

Decred Blog
SCSS
1
star