This thread is for developing a dealer-to-dealer (you may replace "dealer" also with "merchant" or "whale") network for altcoin currency exchange.
Desirable qualities for an exchance service (especially from a professional standpoint):
Important:
- Less initial outlay of funds is better
- The less funds the exchange holds, the better
- The more liquidity, the better
- The less effort needed to execute a large trade, the better
- No single point of failure
Nice to have:
- Ease to join
- Ease of use
- Low fees
Matching engine:
Members post their orderbook as a signed and encrypted message to the matching engine once per day at a set time. The matching engine solves the clearing price, publishes it, and posts to all the members, how much they need to send. The matching engine can act as the decentralized escrow, or directly give the address of the counterparty.
Clearing price:
Every day the engine takes together the members' orderbooks. If the bids and asks in the members' orderbooks overlapped, there forms a one price that clears all bids higher than that, and all asks lower than that. If the price is ambiguous (a range), the clearing price is the midpoint of the highest and lowest such price.
If bids and asks no not overlap, there are no trades. In this case the "clearing price" is the midpoint between highest bid and lowest ask.
There is no need to publicly disclose the orderbooks that the members posted. The clearing price can not be manipulated, because this would lead to some of the orders that should fill, not filling. So if none of the members makes an issue about a non-fill, it can be concluded that everyone has had their fills correctly, and therefore the clearing price must be published correctly also. In this sense it is like a hash.
Fees:
Depending how much organization/setup work is needed, this can work on very low fees. I had a similar system working purely on excelsheet basis in silver since 2008 and
it still does in an altered form.
Because installing and learning the system takes some time, and it works best with frequent need to trade, a fixed monthly fee is perhaps in order, regardless of trade activity. This encourages professionals and large traders, whereas keeping the occasional traders away just makes it much easier to maintain and less risky for pros.
The fee could even be waived for those who provide market-making ie. frequently or constantly send large orders that are near each other in both bid and ask side. The matching engine can easily keep track of the market-making "points" on a monthly basis and credit them to the member automatically. I will post this separately because it is a detail.
Guarantees:
The shining advantage of this system is that
there is no need to send a multiple of what you are intending to trade, of your money, to a centralized, insecure, often in a questionable legal basis, website, which historically has been a target and victim of scam, fraud, hack and attack by gov.
Yes, there will be a need to send a fraction of it. There is no way around that all offers must be covered, but with a little bit of forethought, the capital requirement can be decreased by a lot.
Let's assume that the matching engine is a decentralized exchange, capable of doing escrow. In this case, all BTC or ALT for the filled trades must be sent in 1 hour following the matching. After the necessary time for confirmations, it will be sent to the new owners. A member only needs to trust the engine for the trades that already happened, as much as he typically needs to trust any escrow, and only for 1 hour. This is way better than having both the ALT and BTC funds at risk day and night in shady online places.
But the engine also needs to trust you. You cannot run away with the money because nothing will be sent to you unless you send first, but you can still default sending if you feel it is expedient. (It should not be, because: you are just trading ALT/BTC at the exact price that was just determined to be
the market price. So even if you made a mistake for example entering an ask instead of bid, or something as common and stupid, it can be rectified in the next matching, or in a 24/7 exchange, for typically a 1-2% loss.)
Anyway, for this case you must post a bail to the system, covering you in the event that you do not pay on time, and the counterparty's money needs to be used to source the coins from the market instead. I believe for a mature altcoin 5% should be enough in this case, which means that for a deposit of 1,000 LTC, you could send orders up to 20,000 LTC. Now that is leverage, and reduction of risk.
If the engine does not act as an escrow but rather directly provides you the address of the counterparty, then the bail must be larger to cover for the event that party A sends his goods but party B runs with the money without sending. This can be mitigated by forcing an incremental send, where an increment is maximum the size of the bail. Although the standing bail becomes larger this way, the temporary risk for a member (in the event that you have sent the whole sum to the escrow engine, and the operator runs with the money) is smaller. Which way to proceed depends on many things.
The bail posted by one member can easily serve multiple-duty: if the owner of the bail A says that member C is also guaranteed by the bail, this can be enforced every time that the bail is not directly used by A himself.
The idea is that there is
no need to send escrow payments back and forth, or keep coins in limbo (and possibly at risk) to guarantee your possible future trades.
One bail payment that is a fraction of your maximum daily trade size, and stays constant until you want to exit the network,
is enough.