When is a DEx order considered "active" and how can I cancel it?

If you place order on the DEx, it is not considered active because it first need to enter the blockchain, which may take couple of minutes.

Once that happens, you will get a notification that your order is active and you will be able to see that in your wallet’s history (select correct address from drop down list in History pane).

At that time you will also be able to see your offer (order) under Exchange > Open orders.

As long as your order has not been matched, you can click Cancel to cancel it.

Active orders and BTC Pay

Note that BTC Pay is available only in the CLI and API.

If your order was to sell BTC, you will still lose the fee_provided (by default 1% of BTC order size). This is done so that the DEx does not get flooded by orders from users who are not serious about concluding their matched orders with payments.

If your order was to sell XCP or other Counterparty-based token for BTC, you will lose 0.002 + 2 * 0.00078 BTC (one transaction + 2 escrow fees).

On the far right of the second image above you can see that your offer to sell (or buy, as the case may be) will remain active for approximately 11 days. That is a rough estimate for the time required for Bitcoin to add 2,000 blocks to its blockchain. That is the current default order expiration time and it can be set on a per-wallet basis in Settings > Default Expiration (BTC Sell). It is not recommended to change this to a much lower value. Because the order was broadcast at block 321478 (screenshot 1), unless it gets matched it will expire 2,000 blocks later, i.e. at block 323478 (screenshot 2).

Once a BTC Sell order has been matched, it cannot be cancelled any more. Then BTC payment (BTC_Pay) has to happen within 20 blocks of the bitcoin blockchain (counting from the block the order entered the blockchain) and it is not possible to cancel it. If BTC_Pay does not happen, XCP (or other Counterparty-issued) tokens are returned to the DEx order pool for further order matching until order limit (by default, 1,000 blocks, if the defaults haven’t changed in the meantime) has been reached.

For example you make a Sell XCP order and 5 blocks later it is matched. By block 25 (20 blocks later) the other side has not paid so your XCP tokens are returned to the DEx matching pool where they can stay up to 2000-25 = 1975 blocks or less (should they be matched and paid, or cancelled by the user).

Your placed order will also be visible on the blockchain (example using the now defunct Blockscan.com is shown below, but you can use xchain.io instead). Escrow amounts seen are redeemable fees that are separate from transaction fee (0.002 BTC) which is not shown here but it can be observed in an explorer (look for other transactions that happen at the time of placing the order).

Transaction

Confirmed transactions are visible on the blockchain.

Expiration

The default order expiration time for BTC Sell is 2000 blocks and for XCP and Counterparty-based assets is 1,000 blocks. In the past these settings could be tuned in Counterwallet properties for each wallet (these settings remain stored in an encrypted wallet settings file, on the Counterwallet server and are not portable across different Counterwallet servers; wallet itself or its contents is not stored on the server) but has since been removed due to problems created by those who changed them in an unreasonable way.

Order expiration and time remaining can be viewed in many places - for example inside of Counterwallet (Exchange > Open orders) or on Orders at https://xchain.io/. Because the generation speed blocks on the Bitcoin blockchain isn’t predictable, it is not possible to precisely determine expiration time in human-friendly units. The current block number can be seen on many sites, e.g. https://blockchain.info.