NOTE: Starting November 5, 2014, the BTC Sell (and hence BTC Pay) functionality has been removed from Counterwallet, but retained on the protocol level. BTC Pay is still available through the Counterparty CLI and API.
How It Works
BTC Pay (sometimes written as BTC_Pay and BTCpay) is the procedure of paying for a Counterparty-based token/asset with bitcoin.
Here’s how it works:
-
User makes order to sell BTC (i.e. to buy something for bitcoin)
-
Order is matched with another order (to buy BTC, in return for some other asset)
-
User’s order listed as an upcoming BTCPay for 6 blocks. This shows up in the Waiting BTC_Pay feed with a clock icon.
-
After 6 blocks, it’s “safe” for the user to make a BTC_Pay against the item:
- If BTC_Pay is set to Automatic, a create_btcpay transaction is then immediately made. item does not show up in waiting BTCpays pane.
- If BTC_Pay is Manual (that is, the user has disabled automatic BTC_Pay in his Counterwallet preferences), the user is prompted to make payment. If they say “yes, do it now”, things proceed similarly to the automatic route above. If they say “no, hold off” the create_btcpay transaction is made once the user chooses to make it. The item then shows up in the waiting BTC_Pay feed with an exclamation point icon, and the user must make payment.
N.B.: Manual BTC_Pay should not be made more than 19 blocks later because the “pay window” closes 20 blocks after the Distributed Exchange makes a match.
-
Once the user DOES make payment (automatic or manually), the btcpay is added to the pending actions list to show that the BTC_Pay is in progress (i.e. txn has been broadcast). (Note that if the user were to log out and back in during this time, we would see that the BTCpay is on the pending list and wouldn’t show it as eligible to be paid.)
-
Once confirmed on the network, the btcpay data is received across the message feed:
- Waiting BTCPay is no longer marked as “inprogress”. localstorage data for it is removed.
- Waiting BTCpay item is removed from waitingBTCPays
- Notification item for this BTCPay is added to the notifications feed pane in Counterwallet.
Basically: upcomingBTCPay -> waitingBTCPay -> pendingBTCPay -> completedBTCPay