-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Order format which enables gossip #22
Comments
Would be interested in your thoughts here too @LePremierHomme @hatmer |
Given that the OpenDEX specs define Google Protocol Buffers, the Special precaution will need to be taken in implementation to ensure that malicious participants cannot cancel other participants' orders. OrderInvalidation Messages become unneeded which is a nice feature. I like this idea since it adds clarity and is beneficial for scaling. |
Implementations should be required to compare pubkey of an order update to the original and ensure that the timestamp is newer. But those are cheap operations because you need to pull the original order from the map in order to update it anyway. |
A side note: a purely selfish participant will not forward messages. We could perhaps incorporate XUC payments to incentivise forwarding, similar to how Bitcoin users pay fees to incentivise miners to include transactions in blocks. |
Order Invalidation is currently supported. What you suggest can replace it for full removals, but will impose creating a new order upon partial validation. This actually might be superior since it's keeping orders “immutable”.
Cryptocurrency nodes are usually not incentivised to forward gossip messages or to sync historical data. In OpenDEX case, this courtesy might be worse because nodes might have an incentive to not forward messages, to prevent trading competition. It might even make them reverse the recommended taker/maker model where incoming orders are expected to be matched by later own/local orders, and not against existing ones (which are expected to be matched by peers). |
Yes, making sure that nodes don't disrupt the network by not gossipping the orders will be a challenge to overcome. The two types of solutions that come to mind are using a trusted core set (probably at least 1/3 of the network) of nodes that always behave correctly, or having an algorithm that can figure out if a peer is not forwarding orders and penalize its reputation. |
The order id is nominally a UUID but since the originator of the order can make it up, this id can't be trusted to be unique. As long as there is a full mesh and everyone stores the originator of every order along with the order, this is irrelevant, but if one node can forward an order for another then it falls down.
In a gossip scenario, we should imagine that we want to have orders exist for some period of time and then timeout, unless re-created by their originator. The structure I would use is:
byte[64] signature; byte[32] pubkey; uint32 timestamp_secs; // drop if more than 3 hours old or 10 minutes in future byte[] request_asset_id; uint64 request_amount; byte[] offer_asset_id; uint64 offer_amount; optional byte[64] replace_order_id;
And the order id would be defined as the hash of the wire encoded structure. Additionally use of two uint64s (request_amount and offer_amount) rather than a float64 (price) dodges the thorny issue of float rounding.
Finally, an order offering 0 for 0 can be defined as a withdrawal order and the use of replace_order_id can define what order is being withdrawn.
The text was updated successfully, but these errors were encountered: