How does CP use OP_RETURN

hello, I’m investigating how CP works and I am wondering if you could either point me to the relevant documentation or a quick answer to the following:

Does CP use OP_RETURN transactions?
if yes, then as OP_RETURN has no spendable OUTPUTS, then how does the miner get paid? (mining fee is the OUTPUTS minus the INPUTS.

What are the INPUT addresses used in a CP transaction? Do they contain bitcoins?

Take a look at this (if this is not enough, maybe counterparty-lib source):

Thanks, that helps a lot.

That pretty much sums up how sends are done. How are exchange orders (bids/asks) placed ? is the ‘order book’ living in the mempool only?

I remember that CP servers keeps a live copy of the orders in a local sqlite db. But do the CP servers add the orders when they are seen in the mempool or only when they have been mined? (obviously waiting until the txn is mined would be too slow for a practical order book.) But relying on mempool means CP servers need to keep track of orders replacing previous ones and parent cancelling child problems.

Yeah it’s slow, ie each bid is a transaction. You can find about it on this forum if you search for “DEx” or in counterparty-lib source code. The main disadvantage is that it’s slow, the main advantage is that there’s no counterparty risk as the protocol takes funds into escrow.

Tokenly has a project Swapbot which works similar to, and that’s faster, but I am not yet familiar with the internals. I think it’s going to be good for (relatively) small trades that need to execute quickly.

Edit: forgot to add that dust amount (or more) in BTC is used to pay for each transaction, including DEx bids.

1 Like

so if you can get the escrow of BTC a possibility (through some sort of shared multi-sig account where a smart contract can pay on a buyers behalf), and a metadata layer on top of the tokens, then you can basically effectively have an open bazaar like system right?

Though, I suppose the CP sqlite databases of the orders can be subpoenaed.

1 Like

Awesome idea!