dcrdex v0.2
DCRDEX v0.2.0 (beta)
May 7, 2021
For a high level introduction to DCRDEX, please read the 0.1.0 release notes.
Highlights
This release includes a large number of improvements to the UI, the communications protocol, and software design.
The most notable new features are:
- Numerous UI and usability enhancements including responsive design and depth chart interactivity
- Support client control by the Decrediton GUI wallet and use of its accounts
- Experimental Bitcoin Cash (BCH) support
- Initial changes to support SPV (light) wallets in the next release
- Account import/export
The latest 1.6 release of dcrd and dcrwallet is required for this release of dcrdex. At the time of release, this corresponds to the v1.6.2 releases.
Bitcoin Core 0.20 and 0.21 are both supported.
Important Notices
Although DCRDEX looks and feels like a regular exchange, the "decentralized" aspect brings an expanded role to the client. Please take the time to read and understand the following:
- Ensure your nodes (and wallets) are fully synchronized with the blockchain network before placing orders.
- Never shutdown your wallets with dexc running. When shutting down, always stop dexc before stopping your wallets.
- If you have to restart dexc with active orders or swaps, you must immediately login again with your app password when dexc starts up.
- There is an "inaction timeout" when it becomes your client's turn to broadcast a transaction, so be sure not to stop dexc or lose connectivity for longer than that or you risk having your active orders and swaps/matches revoked. If you do have to restart dexc, remember to login as soon as you start it up again.
- Only one dexc (client) process should be running for a given user account at any time. For example, if you have identical dexc configurations on two computers and you run dexc and login on both, neither dexc instance will be adequately connected to successfully negotiate swaps. Also note that order history is not synchronized between different installations.
- Your DEX server accounts exist inside the dexc.db file, the location of which depends on operating system, but is typically in ~/.dexc/mainnet/dexc.db or %HOMEPATH%\Local\Dexc\mainnet\dexc.db. Do not delete this file.
- If you use a non-default bitcoin wallet name, don't forget to set it in bitcoin.conf with a
wallet=wallet_name_here
line so that bitcoind will load it each time it starts. Otherwise, dexc will give you a "wallet not found" error on startup and login. - bitcoind's "smart" fee estimation needs plenty of time to warm up or it is not so smart. When possible, keep your bitcoind running for at least 6 blocks, especially if had not been running for more than an hour, or ensure that the value returned from a bitcoin-cli call to
estimatesmartfee 1
returns a"feerate"
close to what https://mempool.space/ reports as "High priority".
Client (dexc)
Features and Improvements
- Experimental support for Bitcoin Cash (BCH). (542ed9b)
- Show confirmations for swaps transactions on the Order page when a swap has not yet reached the required number of confirmations. (ecbfebd)
- Open dialogs can be closed by hitting the "Escape" key. (7c978cd)
- Allow changing the dex client "application password". (8d7163c)
- Responsive browser UI design. (c91bde4)
- Differentiate between buy/sell orders in confirmation modal dialog. (2bdf81f)
- Clearer revocation notifications. (c8c9729)
- Raw transaction data is now transmitted to counterparties in the
'audit'
and'match_status'
requests. This is a prerequisite for SPV clients. (3704513) - More chart interactivity. (a) Indicators on the depth chart for the user's orders. When the mouse hovers near the indicator, the order is highlighted in the "Your Orders" table. Conversely, when the mouse hovers over a row in the "Your Orders" table, the indicator is highlighted on the chart. (b) Move the legend and hover info to the top. (c) When a rate is entered in the order form for a limit order, display a line indicator at that rate on the depth chart. (d) When the user hovers over an order in the buy/sell tables, display an indicator at that rate on the depth chart. (e) Last zoom level is saved across markets and reloads. (f) Display the total buy/sell volume. (fb6f3ea, 08ec4ac)
- Multiple authorized browser sessions are now permitted. This refers to logging in to dexc from two different browsers that do not share a cookie store. This is now permitted, however, signing out of one session signs out of all sessions. (030173b)
- A wallet's connection settings and private passphrase can be changed at the same time. Developers should see the
ReconfigureWallet
change. (761e3e1) - Add account import/export functions. (1a38c4d)
- Add account disable function. (f414a87)
- Starting dexc when a configured DEX server is unreachable starts a reconnect attempt loop. Previously it was necessary to restart dexc later and hope the server was back. (c782ffb)
- Account-based DCR wallet locking support. With dcrwallet 1.6, accounts may be individually encrypted, with a unique password, in contrast to whole-wallet locking. This allows working with such accounts by using the
accountunlocked
dcrwallet RPC to determine the locking scheme for an account, and theunlockaccount
/lockaccount
RPCs instead ofwalletpassphrase
/walletlock
. The "beta" simnet DCR harness now uses an individually-encrypted "default" account. (ff4e76c, 37cdc9e) - Handling of new server-provided fee rates. This will support SPV clients, and helps ensure that both redeem and order funding transactions are not created with low fee rates when the client's wallet/node is not providing good estimates. (79a1cb0)
- Network-specific loopback IPs for the webserver and RPC server listen addresses. Now by default, dexc listens on 127.0.0.1 for mainnet, 127.0.0.2 for testnet, and 127.0.0.3 for simnet. Users are still be able to specify custom addresses with
webaddr
andrpcaddr
. (08ec4ac) - Maximum order size estimates on order dialog. Get maximum order estimates based on wallet balances and, in the case of buy orders, the rate in the rate input field. The data is shown in the UI as a small message above the rate field. When you click on the label, the quantity fields are pre-populated with the max order. (920d1ac)
- dexcctl / RPC server: Add a matches list to the
myorders
response. (3bef6ba) - When orders are placed, the client remembers the expected maximum fee rate, and verifies that the rate provided by the server at match time does not exceed this amount. (2123f10)
- Add a "fee rate limit" setting to each wallet that is checked against the max fee rate set by the server's config. Orders are blocked by the client if the server specifies a max fee rate that exceeds the client's limit. (414ffcc)
- On shutdown, the active orders are logged, and inactive trades have their coins released to the wallet if they were not already. (41749a8)
- Add sample config files. (also server) (792602b)
- The
'init'
and'redeem'
requests are now run asynchronously so most other actions are not blocked while waiting for a response. This is generally an internal change, but it may improve the overall responsiveness of the dexc application. (a0538bb) - Preimage request handling is reworked to prevent blocking for a long period given an incoming preimage request for an unknown order. (1b66492)
- Add a custom webserver "site" directory argument. (4506406)
- Favor confirmed UTXOs in BTC order funding. This is primarily an internal change, but it can defend against swaps that take too long to confirm. (3f6e429)
- "Long" execution times (more than 250ms) for incoming message handling and track ticks are now logged. (529cb0d)
Developer
- When
Core
is shut down, wallets are locked when theRun
method returns. Previously, wallets were only locked if the consumer usedPromptShutdown
. (8976d8d)
This change was in 0.1.5, but it is reiterated here as it is an significant change in behavior that Go consumers should note. - Updates to the
User
struct returned by theUser
andExchanges
methods ofclient/core.Core
. Theclient/core.Market
has replaced the{Base,Quote}{Order,Contract}Locked
fields with methods. (167efd4) - When specifying TLS certificates, allow either a filename or the contents of the certificate file. This applies to the
Register
,GetFee
, and
GetDEXConfig
methods ofclient/core.Core
. (44a3363) - Notification subjects are now package-level constants. (3aef72d)
ReconfigureWallet
has a new pass input (nil
indicates no password change). (761e3e1)- New order fee estimate API. See the new
(*Core).PreOrder
method and the new returnedOrderEstimate
type. Also see thePreSwap
andPreRedeem
methods ofclient/asset.Wallet
, and the new types of the same name. (5394cea) - New
isinitialized
http API endpoint andCore
method. (b767a23) - Add the
(*Core).GetDEXConfig
method and a corresponding http api endpointgetdexinfo
the functions similar togetfee
by making a temporary connection to a DEX with no existing account, except that it returns the server's entire config. (d85f6bc) - Check the server's API version and each asset's version that are now returned in the server's
'config'
response. (e59b47f, 205e802, 1bc0cc9) - Only active orders are listed by the
User
andExchanges
methods ofCore
. Completed orders that are pending retirement are excluded. (6358d97) - Add profiling switches to dcrdex. A CPU profile file may be specified with
--cpuprofile
. The http profiler may be started with--httpprof
. (c17baf9) - (internal) DCR asset backends now use rpcclient/v6, which provide cancelable requests. (312397a, 9d65d55)
- (internal) BTC's asset backend now uses Decred's rpcclient package for cancellation capability. All request now use
RawRequest
. (cefe6a5) - (internal) All incoming response and notification message handlers are wrapped for panic recovery. (829a661)
- (internal) Message unmarshalling is now more robust with respect to null payloads. (9bf1a3e)
- Many third party Go dependency updates. (go.mod diff)
- Update site build system to Webpack 5, and update most other deps. (a8e76ea)
- Add an ETH simnet harness for support of upcoming ETH support. (ea10f5a)
- The simnet harnesses now listen on all interfaces. (4e246cf)
- The Decred wallet harnesses now start dcrwallet with http profiling enabled. (b96f546)
- Rework the
db.MetaMatch
struct. (db3df62)
Fixes
In addition to numerous fixes that were also in the 0.1.x releases, the
most notable fixes are:
- No longer show the Register dialog if the server for the only registered DEX happens to be down at the time. (b6ea0ea)
- Correct handling of IPv6 listen addresses. (also on server) (f0ef965)
- Update the browser UI when orders are placed via dexcctl. (8cc1502)
- Better error reporting on the DEX registration dialog. (2617d75)
- More robust recovery for orders that become unfunded (e.g. user spends coins that were reserved for an order). (122277e)
- No longer prematurely broadcast Decred refund transactions. (03cdf2d)
- Commitment checksum handling in the presence of missed preimage is now handled the same way as on the server by including the all epoch order commitments in the csum computation, not just the ones with revealed preimages. (25e3679, 7d71ffd)
- Never show negative confirmations for swap transactions even before they have been checked. (fb39b97)
- The mouse wheel only zooms when hovering over the depth chart, no longer scrolling the page at the same time. (736b005)
Server (dcrdex)
Swapper
resumes on startup from DB rather than a state file. (a676e07)- Market data API endpoints.
/spots
is the spot price and booked volume of all markets./candles
is candlestick data, available in bin sizes of 24h, 1h, 15m, and per-epoch sticks. e.g./candles/dcr/btc/15m
./orderbook
is already a WebSocket route, but is now also accessible by HTTP. An example URL is/orderbook/dcr/btc
./config
is another WebSocket route that is also now available over HTTP too. (08afde3) - Configurable trade limits with the new
--inittakerlotlimit
and--abstakerlotlimit
dcrdex switches, anduserBookedLotLimit
set in
markets.json. - Provide API and asset versions in the
'config'
response. (e59b47f, 205e802, 1bc0cc9, 5771186) - Begin sending TxData (raw tx) in audit and match_status requests to counterparty. This will support SPV clients. (370451)
- Experimental Bitcoin Cash (BCH) support. (542ed9b, 5771186)
- Version the DB scheme and implement initial updates to populate historical market data in the epoch_reports table. (d000f19)
- The outgoing preimage request now includes the commitment for the preimage being requested. (850e8a6)
- Provide fee rate estimates to the clients in certain messages:
orderbook
,epoch_report
, and the newfee_rate
route. With this data provided to the clients, minimum fee rates of zero-conf funding coins are enforced. (79a1cb0, 9885bf1) - Fix market suspension not purging the outgoing book router's orders list. The actual book was purged, but clients would still pull a book snapshot listing orders if they restarted after a purge. (a25d14e)
- Order priority queue automatic reallocation and smaller initial capacity. (3750cce)
- New administrative endpoints:
orderbook
,epochorders
, andmatches
. (0ce3ec7) - Add order ID to cancel route error message. (0a7157b)
- Various test harness improvements. (ca9882d)
- Active order counts are logged when a user authenticates. (945cb4a)
- Drop the dependency on the deprecated golang.org/x/crypto/ssh/terminal repository. (cae9f5a)
- The /api/market/{marketID}/matches endpoint now returns decoded swap/redeem coin IDs and an idiomatic JSON response. (a1fbdc0)
Build requirements
- Go 1.15 or 1.16
- Node 14 is the minimum supported version for building the site assets.
- dcrd and dcrwallet must still be built from their
release-v1.6
branches. - The minimum required dcrwallet RPC server version is 8.5.0, which corresponds
to the v1.6.2 patch release of dcrwallet, but the latestrelease-v1.6.x
tag
should be used.
Code Summary
166 commits, 287 files changed, 40,296 insertions(+), 18,072 deletions(-)
9 contributors
- Amir Massarwa (@amassarwi)
- Brian Stafford (@buck54321)
- David Hill (@dajohi)
- Joe Gruffins (@JoeGruffins)
- Jonathan Chappelow (@chappjc)
- Kevin Wilde (@kevinstl)
- @peterzen
- Victor Oliveira (@vctt94)
- Wisdom Arerosuoghene (@itswisdomagain)