decred.org/dcrdex@v1.0.5/docs/release-notes/release-notes-0.4.0.md (about) 1 # DCRDEX v0.4.0 2 3 Jan 20, 2022 4 5 For a high level introduction to DCRDEX, please read the [initial release's notes](release-notes-0.1.0.md). 6 7 ## Highlights 8 9 This release includes a large number of improvements to wallet support, the UI, 10 the communications protocol, and software design. 11 12 The most notable new features are: 13 14 - An integrated light (SPV) BTC wallet 15 - Support for dcrwallet/Decrediton in SPV mode 16 - BTC may be used for account account registration 17 - Introduce an application "seed" for deterministic account and wallet restoration 18 - UI overhaul and streamlined setup 19 - Improved market view with candlestick charts and a price feed 20 - A "remember password" login option to eliminate password nagging 21 - Translations for Chinese (zh-CN) and Portuguese (pt-BR) 22 - Extensive under-the-hood improvements 23 24 The latest 1.7 release of dcrd and dcrwallet is required for this release of 25 DCRDEX. At the time of release, this corresponds to the v1.7.0 releases. Bitcoin 26 Core 0.20 and 0.21 are both supported. Bitcoin Core v22 may be used, but the 27 wallet type must not be a "descriptor" wallet, which may be the default on 28 certain platforms and redistributed builds. 29 30 Note that we skipped a v0.3 release. The v0.3 development branch is a pre-SPV 31 checkpoint branch, but it also requires Decred 1.7. Given the timing of the 32 Decred v1.7 and DCRDEX v0.4 releases now coinciding, we are jumping straight to 33 the DCRDEX v0.4 SPV-enabled release. 34 35 ## Important Notices 36 37 If upgrading from v0.2, read the [Upgrading](#upgrading) section for important 38 information. 39 40 Always record the "seed" that is generated by the DEX client on initialization 41 (when you set your password the first time in the browser window). This is a 42 short string of characters that is used to derive DEX account identities and 43 initialize any native/built-in wallets you create in the DEX client. **You must 44 have this seed to recover funds** that you receive in such wallets if your lose 45 access to your DEX client's data folder. 46 47 Although DCRDEX looks and feels like a regular exchange, the "decentralized" 48 aspect brings an expanded role to the client. Please take the time to read and 49 understand the following: 50 51 - **Never shutdown your external wallets with dexc running**. When shutting 52 down, always stop dexc before stopping your wallets. 53 - If you have to restart dexc with active orders or swaps, you must 54 **immediately login again** with your app password when dexc starts up. 55 - There is an "inaction timeout" when it becomes your client's turn to broadcast 56 a transaction, so be sure not to stop dexc or lose connectivity for too long 57 or you risk having your active orders and swaps/matches revoked. If you do 58 have to restart dexc, just remember to login as soon as you start it up again. 59 - Only one dexc process should be running for a given user account at any time. 60 For example, if you have identical dexc configurations on two computers and 61 you run dexc and login on both, neither dexc instance will be adequately 62 connected to successfully negotiate swaps. 63 - Order history is not synchronized between different client installations. 64 65 ## Upgrading 66 67 ### Client (dexc) 68 69 #### Application Seed 70 71 When upgrading from v0.2, an application "seed" is automatically generated upon 72 login. The seed is used when creating new DEX accounts and native (built-in) 73 wallets, and may be used to restore these accounts on a new DEX client 74 installation. You should go to the Settings page to view this new seed, and 75 **back it up somewhere safe**. This is especially important if you create a 76 native Bitcoin wallet from within the DEX client since you will need the seed to 77 recover any funds in the wallet. 78 79 If you run the upgrade multiple times, such as from different client 80 installations or just repeated the upgrade from a v0.2 backup, you will get a 81 **different seed each time** the upgrade runs and you login. 82 83 **Any DEX accounts created prior to upgrading can NOT be later recovered from 84 this seed.** These "legacy" accounts continue to work in v0.4, but to back them 85 up or move them to a different installation, it is still necessary to 86 export/import them from the Settings page or backup the dexc.db file as it was 87 in v0.2. 88 89 **Developer note:** For the upgrade to complete, it is necessary to call `Login` 90 before using most other `Core` methods. If you receive the error "primary 91 credentials not retrieved. Is the client initialized?" it is likely that you 92 need to `Login` first to complete the seed generation and credentials scheme 93 migration. Typical startup should involve `core.New` followed by: `c.Run` in a 94 goroutine, wait for `<-c.Ready()`, consult `c.IsInitialized()` before calling 95 either `c.InitializeClient` or `c.Login`. After login, you should call 96 `c.ExportSeed` with the application password to retrieve the newly-generated 97 application seed. 98 99 #### Changing the Bitcoin Wallet Type 100 101 If you previously had an external Bitcoin Core wallet configured with DEX, you 102 may switch to a native BTC wallet from the Wallets page. Click the "gears" icon 103 for the Bitcoin wallet, click "change the wallet type", select "SPV" from the 104 dropdown box, and click the Submit button. This will start creating a new BTC 105 wallet. After several seconds it will begin synchronizing in the background, and 106 a circular arrow icon will be displayed in the Status column of the Wallets 107 table. Synchronization of the wallet with the Bitcoin network is completed when 108 the icon disappears. During the process you may see progress by hovering the 109 mouse over the icon. This normally takes less than 10 minutes, but it may be 110 longer depending on your network and the peers it established. It is strongly 111 advised to allow this to complete before attempting to shutdown, change any 112 wallet settings, or attempt to lock/unlock the wallet. If you decide to change 113 the wallet type back to an external wallet, you will need to re-enter the RPC 114 settings that were previously used. 115 116 ### Server (dcrdex) 117 118 There are several changes to the configuration files. 119 120 - In markets.json, both lotSize and rateStep no longer belong in the *asset* 121 settings, and instead should be configured for each *market*. See 122 [4231914](https://github.com/decred/dcrdex/commit/423191441b5bfb569cba6a5de1dcd5a1a8f57855) 123 for more information. 124 - Lot size changes are now supported, but it presently involves restarting the 125 dcrdex process after editing markets.json. It is advised to complete swaps and 126 purge the market before shutting down. See 127 [509205d](https://github.com/decred/dcrdex/commit/509205d4ce4d711b96bb41e596c2c8f100ba7596) 128 for more information. 129 - With registration fees accepted in both BTC and DCR now, the registration fee 130 settings should be configured per-asset in markets.json. Previously, 131 dcrdex.conf was used to configure these settings for DCR. To accept BTC, a 132 "zpub" encoding of your wallet's extended public key for the BIP84 (p2pkh) 133 derivation path is required. See 134 [4f2ab59](https://github.com/decred/dcrdex/commit/4f2ab59c6fb1fa9e60cb8b953a9a294a2e7c925a) 135 and 136 [0124247](https://github.com/decred/dcrdex/commit/012424702e9f5ddcd8459d04f25eb6bceb859207) 137 for more information. 138 139 For examples, consult the sample files: server/cmd/dcrdex/sample-markets.json 140 and server/cmd/dcrdex/sample-dcrdex.conf 141 142 ## Client 143 144 ### Features and Improvements 145 146 - The client now uses a seed and deterministic (HD) account key derivation. An 147 application seed is generated during client initialization. When a new dex 148 account is created, the server's identity is used to deterministically 149 generate a client identity for the account. **Users should save a copy of 150 their app seed.** When upgrading, a new seed will be generated, which may be 151 accessed for backup from the Settings page. When initializing a new dex 152 client, there is an option to provide an existing seed. The RPC client 153 (dexcctl) also has an `appseed` request endpoint. If an account is suspended, 154 a new one will be generated from a different derivation path, and on restore 155 from seed, non-suspended accounts will be located. 156 ([b66a35f](https://github.com/decred/dcrdex/commit/b66a35f24215456763a16cee9c32875f61f9814b), 157 [ac5affe](https://github.com/decred/dcrdex/commit/ac5affe9db320c48534cf4c51e3f7100a6ce4f42), 158 [d8e46bb](https://github.com/decred/dcrdex/commit/d8e46bb21e6dcd299343f69257270529aaee6c7e), 159 [59868fe](https://github.com/decred/dcrdex/commit/59868fe81173a2d67100ff071d01552cc74fcb1a), 160 [7f9d0d5](https://github.com/decred/dcrdex/commit/7f9d0d504b918a58e27576e01b2912b49833a600), 161 [d203ebd](https://github.com/decred/dcrdex/commit/d203ebd53127f658e8ae58269907c3c634709e83), 162 [242f597](https://github.com/decred/dcrdex/commit/242f597fb1303883eaeb400234a8cffbaa80bf5c), 163 [a548723](https://github.com/decred/dcrdex/commit/a5487231f0d1682003617837f279a3b12ef787de), 164 [2df3b4b](https://github.com/decred/dcrdex/commit/2df3b4b3f4cdf9e41f87db88936b1cd823c0d36f)) 165 - A new Bitcoin SPV wallet integrated into the DEX client. 166 ([c1992d8](https://github.com/decred/dcrdex/commit/c1992d8d1cc11036c4933284a53126b8c452c82d), 167 [d202f6d](https://github.com/decred/dcrdex/commit/d202f6d4d0de6884be7dc1bd73a0e865835d6a9b), 168 [d808492](https://github.com/decred/dcrdex/commit/d8084925bfe8ded4af88bf4865d8714f8a662b14), 169 [2d18cc8](https://github.com/decred/dcrdex/commit/2d18cc80b372d942428eef23824701268a385569), 170 [f5835bd](https://github.com/decred/dcrdex/commit/f5835bde802f8d4a7884c3afe1c922daca115455), 171 [4249d97](https://github.com/decred/dcrdex/commit/4249d97f02ac0644c03429b9bea0bd401e6e7a73), 172 [82833e0](https://github.com/decred/dcrdex/commit/82833e00bdbf4481535c8f57e922312dc06e2840), 173 [1890057](https://github.com/decred/dcrdex/commit/1890057fcfee8963f303a5ad354d15f0683f178b), 174 [deab1c9](https://github.com/decred/dcrdex/commit/deab1c9deeab70876059d5246c60f023fa6a3e28), 175 [3b4f2eb](https://github.com/decred/dcrdex/commit/3b4f2eb6b06f72cba47ecd16cd94bd44ba14f655)) 176 - Decred SPV wallet support (dcrwallet in SPV mode), use compact filters in 177 counterparty redemption search, gettxout, gettransaction, etc. 178 ([fe1995a](https://github.com/decred/dcrdex/commit/fe1995a42289f29e18bcccd9e537a2ba707a8ad1), 179 [1c508cb](https://github.com/decred/dcrdex/commit/1c508cb04d1cc0618843f03abbe4baff2c6a94e9), 180 [c5413e8](https://github.com/decred/dcrdex/commit/c5413e8e76cd8f1ca59e2eba524b929cfbf4fa1d), 181 [13d12a8](https://github.com/decred/dcrdex/commit/13d12a866dd6886efbca366e665129a67b14a256)) 182 - Add historical market data charts (candle sticks) to the market page. 183 ([d11f1ce](https://github.com/decred/dcrdex/commit/d11f1ce9ea1313e17fdc588d0f3d9f0e9e153444)) 184 - Display prices from a new spot price feed from a server market. The current 185 rate and 24-hour percent change are displayed in the market list on the left 186 of the markets page, and in the browser title. 187 ([bb05332](https://github.com/decred/dcrdex/commit/bb05332e7720aa8315e03d35c7fed9cb5023d192), 188 [7c0fe85](https://github.com/decred/dcrdex/commit/7c0fe85a565fc39b4492f22e00dbaad1f5ad382c), 189 [8ac1498](https://github.com/decred/dcrdex/commit/8ac1498e5573972863985e6b0b7c9f947966087c), 190 [10d78e9](https://github.com/decred/dcrdex/commit/10d78e952ba4a05fbb16d1421e637bf00c94ccba), 191 [61e9138](https://github.com/decred/dcrdex/commit/61e913882708a2cfc059c1c47b4c48e48462d99c), 192 [6231cf4](https://github.com/decred/dcrdex/commit/6231cf403c58a5e39e2a53e7c6457180393cd375)) 193 - Support paying registration fees with multiple assets, now including BTC. The 194 `getfee` RPC is replaced with `getdexconfig`. 195 ([4f2ab59](https://github.com/decred/dcrdex/commit/4f2ab59c6fb1fa9e60cb8b953a9a294a2e7c925a), 196 [0d4075a](https://github.com/decred/dcrdex/commit/0d4075a5451f203eaf9a371b1c4b10bc9a25f287), 197 [07c2001](https://github.com/decred/dcrdex/commit/07c20017e565f9135b6e28c9fcb815dfc4445b11)) 198 - Improved registration sequence and form design. Add a table showing all 199 markets offered by a server when registering. 200 ([ebfcff7](https://github.com/decred/dcrdex/commit/ebfcff744ad90754aba651c0a5d0b998543771a3), 201 [027b480](https://github.com/decred/dcrdex/commit/027b480ed39c3b12868547f9590f5fbf19d81359), 202 [bbf161e](https://github.com/decred/dcrdex/commit/bbf161eb48ef70f0611ef8f2a9fdfe04690178ea)) 203 - The wallet balance is double checked prior attempting registration. 204 ([a5da7349](https://github.com/decred/dcrdex/commit/a5da7349041a005f23aea4a7eb895dd53edc9a47)) 205 - Add the ability to persist password on UI login. This adds a checkbox to the 206 login page that gives the user the option to persist their password for the 207 session. When selected, all the password fields, other than disable account 208 and view seed, will no longer be displayed. 209 ([7a0c387](https://github.com/decred/dcrdex/commit/7a0c38735dc030d42ce7af2eb21a25962d4e3ea1)) 210 - Internationalization support for frontend and backend notifications. 211 ([7c3d865](https://github.com/decred/dcrdex/commit/7c3d865b21aa5911cd7464c66a93e4070e0bcdd8), 212 [6e6cac4](https://github.com/decred/dcrdex/commit/6e6cac4bf16f42ee6ad9e47721bb15263874f22d), 213 [0c4d240](https://github.com/decred/dcrdex/commit/0c4d2405d6c2ebe4aa6319cf1245ffd5d5f4bf19), 214 [11d4e39](https://github.com/decred/dcrdex/commit/11d4e39fa7d023f99289d0277fc5d9a0fe810166)) 215 - Added a pt-BR translation. 216 ([de0f679](https://github.com/decred/dcrdex/commit/de0f6797ad96680a13d67ae4ce785cfe5afac9e2)) 217 - Added a zh-CN translation. 218 ([de1d00e](https://github.com/decred/dcrdex/commit/de1d00e78fa66c8bef7ac468c6bc91335b2eb82a), 219 [d42e2fa](https://github.com/decred/dcrdex/commit/d42e2fa3af4438602ca091cb58a12519564dc288)) 220 - Lot size and rate step are now parameters of a market, not an asset. For newer 221 clients that expect lot size and rate step to be market parameters, this 222 detects and supports an older server. Older clients may not support newer 223 servers, depending on their configuration. 224 ([4231914](https://github.com/decred/dcrdex/commit/423191441b5bfb569cba6a5de1dcd5a1a8f57855), 225 [45e3894](https://github.com/decred/dcrdex/commit/45e3894c1e6dc692ecb2b6a25d4388e72128a43f)) 226 - To make order loading in the client faster, split the client order database 227 into separate active and archived orders buckets. 228 ([e58a139](https://github.com/decred/dcrdex/commit/e58a139d145494f7012e7d980d2f257fb4a1e71e)) 229 - To make match loading in the client faster, split the client match database 230 into separate active and archived matches buckets. 231 ([283744d](https://github.com/decred/dcrdex/commit/283744d68021b82c43c0a1c6ed2817c3d658a609), 232 [e122088](https://github.com/decred/dcrdex/commit/e1220888b9d36f675e9c7972077aa287b97ed7d9), 233 [ee34cba](https://github.com/decred/dcrdex/commit/ee34cba600a3a751ef8273b106203ef341a89a7c)) 234 - Log backup swap refund transactions so that the user can salvage funds in the 235 case that they lose access to the client but still have the logs. These are 236 for BACKUP ONLY as the client will do the refund, and if the user broadcasts 237 them unnecessarily, they may cause unrecoverable client issues that could 238 necessitate recreating the client DB. 239 ([9b012f9](https://github.com/decred/dcrdex/commit/9b012f9242bea5e82431726cd27bbd7d2372294e)) 240 - Bin order tables by rate. Instead of displaying each individual order's 241 quantity and rate on a separate row, the total quantity available at each rate 242 will be displayed. Epoch orders are binned along with all other orders, and 243 the check mark will no longer be displayed. 244 ([f7086ab](https://github.com/decred/dcrdex/commit/f7086abac43add3816076cc24ca54875409fe5c6)) 245 - Introduce an "expired" order status for executed orders with 0% filled, and 246 for orders that are still booked but currently settling matches to 247 "booked/settling". 248 ([c8d8d1d](https://github.com/decred/dcrdex/commit/c8d8d1d33d08b02a7cdedbdadfde9cb84a7cc558)) 249 - The order confirmation dialog is now modal, staying open until the submission 250 request is processed, displaying any errors on the form. 251 ([ff59dbb](https://github.com/decred/dcrdex/commit/ff59dbb8a64ec5d50a348ea918206870657ff387)) 252 - Add an `assetseed` command line tool for the user to derive various 253 asset/wallet seeds from their application seed. 254 ([4ee4c47](https://github.com/decred/dcrdex/commit/4ee4c478fe7941bff575af1c39617d7945ee091e)) 255 - The Bitcoin Core `rpcconnect` setting is now recognized and used to configure 256 the RPC client for such wallets. 257 ([2eaa733](https://github.com/decred/dcrdex/commit/2eaa733624d41414d96cb13e377be38af3cf340f)) 258 - When connecting to a Bitcoin Core wallet, check the wallet type to prevent use 259 of "descriptor" wallets, which do not support the full set of RPCs required by 260 the DEX client. See 261 <https://bitcoincore.org/en/releases/0.21.0/#experimental-descriptor-wallets> 262 for more information on descriptor wallets. 263 ([256cd69](https://github.com/decred/dcrdex/commit/256cd69a73ccaa2af0a31757a5d62e4aab57eddd)) 264 - If a user has active trades, they must be settled by a wallet that can 265 complete those trades. Disallow changing to a new wallet that cannot do this. 266 ([3fa59cf](https://github.com/decred/dcrdex/commit/3fa59cf4dad60a991346795da25666f9bd215af2), 267 [aee00c8](https://github.com/decred/dcrdex/commit/aee00c8abf644b2209a054627090365a0e1858d3), 268 [0fc475d](https://github.com/decred/dcrdex/commit/0fc475d99afd93e6f256db7522c701b4e004f8e0)) 269 - Add a "Fees" section to the readme to clarify on-chain transaction fees vs. 270 the registration fee. 271 ([352809](https://github.com/decred/dcrdex/commit/35280962fd0f2631f3e9c0aa1977a1e3feb71768)) 272 - Automatically check balance before attempting to pay registration fees, and 273 show a clear error on the frontend. 274 ([cb0e295](https://github.com/decred/dcrdex/commit/cb0e295c185623f38718bbdfd262c904975a2a52)) 275 - Optionally rebroadcast counterparty swap transactions after auditing 276 contracts, and log the counterparty redeem script for recovery purposes. Do 277 this asynchronously since the outcome is not important. 278 ([2e4fe26](https://github.com/decred/dcrdex/commit/2e4fe260b078fa5cb5557b7824bd36aa42ebd8e7), 279 [0f7d561](https://github.com/decred/dcrdex/commit/0f7d561a76e57b95174bcdde88a61c51d291f226)) 280 - Wallet connection errors that are encountered on login are show in the 281 notification menu. 282 ([5149ee2](https://github.com/decred/dcrdex/commit/5149ee2e336047d63eee9a16cddf212fea544d30)) 283 284 ### Fixes 285 286 The most notable fixes are: 287 288 - Prevent high CPU use with max order size computations. 289 ([964fcc0](https://github.com/decred/dcrdex/commit/964fcc0a3cc0e9054f9e171a791ecb84972d5048)) 290 - Keep order form hidden when wallets are not configured (regression fix). 291 ([5546ae2](https://github.com/decred/dcrdex/commit/5546ae2964a02932153c074bac38ca930020f634)) 292 - Shutdown the DCR websocket client when a connection attempt fails. 293 ([16f357b](https://github.com/decred/dcrdex/commit/16f357b5abaa15a3705fd8ddc1dac538f70bf598)) 294 - With both client and server btc asset backends using dcrd's rpcclient, use the 295 correct error type to correctly recognize specific RPC errors from bitcoind. 296 ([03f9973](https://github.com/decred/dcrdex/commit/03f9973b77f69f0c8ac0527cc1f7f6e5e15f34ad)) 297 - Fix an unbuffered `os.Signal` channel (CTRL+C was potentially ignored). 298 ([e755134](https://github.com/decred/dcrdex/commit/e75513453abae7f1a3e76e82b1c6582888b00ec8)) 299 - Validate the commitment checksum in a match proof notification against the 300 checksum from the preimage request to ensure the server did not change the 301 epoch after the client provided a preimage for an order. 302 ([1c06280](https://github.com/decred/dcrdex/commit/1c06280e1114ad1975a595f70412152ca4538f01)) 303 - Allow only one preimage request per order. 304 ([0ab34db](https://github.com/decred/dcrdex/commit/0ab34db44d141aa00300712536306f136eaae832)) 305 - Fix depth chart resizing errors. 306 ([fda9187](https://github.com/decred/dcrdex/commit/fda918722c3e2ef96cb9d9cb1d573270c99d7d64), 307 [1640b70](https://github.com/decred/dcrdex/commit/1640b7021f70efae83c18795d89ad3700c04cc68)) 308 - Fix max order amount when balance is insufficient for a single lot. Other max 309 order fixes. 310 ([f118992](https://github.com/decred/dcrdex/commit/f118992badfaa3736fa652594ab6a8df76836e74), 311 [015961e](https://github.com/decred/dcrdex/commit/015961e1293079f3c356b48d6378499a0f4cf83e)) 312 - Fix an incorrect asset symbol in the client error log. 313 ([92c49d5](https://github.com/decred/dcrdex/commit/92c49d540ec6e1f3ccd9a8abc29a19a9156c088f)) 314 - Correct determination of main chain ancestor on reorg. 315 ([cfa95eb](https://github.com/decred/dcrdex/commit/cfa95ebaa34d954f078fef27289c5232ecb0fbae)) 316 - Prevent hang on Decred RPC client shutdown. 317 ([0490291](https://github.com/decred/dcrdex/commit/049029115ed80cab484babec9c7a25626c3518b1)) 318 - Restore vertical scroll in orders tables. 319 ([499ab0d](https://github.com/decred/dcrdex/commit/499ab0dff19093c993df71bba14e3884b269d0f5)) 320 - Always generate a refund transaction before broadcasting a swap transaction. 321 ([bd426fb](https://github.com/decred/dcrdex/commit/bd426fb36118b8561759fa797d2e0981bf8b37a3)) 322 - Do not log negative swap contract expiry durations (when they are just waiting 323 on consensus rules). 324 ([85bc90f](https://github.com/decred/dcrdex/commit/85bc90fc28ef83b681682c00e7d6809447168b40)) 325 - Fix `match_status` requests failing if "tx data" were required for BTC swap 326 transactions. 327 ([15f66bc](https://github.com/decred/dcrdex/commit/15f66bcb477ec9221aab927a5ceae306412a98b5)) 328 - Do not try to check for a site directory identified by an empty string. 329 ([6743411](https://github.com/decred/dcrdex/commit/6743411c0e6ef58efcfeb7c78b42c67359be7731)) 330 - Resolve data races with `client/core.Core.conns`. 331 ([6acc21f](https://github.com/decred/dcrdex/commit/6acc21fff622d3fe8fcf68e8d075cf3d2fceebf1)) 332 - Leave the sequence in Bitcoin and Decred redeem transaction inputs set to the 333 max value, since using a lower value was only needed for the refunds when the 334 CLTV opcode is used and locktime is relevant. 335 ([28473de](https://github.com/decred/dcrdex/commit/28473de0021ff5d2bf53e2a602447b55151ac8de)) 336 - Before broadcasting a swap transaction after startup or reconnect, perform 337 match status resolution to ensure the match is not revoked. 338 ([983df6b](https://github.com/decred/dcrdex/commit/983df6b04739286950a6ac0293307a46852aaaa2)) 339 - Avoid a (recoverable) panic on RPC wallet connect failure. 340 ([8478b6c](https://github.com/decred/dcrdex/commit/8478b6cf85e0d5d685e78657ec4e83e32fed45b0)) 341 - Add a missing error check in `server/db/driver/pg.(*Archiver).LoadEpochStats`. 342 ([7957691](https://github.com/decred/dcrdex/commit/795769123971c5dcf8ebfe589e8a4810f737470f)) 343 - Fix handling of P2SH funding UTXOs when 0-conf coins are included. 344 ([dda8654](https://github.com/decred/dcrdex/commit/dda86540ad9b585b3165bf0eb06c733576596a9d)) 345 - Show a properly scaled exchange rate in the depth chart's price legend. 346 ([94eedbd](https://github.com/decred/dcrdex/commit/94eedbd56241e10c40859ed2206f354688ce8c5e)) 347 - Avoid a potential panic in the BTC native wallet in the event that the best 348 block hash cannot be provided by the wallet. 349 ([1911080](https://github.com/decred/dcrdex/commit/19110802ab238dd19d3612e2e82e34b8eb4dedd6)) 350 - Promote DEX connections to persistent when the `Register` method finds that 351 the account is already paid. Normally this is done in `DiscoverAccount`, but 352 should be handled by `Register` as well. 353 ([a897f10](https://github.com/decred/dcrdex/commit/a897f10185936292e884e97d922244db81de5856)) 354 - Omit commas from the withdraw amount text field when clicking the max amount. 355 ([c987fa8](https://github.com/decred/dcrdex/commit/c987fa86666984e2e926fda6d3e918fbedb840f1)) 356 357 ## Server 358 359 - Lot size and rate step are now configured per-market, not per-asset. The 360 dcrdex server app now errors if markets.json has lot size or rate step set for 361 any asset, and if any market lacks a non-zero lot size or rate step. A 362 `'config'` response is generated in different ways depending on if a given 363 asset has consistent lot sizes and rate steps across all markets. If 364 consistent, it will also set the `LotSize`/`RateStep` in the `msgjson.Asset`. 365 If not consistent, the values will be zero/omitted and a warning will be 366 logged that old clients will not work with the asset. 367 ([4231914](https://github.com/decred/dcrdex/commit/423191441b5bfb569cba6a5de1dcd5a1a8f57855)) 368 - Support lot size changes without manual DB updates. 369 ([509205d](https://github.com/decred/dcrdex/commit/509205d4ce4d711b96bb41e596c2c8f100ba7596)) 370 - Accept registration fee payment in multiple assets, including BTC. An operator 371 now specifies the accepted fee assets and amounts in market.json settings 372 instead of dcrdex.conf. The `'config'` response now includes a `regFees` field 373 that communicates these values to clients. Fee address derivation is moved out 374 of server/db and into the server/asset packages. To accept BTC, an operator 375 must provide a zpub extended public key encoding. 376 ([4f2ab59](https://github.com/decred/dcrdex/commit/4f2ab59c6fb1fa9e60cb8b953a9a294a2e7c925a), 377 [0124247](https://github.com/decred/dcrdex/commit/012424702e9f5ddcd8459d04f25eb6bceb859207)) 378 - Support clients with HD account key derivation. Return special errors during 379 registration when the client's key already exists or is suspended. 380 ([b66a35f](https://github.com/decred/dcrdex/commit/b66a35f24215456763a16cee9c32875f61f9814b)) 381 - Allow a client to submit a cancel order while a market is suspended. The 382 database entries after a cancel order during a market suspension will be 383 identical to one that gets matched while the market is running, except the 384 preimage will not be recorded (or requested). Also there will be no entry in 385 the epochs table for the epoch in which this order was "matched". 386 ([4a3dde1](https://github.com/decred/dcrdex/commit/4a3dde1ef23b8bb40e68130d528d6977486dbf02)) 387 - Route-level request rate limiting. 388 ([5e2ab91](https://github.com/decred/dcrdex/commit/5e2ab91533d3fdf9ce774d104fbff844347baa1f), 389 [132b16f](https://github.com/decred/dcrdex/commit/132b16f88a619181b1c2f931359816480f8808f2)) 390 - Add a new `price_feed` subscription request route, which is handled by the 391 `BookRouter`, and sends `msgjson.Spot` messages to subscribed clients in 392 `price_update` notifications. 393 ([bb05332](https://github.com/decred/dcrdex/commit/bb05332e7720aa8315e03d35c7fed9cb5023d192)) 394 - Add a `usermatches` command line tool for exporting decoded match data 395 directly from the database. 396 ([0844058](https://github.com/decred/dcrdex/commit/08440585fbaa7747c142d7073b0ff0305cf72f32)) 397 - Access postgres notices and log them depending on severity. 398 ([d6a9c33](https://github.com/decred/dcrdex/commit/d6a9c33d2c68a9f067f7ea8584da176042abefdf)) 399 - Remove pre-schema-versioning DB pseudo-upgrade. 400 ([dad4a2e](https://github.com/decred/dcrdex/commit/dad4a2e085417f4f14a50b84276e3133f2aa9f51)) 401 - Increase websocket read limits. Increases the server's authorized read limit 402 by a factor of 4 to allow a large number of orders in a single epoch, and with 403 more funding coins than normal. Also doubles the unauthorized/default read 404 limit, which is still quite small at 8192 bytes. 405 ([de775fa](https://github.com/decred/dcrdex/commit/de775fa067e797c6a2f17d7e8eb549aff9752954)) 406 - Remove the `ban` and `unban` administrative functions. Forgiveness is done at 407 the level of the match only now, and all administrative interference will go 408 away in the future anyway (both fidelity bonds and mesh configuration). 409 ([dfbbe9a](https://github.com/decred/dcrdex/commit/dfbbe9a60c5efa577c5cd03f848485927e6c59b3)) 410 - Exclude the maker address from a cancel order match's `msgjson.Match`. 411 ([dd31a8](https://github.com/decred/dcrdex/commit/dd31a8d28c524dcff9763b8b333ee200d65af1e2)) 412 - Abandon orphaned epoch orders on startup, which may happen after a hard server 413 crash. 414 ([bd1599e](https://github.com/decred/dcrdex/commit/bd1599e2545a7cadd5b52fbfd2091b4df2cdeeb8)) 415 - Validate the taker's contract hash during audit, complementing the existing 416 client-side check. 417 ([10bb7a3](https://github.com/decred/dcrdex/commit/10bb7a3e9f704afc858df1fb4b1cee3ac595284f)) 418 - Fix incorrect encoding of preimage and commitment in an error log. 419 ([bc60036](https://github.com/decred/dcrdex/commit/bc60036ba5f2f2a5ed441fd27322340a39911ad7)) 420 - Enable the `rpcclient` package logger, and set up a logging subsystem for the 421 `rpcclient` to see connection attempts and other notices from dcrd's 422 `rpcclient`. 423 ([c1f03e0](https://github.com/decred/dcrdex/commit/c1f03e08b4dc2249fb98abf6ea5a19ceacb2a5d2)) 424 - Fix required order funds check with market buys. 425 ([8ca81e2](https://github.com/decred/dcrdex/commit/8ca81e2b4b663222d553a252ee501bc91cda1535)) 426 - Export candles types and make a `dex/candles` package. 427 ([26c149a](https://github.com/decred/dcrdex/commit/26c149af45ed42ebf33c8a781925424d087413dd), 428 [d11f1ce](https://github.com/decred/dcrdex/commit/d11f1ce9ea1313e17fdc588d0f3d9f0e9e153444)) 429 - Modify `server/dex.feeFetcher` with the context arg, and add a `LastRate` method 430 for consumers to use as a fallback if FeeRate fails. Fix an issue where a zero 431 rate would be cached on `FeeRate` error. 432 ([7ffae7b](https://github.com/decred/dcrdex/commit/7ffae7b215746b646c2ff98084040d594d856493)) 433 434 ## Developer 435 436 - Update build requirements to Go 1.16 or 1.17, and Node.js 16 or 17. 437 ([75c9b7a](https://github.com/decred/dcrdex/commit/75c9b7a765767f0555e7642fc70e8df3160b65a1), 438 [b6cfe2a](https://github.com/decred/dcrdex/commit/b6cfe2aeb9de656531ac0594042575198e9ceaa9), 439 [6c95f4f](https://github.com/decred/dcrdex/commit/6c95f4fdbdd6274465fc2d2b2f2595323bd09142), 440 [ce823c3](https://github.com/decred/dcrdex/commit/ce823c3315bc8d68b9b2acf81c9265607570b04c)) 441 - (Breaking) Context-enable `asset.Backend.FeeRate`. With a websocket RPC client with 442 auto-reconnect where RPCs hang when the RPC server is disconnected, it is 443 helpful to allow the caller to cancel requests. Give FeeRate a context arg. 444 ([7ffae7b](https://github.com/decred/dcrdex/commit/7ffae7b215746b646c2ff98084040d594d856493)) 445 - (Breaking) Give notifications topic IDs for internationalization support. 446 ([c994f03](https://github.com/decred/dcrdex/commit/c994f032fe0e9a36e58a9a984dd924734c659e36)) 447 - Add `(*Core).DiscoverAccount` and an RPC (dexcctl) endpoint to determine if an 448 account exists at a DEX server after restoring from seed. 449 ([59868fe](https://github.com/decred/dcrdex/commit/59868fe81173a2d67100ff071d01552cc74fcb1a), 450 [524b5a1](https://github.com/decred/dcrdex/commit/524b5a1019eb543cb41e49d5a50443f25f2b18f2)) 451 - (Breaking) `(*Core).InitializeClient` has a new `restorationSeed []byte` input 452 argument, which may be `nil` to generate a new app seed, or a previous seed 453 for to restore a previous identity. The `(*Core).ExportSeed` method is added 454 to retrieve the generated seed. Further, the keys, encrypted app seed, and the 455 relevant encryption parameters are embodied by the 456 `client/db.PrimaryCredentials` struct, and the DB interface has new methods 457 for upgrading to, initializing, and updating the `PrimaryCredentials`. When 458 upgrading, it is necessary call `Login` for the seed to be generated and the 459 new credentials scheme applied, otherwise most methods will fail with "primary 460 credentials not retrieved. Is the client initialized?". 461 ([b66a35f](https://github.com/decred/dcrdex/commit/b66a35f24215456763a16cee9c32875f61f9814b)) 462 - (Breaking) To support paying registration fees with multiple assets, the 463 `core.Exchange` struct has new `RegFees` and `PendingFee` fields, the 464 deprecated `ConfsRequired` and `RegConfirms` fields are removed, but the 465 deprecated `Fee` field (DCR-specific) remains for compatibility. 466 `(*Core).GetFee` is removed and `GetDEXConfig` should be used instead. The 467 `core.RegisterForm` struct now has an `Asset *uint32` field to specify which 468 asset to pay the fee with. The default if unset is 42 (DCR). 469 ([4f2ab59](https://github.com/decred/dcrdex/commit/4f2ab59c6fb1fa9e60cb8b953a9a294a2e7c925a)) 470 - Remove a hard-coded 1e8 constant in the client. This introduces a `UnitInfo` 471 type that is defined for each asset and returned in new fields of 472 `asset.WalletInfo`, `dex.Asset`, and `msgjson.Asset`. Its 473 `(*UnitInfo).ConventionalString` method should be used to convert from atomic 474 units to a conventional string representation (e.g. "1.2 DCR"). The 475 `client/core.{MiniOrder,RemainderUpdate}` structs are updated with a 476 `QtyAtomic uint64` field to complement the existing `Qty float64` fields. 477 `MiniOrder` also has a new `MsgRate uint64` field, which communicates rate in 478 "message-rate encoding" as [described in the 479 spec](https://github.com/decred/dcrdex/blob/master/spec/comm.mediawiki#Rate_Encoding), 480 and now modeled in `dex/calc.RateEncodingFactor`, with the new encoding 481 helpers `ConventionalRate` and `ConventionalRateAlt`. 482 ([08a72d1](https://github.com/decred/dcrdex/commit/08a72d1cd085af6a89dc535ab03184efa6083ad9), 483 [ad1c20a](https://github.com/decred/dcrdex/commit/ad1c20a71c10ade6752d422c449fb89b1c5a2338), 484 [75fa328](https://github.com/decred/dcrdex/commit/75fa328272d756f13e303c570dba69e07ce0b2c5), 485 [207ddcf](https://github.com/decred/dcrdex/commit/207ddcff8d52502b098e93203051f80cc1f862c3)) 486 - Add `SpotPrice *msgjson.Spot` field to `core/Market`. 487 ([bb05332](https://github.com/decred/dcrdex/commit/bb05332e7720aa8315e03d35c7fed9cb5023d192)) 488 - (Breaking) To support multiple types of wallets, `client/asset.WalletInfo` has 489 a new `AvailableWallets []*WalletDefinition` field to describe available 490 wallet types. The `client/asset.Driver` now has `Create` and `Exists` methods 491 for "seeded" (native, built-in) wallet types. `(*Core).ReconfigureWallet` 492 replaces the `assetID` and `cfg` fields with a `core.WalletForm struct`, which 493 now has a `Type string` field. The `core.WalletState` struct now has a new 494 `WalletType string` field. A type of `""` (empty string) will be recognized as 495 the legacy RPC wallets 496 ([d202f6d](https://github.com/decred/dcrdex/commit/d202f6d4d0de6884be7dc1bd73a0e865835d6a9b)) 497 - (Breaking) Move the shutdown prompt function from client/core into client/cmd/dexc. The 498 `(*Core).PromptShutdown` method is removed. 499 ([1248eb9](https://github.com/decred/dcrdex/commit/1248eb92275cf7dddd98b3cc7c1b97a81be4ab5f)) 500 - (Breaking) Remove the `LotSize` and `RateStep` fields from `dex.Asset`. Add 501 the `LotSize` and `RateStep` fields to `msgjson.Market`. `msgjson.Asset` still 502 has `LotSize` and `RateStep`, but they are tagged with `omitempty`, and will 503 be zero/omitted when market configs require multiple different lot sizes or 504 rate steps for an asset. The dcrdex server harness uses a configuration with 505 two markets with DCR as the base asset and *different* lot sizes. 506 ([4231914](https://github.com/decred/dcrdex/commit/423191441b5bfb569cba6a5de1dcd5a1a8f57855)) 507 508 - Update Decred dependencies for RPC client syntax changes to `EstimateSmartFee` 509 and `GetTxOut`, and decentralized treasury changes to various stake package 510 functions. 511 ([8976d8d](https://github.com/decred/dcrdex/commit/8976d8d166706ba626cee437d8765fa3ca3794e4)) 512 - Update Decred dependencies for auto-revocation agenda changes. 513 ([c2bdeb5](https://github.com/decred/dcrdex/commit/c2bdeb5ab7201460f155cad67f84d9ac99b7c9e5)) 514 - Update Decred `stdscript` dependency and simplify much of the dex/networks/dcr 515 package. Several exported functions and types are removed or renamed (breaking 516 changes). 517 ([920b35a](https://github.com/decred/dcrdex/commit/920b35a59c5def1d1689976a55a108b106a39b8b)) 518 - Replace dcrutil usages with stdaddr. 519 ([f37fcbd](https://github.com/decred/dcrdex/commit/f37fcbd2866de14b17b6119177ccb008faf31366)) 520 - Add `build` and `run` scripts to the dcrdex harness for easier testing. 521 ([e0a64a7](https://github.com/decred/dcrdex/commit/e0a64a7e66c812daa69b5ef3283c145e0fa33210)) 522 - Use the new `GetTxOutResult.ScriptPubKey.Version` field with dcrd 1.7. Add 523 script version checks and use actual version when decoding scripts. 524 ([fcd3926](https://github.com/decred/dcrdex/commit/fcd3926fe989d987d18e873ff604f4a754af4ce4)) 525 - Webpack 5 and other build system updates. 526 ([1298264](https://github.com/decred/dcrdex/commit/129826436361027a95c0a066b55f7e743e293280), 527 [93ac487](https://github.com/decred/dcrdex/commit/93ac4875b847a8c7a63bc889a9ebde966293f10c), 528 [fa9b19](https://github.com/decred/dcrdex/commit/fa9b19d1c266d3e1a13e1f54c20d4d42946eed3a)) 529 - Frontend refactoring. 530 ([581f852](https://github.com/decred/dcrdex/commit/581f852e249410ee0af030b0a7d277dd517eb085), 531 [f7bb867](https://github.com/decred/dcrdex/commit/f7bb867dda5193987280848224796b26220405c2)) 532 - Improve the Decred harness chain reorganization testing function. 533 ([c34f5f7](https://github.com/decred/dcrdex/commit/c34f5f7407828e6be12b20df40079b0b49d6b4fd), 534 [90b1d92](https://github.com/decred/dcrdex/commit/90b1d9289eb55e74d59840f3a856d44a313559df)) 535 - With internationalization support, CI now checks that the localized_html files 536 are up-to-date. 537 ([c2ecd94](https://github.com/decred/dcrdex/commit/c2ecd94b4fbf0a9fe8c407573a4df3eb3083b4d8)) 538 - Add a build and packaging script and update it for the localized html 539 templates. 540 ([245ed7a](https://github.com/decred/dcrdex/commit/245ed7a25eac98d22305eb8ecbb543599923a62c), 541 [cf4eb6d](https://github.com/decred/dcrdex/commit/cf4eb6d9afbdb26250fd58f8b30056c105de1ad0)) 542 - Always use IPv4 in comms tests. 543 ([7523694](https://github.com/decred/dcrdex/commit/7523694ebf4c7c434e5d982cf95f07bd0aa50bad)) 544 - Update the server administration section of the specification with a link to 545 the wiki and an ETH market example. 546 ([c7ceb8c](https://github.com/decred/dcrdex/commit/c7ceb8cfb72c6b966514588a9c0fd2324b7c351e)) 547 - Remove all usage of the deprecated io/ioutil standard library package. 548 ([b294a00](https://github.com/decred/dcrdex/commit/b294a00be0960821d131357a3ad19adde4e7cbab)) 549 - Set btc test harness node's debug levels per-subsystem. 550 ([aa76b62](https://github.com/decred/dcrdex/commit/aa76b62600a37a468b0ad4f4fbb4260fed8722d9)) 551 - Add build meta data to dexcctl. 552 ([9c8f52f](https://github.com/decred/dcrdex/commit/9c8f52f22a71e48097ee08332301f11afdd40777), 553 [16c81be](https://github.com/decred/dcrdex/commit/16c81be31c9abc3cb7fb05a5065a92d925b16596)) 554 555 ## Ethereum (not enabled in 0.4) 556 557 - Add internal ethereum client 558 ([16da72f](https://github.com/decred/dcrdex/commit/16da72f5e3af049db315400c68b87d7957c15bfa), 559 [f4194e0](https://github.com/decred/dcrdex/commit/f4194e0b064133e4dce8bc4bea1eac148d6e9793), 560 [d0e5f31](https://github.com/decred/dcrdex/commit/d0e5f31015815f898b35cda6fff30e495753e5f5), 561 [3ea9141](https://github.com/decred/dcrdex/commit/3ea91418306c658d15dfbd369a737ec5eaf01e9b)) 562 - Add the ETH swap contract solidity and compiled ABI. 563 ([a7046c6](https://github.com/decred/dcrdex/commit/a7046c670b4f824b7b5e237c9efcecbd8fc5e604), 564 [a6eca9e](https://github.com/decred/dcrdex/commit/a6eca9e972507e8e797a0d4b844e4bafd5cdc9ee), 565 [39fbfce](https://github.com/decred/dcrdex/commit/39fbfce546a70b98d1285a237af717b8478cc878), 566 [beaf951](https://github.com/decred/dcrdex/commit/beaf951f96b7fff8162dc9acc5cf9798519eac41), 567 [202465e](https://github.com/decred/dcrdex/commit/202465e1ee4e717f4a6ba1563c878a2a282b01a1), 568 [ead7bdd](https://github.com/decred/dcrdex/commit/ead7bdd89a037650966b0e9cca7e6c5a00c4326a)) 569 - Implement the required `client/asset.Wallet` methods. 570 ([783bf2c](https://github.com/decred/dcrdex/commit/783bf2c41ae5f22a4af8c82e9d15838e6d55ec8e), 571 [72212a8](https://github.com/decred/dcrdex/commit/72212a8bfa41ec3a22a6d9bcfa9e6471584dbae5), 572 [d9611e5](https://github.com/decred/dcrdex/commit/d9611e5678da6cbc1726a72e696d0d193e02443e), 573 [8bd3a34](https://github.com/decred/dcrdex/commit/8bd3a34054f6961493cae64e8958a7e7d90e06d9), 574 [5f1928b](https://github.com/decred/dcrdex/commit/5f1928bc9bf3408afe40f60b4ca043172246defe), 575 [cef9c5c](https://github.com/decred/dcrdex/commit/cef9c5c2b22a44ee434bb5dd7b00b54ad375043d)) 576 - Implement the required `server/asset.Backend` methods. 577 ([fed96f5](https://github.com/decred/dcrdex/commit/fed96f585cdd7d423589d3fb1ebc78aefa3c3f82), 578 [9e1e0cb](https://github.com/decred/dcrdex/commit/9e1e0cb8787ca6ec48463ac006084c3a1e0ee461), 579 [4aa78e1](https://github.com/decred/dcrdex/commit/4aa78e14c4d0b35830b1719d5febf19086e714fe), 580 [2dac253](https://github.com/decred/dcrdex/commit/2dac2536a94431442ac23769a2142e46b8bd78c6), 581 [05367f1](https://github.com/decred/dcrdex/commit/05367f10fbc7c69ba303821d3f75e045f705689f)) 582 - Add a shell script that generates go code containing the runtime bytecode of 583 the swap contract. 584 ([7f9793e](https://github.com/decred/dcrdex/commit/7f9793e3932b1ebcf1fa0e0fc29e5dec1333fb2c), 585 [9df4f78](https://github.com/decred/dcrdex/commit/9df4f78ad99c479f1033f6a878c9482b6aea71bd)) 586 - Functions to decode transaction data. 587 ([ec3b7fd](https://github.com/decred/dcrdex/commit/ec3b7fdeada0e7609e176fd93e06118f46c8c8fe)) 588 - Derive ETH wallet account keys from the dex client application seed. 589 ([7c2058f](https://github.com/decred/dcrdex/commit/7c2058ff24d89979ddac013054deb74471900764)) 590 - Use snap mode for server nodes in harness. 591 ([68d1e64](https://github.com/decred/dcrdex/commit/68d1e64a73c10a98d7a00035985b8b7828cb361c)) 592 593 ## Build requirements 594 595 - Go 1.16 or 1.17 596 - Node 16 is the minimum supported version for building the site assets. 597 - dcrd and dcrwallet must *still* be built from their `release-v1.7` branches. 598 - The minimum required dcrwallet RPC server version is 8.8.0, which corresponds 599 to the v1.7.0 release of dcrwallet, but the latest `release-v1.7.x` tag should 600 be used. 601 602 ## Code Summary 603 604 186 commits, 330 files changed, 50,332 insertions(+), 23,221 deletions(-) 605 606 <https://github.com/decred/dcrdex/compare/ba59397...release-v0.4> 607 608 12 contributors 609 610 - Amir Massarwa (@amassarwi) 611 - Brian Stafford (@buck54321) 612 - David Hill (@dajohi) 613 - Dominic Ting 614 - @iurii 615 - Joe Gruffins (@JoeGruffins) 616 - Jonathan Chappelow (@chappjc) 617 - @martonp 618 - Peter Banik (@peterzen) 619 - Victor Oliveira (@vctt94) 620 - Wisdom Arerosuoghene (@itswisdomagain) 621 - @xaur