Can you provide an example of how one currency would be traded for another via the distributed exchange mechanism?
Is it like entering a limit order that matches against other orders? Or more like a 2 party + escrow system, possibly via multisig?
I'm a command-line guy, so I'd be curious to see examples of actual commands used.
And how can I cancel the order?
No problem. It's a lot like a limit order.
Let's say that you want to sell 10 XCP for GOLD shares (particular IOUs for gold) at a price of
at least 2 GOLD/XCP. You'd run this command:
./counterpartyd.py [--testnet] [--rpc-password=PASSWORD] order --from=ADDRESS --give-quantity=10 --give-asset=XCP --get-quantity=20 --get-asset=GOLD --expiration=WHATEVERIf there are any orders already on the books selling GOLD for XCP at a price above 2 GOLD/XCP, then your order will immediately be matched to the order at the best price (for you), but at *that* price (which would still meet your criteria). As soon as an order is matched, it is settled, and the GOLD is in your wallet. The 'give' funds in any open order are held in escrow by the network, as it were, as long as the order is open.
You cancel an order simply by [attempting to] accept it yourself. There's a chance that you won't get there in time, but that chance exists either way, that is if there were a 'cancel order' command, and it is the same in both cases. There isn't any cancelling of orders. It would be very easy to implement, though. EDIT: Cancelling orders and bets is now possible.
If you're buying or selling BTC, there's an extra step of finalizing a matched order, because Counterparty can't forcibly put your BTC in escrow. Every such order match for which you owe someone BTC is displayed on the 'market' screen (
./counterparty market, along with its 'order match ID', which is the only argument to the 'btcpay' command. That command will figure out out many BTC you owe for the order in question and it will send it along its way automatically.