"The Counterparty protocol" what is it and what runs it?

The various documentations reference the “[font=sans-serif][size=13px]The Counterparty protocol” a bunch.[/size][/font]
[font=sans-serif][/size][/font]
[font=sans-serif][/size][size=2]I have a hard time understanding what the protocol exactly is and who or what executes it.[/size][size=13px][/font]

[font=sans-serif][/size][size=2]I understand how transactions are being written by btc blockchain and maintained in there. That all makes sense but i don’t understand where the logic and software that runs counterparty (i.e. the DEX, order matching etc) happens.[/size][size=13px][/font]

[font=sans-serif][/size][size=2]Can someone explain this please?[/size][size=13px][/font]

https://bitcointalk.org/index.php?topic=395761.0  please see the  first page  links for Counterparty.

None of these links address my questions.


All these only talk about how this works from an end user perspective.




However I can’t find anywhere how this actually works. Why is this so hard to answer?

Still trying to understand.


I am a bit frustrated with the fact that nowhere can i find how this stuff works.

[quote author=knircky link=topic=270.msg2148#msg2148 date=1398883692]
Still trying to understand.


I am a bit frustrated with the fact that nowhere can i find how this stuff works.
[/quote]

Which parts are you having difficulty understanding?

If you would like to post what you understand so far and which areas you would like clarification on I’d be happy to help.

So the counterparty transactions runs on top of the BTC network. I understand how you can write data into a BTC transaction and how that can mean things (like a new asses is created or asset is transferred).


So its easy to understand how assets can be create and transferred inside a btc transaction.




I don’t understand how the dex can work and how bets can work. I understand how a bet can be documented in the btc blockchain.


I assume there is some computer code that needs to run to do matching etc. So where does that happen given that we don’t have miners.




In other words i was able to read up on btc and i understand the basics on how it works. I can tell my friends how bitcoin works.


I can explain how counterparty works by writing things into the blockchain, i have looked up transactions in the btc blockchain etc.


But i have no clue how the DEX works and how any counterparty logic is executed.

[quote author=knircky link=topic=270.msg2154#msg2154 date=1398909898]
[…]
I don’t understand how the dex can work and how bets can work. I understand how a bet can be documented in the btc blockchain.

I assume there is some computer code that needs to run to do matching etc. So where does that happen given that we don’t have miners.

In other words i was able to read up on btc and i understand the basics on how it works. I can tell my friends how bitcoin works.

I can explain how counterparty works by writing things into the blockchain, i have looked up transactions in the btc blockchain etc.

But i have no clue how the DEX works and how any counterparty logic is executed.
[/quote]

As you have understood, the information for each order and bet is stored on the Bitcoin blockchain.

The functionality which decides orders are matched and resolves bets is performed by Counterparty. Specifically by the reference implementation which is known as ‘counterpartyd’. It parses the transactions on the Bitcoin blockchain and does such things as calculate the balances of assets at each address, match orders and resolve bets. These functions are performed by each Counterparty node and stored locally at each node.

This calculation occurs in a completely decentralised and consensus-based way. Let’s say you change the code for counterpartyd on your local machine such that you credit yourself with all XCP in distribution. It might look ok for you but no other node would recognise your balance.

Does that make it clearer?

[quote author=Global_trade_repo link=topic=270.msg2156#msg2156 date=1398926786]
[quote author=knircky link=topic=270.msg2154#msg2154 date=1398909898]
[…]
I don’t understand how the dex can work and how bets can work. I understand how a bet can be documented in the btc blockchain.

I assume there is some computer code that needs to run to do matching etc. So where does that happen given that we don’t have miners.

In other words i was able to read up on btc and i understand the basics on how it works. I can tell my friends how bitcoin works.

I can explain how counterparty works by writing things into the blockchain, i have looked up transactions in the btc blockchain etc.

But i have no clue how the DEX works and how any counterparty logic is executed.
[/quote]

As you have understood, the information for each order and bet is stored on the Bitcoin blockchain.

The functionality which decides orders are matched and resolves bets is performed by Counterparty. Specifically by the reference implementation which is known as ‘counterpartyd’. It parses the transactions on the Bitcoin blockchain and does such things as calculate the balances of assets at each address, match orders and resolve bets. These functions are performed by each Counterparty node and stored locally at each node.

This calculation occurs in a completely decentralized and consensus-based way. Let’s say you change the code for counterpartyd on your local machine such that you credit yourself with all XCP in distribution. It might look ok for you but no other node would recognise your balance.

Does that make it clearer?
[/quote]


Yes that makes it much clearer. So the nodes are doing this work in a decentralized way.


Is there any description, whitepaper or documentation how this works? I’d like to learn it in a way that i could describe to a non tech savy person.


Thank you for taking the time to responding to me!

[quote author=Frozen link=topic=270.msg1987#msg1987 date=1397860026]
https://bitcointalk.org/index.php?topic=395761.0  please see the  first page  links for Counterparty.
[/quote]
There is a whitepaper link…

I think that counterparty protocol is a crypto-financial market, built on Bitcoin, initialized by proof-of-burn concept (destroying bitcoins), right? My question is where can I create the burning source address? Can I use a BTC address blockchain.info for this?

[quote author=knircky link=topic=270.msg2164#msg2164 date=1398991876]
Yes that makes it much clearer. So the nodes are doing this work in a decentralized way.

Is there any description, whitepaper or documentation how this works? I’d like to learn it in a way that i could describe to a non tech savy person.

Thank you for taking the time to responding to me!
[/quote]

There is a white paper as Frozen has pointed out and wiki https://wiki.counterparty.co/w/Main_Page. However, neither go into the level of detail you are seeking which is where the separation of responsibility and the logic on how orders are matched etc.

Unfortunately, that means to get the information you want, you will need to read the source code for counterpartyd. The code is actually very clean and if you a little bit familiar with programming you would be able to understand it.

https://github.com/PhantomPhreak/counterpartyd

I’m not one of the core developers but I’d be happy to help. If you were able to put together that type of guide you are referring to, it would surely help the community!

[quote author=SUEhoward link=topic=270.msg2174#msg2174 date=1399033245]
I think that counterparty protocol is a crypto-financial market, built on Bitcoin, initialized by proof-of-burn concept (destroying bitcoins), right? My question is where can I create the burning source address? Can I use a BTC address blockchain.info for this?
[/quote]


The period where BTC could be burnt to redeem XCP has passed. The way in which XCP can be obtained if via one of the exchanges: DEX, Poloniex or BTER.

[quote author=Global_trade_repo link=topic=270.msg2175#msg2175 date=1399034850]
[quote author=knircky link=topic=270.msg2164#msg2164 date=1398991876]
Yes that makes it much clearer. So the nodes are doing this work in a decentralized way.

Is there any description, whitepaper or documentation how this works? I’d like to learn it in a way that i could describe to a non tech savy person.

Thank you for taking the time to responding to me!
[/quote]

There is a white paper as Frozen has pointed out and wiki https://wiki.counterparty.co/w/Main_Page. However, neither go into the level of detail you are seeking which is where the separation of responsibility and the logic on how orders are matched etc.

Unfortunately, that means to get the information you want, you will need to read the source code for counterpartyd. The code is actually very clean and if you a little bit familiar with programming you would be able to understand it.

https://github.com/PhantomPhreak/counterpartyd

I’m not one of the core developers but I’d be happy to help. If you were able to put together that type of guide you are referring to, it would surely help the community!
[/quote]


Thats right. I’ve been reading these and they are very focused on the API and what you can do with counterparty.


I assume counterparty has been written in C and I am not super familiar with that language (I know Java).


I used to be a developer i was not even able to run counterpartyd. I find counterparty quite amazing and am just looking to learn. The concept of the DEX and bets is just crazy awesome, but at this point i cant imagine how this works, i.e. how can you get consensus on how to execute code!!! This is some crazy stuff!


Both the DEX and BETs can solve so so many problems of our world. Hence i would like to understand the concept and design. Its usually hard to do this by looking in the code. But surely would be a fun exercise.

Thank you for clarifying.

[quote author=knircky link=topic=270.msg2179#msg2179 date=1399042255]
[quote author=Global_trade_repo link=topic=270.msg2175#msg2175 date=1399034850]
[quote author=knircky link=topic=270.msg2164#msg2164 date=1398991876]
Yes that makes it much clearer. So the nodes are doing this work in a decentralized way.

Is there any description, whitepaper or documentation how this works? I’d like to learn it in a way that i could describe to a non tech savy person.

Thank you for taking the time to responding to me!
[/quote]

There is a white paper as Frozen has pointed out and wiki https://wiki.counterparty.co/w/Main_Page. However, neither go into the level of detail you are seeking which is where the separation of responsibility and the logic on how orders are matched etc.

Unfortunately, that means to get the information you want, you will need to read the source code for counterpartyd. The code is actually very clean and if you a little bit familiar with programming you would be able to understand it.

https://github.com/PhantomPhreak/counterpartyd

I’m not one of the core developers but I’d be happy to help. If you were able to put together that type of guide you are referring to, it would surely help the community!
[/quote]


Thats right. I’ve been reading these and they are very focused on the API and what you can do with counterparty.


I assume counterparty has been written in C and I am not super familiar with that language (I know Java).


I used to be a developer i was not even able to run counterpartyd. I find counterparty quite amazing and am just looking to learn. The concept of the DEX and bets is just crazy awesome, but at this point i cant imagine how this works, i.e. how can you get consensus on how to execute code!!! This is some crazy stuff!


Both the DEX and BETs can solve so so many problems of our world. Hence i would like to understand the concept and design. Its usually hard to do this by looking in the code. But surely would be a fun exercise.

Thank you for clarifying.
[/quote]


They are a bit technical, but there are wiki pages on both the DEx and betting:


http://wiki.counterparty.co/w/Assets


https://wiki.counterparty.co/w/Bets_and_Broadcasts


That should give a pretty exhaustive account of how this stuff actually works at the high level.

these sites all explain how to do it, but not how it works. But how it works is the questions.

[font=verdana, arial, helvetica, sans-serif][size=1]Imagine you need to explain bitcoin.[/size][/font]

[font=verdana, arial, helvetica, sans-serif][size=1]You can explain it from the point of view of how it works for the end users: i.e. you can send money from one wallet to another bla bla. Or you can explain the network protocol, the blockchain and what the miners do.
[/size][/font]


I understand what i can do with counterparty. Its straight forward and well documented. i have not seen any bets yet because the counterpartyd cannot be installed and the counterwallet.co does not have the feature implemented yet but i have seen and tried everything else.


However i cannot find anywhere a description of how the counterparty protocol works. If i want to understand bitcoin i can read satoshis paper and this is documented in many other forms. I have never heard or seen anything like this for counterparty.


If you can’t explain it to anyone its hard to get adoption, because its a black box. I dont know how the dex works. Ive seen it work but i dont understand why and how it works.



https://github.com/PhantomPhreak/Counterparty explains how it works

[quote author=Giants link=topic=270.msg2184#msg2184 date=1399070777]
https://github.com/PhantomPhreak/Counterparty explains how it works
[/quote]


it explains what u can do, not how the protocol works.

In that case, it would be behoove you to rename your thread title to “ELI5 Counterparty”.

Counterparty team did two things at the outset:

[list]
[li]Made claim that anything in the blockchain proceeded by the letters “CNTRPRTY” is to be scanned by the Counterparty daemon software for further interpretation.[/li]
[li]Proof of burn to initialize the Counterparty asset ledger[/li]
[/list]How did that happen? Little known fact: arbitrary data can be encoded in special Bitcoin transactions, ideally OP_RETURN transactions. This is how stealth addresses in Dark Wallet work, and how proofofexistence.com works. They encode text inside the blockchain. This pretty much makes the data indestructible, at least as much as the Bitcoin blockchain itself is indestructible.

Data that comes after the “CNTRPRTY” prefix is what is known as a MESSAGE. Messages can be one of the following 10 types:

[list]
[li]Send[/li]
[li]Order[/li]
[li]BTCPay[/li]
[li]Issue[/li]
[li]Broadcast[/li]
[li]Bet[/li]
[li]Dividend[/li]
[li]Burn[/li]
[li]Cancel[/li]
[li]Callback[/li]
[/list]You can read more about what each of those message types do at the aforementioned link: https://github.com/PhantomPhreak/Counterparty

How do all of those messages work? Counterparty’s proof of burn event initialized the Counterparty ledger with roughly 2,600,000 XCP. The XCP gets tracked in that ledger. XCP can be used to “birth” new life: new assets, new stocks, new currencies, or new smart property. Morphing the XCP into any one of those things is perfectly trackable due to the use of the ledger which is built into Bitcoin.

Counterparty uses Bitcoin private keys, just like any other Bitcoin wallet. So before you do anything that changes ledger balances, you have to prove ownership by signing the transaction with the appropriate Bitcoin private keys. But instead of sending BTC, you create special transactions prefixed with CNTRPRTY as described above. The Counterparty software is always scanning the blockchain for those special transactions so it knows to update its ledger balances according to your whims.

Counterparty the ledger exists inside of the Bitcoin blockchain itself.

Counterparty the currency (XCP) is the unit of account in this ledger.

Counterparty the protocol is a set of rules for interacting with the units of account in the ledger.

Counterparty software follows those rules.

The ledger is shared. It’s embedded inside the bitcoin blockchain and synced by anyone and everyone running the official counterparty software daemon “full node”.

Hi guys,


Just trying to understand counterparty better. Are XCP used in any way to send assets, or are they only consumed on issuance, callable, etc. ?


Also if an asset is divisible, can any receiver divide it up to 8 decimals however they want, so long as they pay the normal btc transaction fees and the dust limit?


Any comments on general scalability? It seems like you would have to scan back-in-time validating the counterparty rules on every transaction.


Finally, it seems like there should be no problem using multsig or hard wallets.

Thanks.

[quote author=coinlock link=topic=270.msg2192#msg2192 date=1399132403]
Hi guys,


Just trying to understand counterparty better. Are XCP used in any way to send assets, or are they only consumed on issuance, callable, etc. ?


Also if an asset is divisible, can any receiver divide it up to 8 decimals however they want, so long as they pay the normal btc transaction fees and the dust limit?


Any comments on general scalability? It seems like you would have to scan back-in-time validating the counterparty rules on every transaction.


Finally, it seems like there should be no problem using multsig or hard wallets.

Thanks.
[/quote]


XCP are used to pay a small fee for issuing assets, and they are used for making bets, etc…


I don’t understand your question about the divisibility of assets. All divisible assets are divisible to eight places.


counterpartyd maintains a database constituted so that you don’t have to go back and reparse any transactions… you simply pull current balances, and so on.


Counterparty does not at the moment support multisig transactions. Hardware wallets are fine, though.