Ever since BTC came up, there is a problem in decentralization when it comes to trade it against
fiat and, later, altcoins. Centralized exchanges are against the decentralized nature of real
cryptocurrencies, but decentralized exchanges to trade cryptocurrencies for fiat or other
cryptocurrencies are rare. One of such decentralized exchanges is bisq. In its core, it is a
decentralized market place where anyone can make buy or sell orders. Others can take this orders.
Because the system works on BTC, there are no smart contracts available. Orders are exchanged on an own p2p network layer, and the software can only observe BTC movements. For the fiat or altcoin movement, maker and taker both have to manually confirm the successful transaction.
To enforce the good behaviour of participants, both maker and taker of an offer have to deposit a
certain amount. If the participants do not agree on the outcome of the fiat/altcoin transaction,
the deposit is released to an arbitration DAO.
Technically, this is done on BTC the following way: When an order is taken, the deposit and BTC
amount is moved to a 2-of-2 multisig address for maker and taker. At the same time, both clients
generate a transaction to move the amount from the multisig address to the arbitration DAO which
becomes valid after 10 days.
While this approach proved to work, it has some downsides:
- makers have to have the client running, otherwise their offers are not visible
- everyone needs to own BTC from the beginning, so there is a bootstrap difficulty
- besides the secrets involved with the BTC wallet, there are other secrets needed to be stored
safely for the second p2p layer
On Ergo Platform, we have more technical abilities than on BTC. A second p2p layer is not needed
for successful trades:
all information could be stored on chain. And running the client to publish an offer the whole time
is not needed as well as the smart contracts on Ergo can ensure most of the logic that is ensured
by the direct communication between the two participant’s client. Two of the three mentioned
downsides could be solved.
The following text will describe in more detail how a bisq-like transaction could work on Ergo and
is open for discussion of the downsides and shortcomings I might have overseen.
When an offer is published, on bisq the participant defines the following information:
- alt currency (fiat or alt coin)
- min and max amount BTC to be traded
- price (for some pairs automated prices are possible)
- payment type for fiat (SEPA, face2face, mail, …)
- account/payment information (even when it is a BTC buy order)
The payment information is interesting: Even when it is a BTC buy order - or in our case an ERG
buy order -, the payment information has to be defined. This is made to ensure that a buy was not
made with a high-jacked account, and because of this an account has buy limits for two months
after its first trade. Sellers are encouraged to not accept payments when money/altcoins were not
sent from the correct payment account.
So we see this is an integral information to have in an order. To not reveal the real payment
information to everyone for non-anonymous fiat payment information, but to be able to check if an
account was used in older transactions, a hash can be used on Ergo.
All other information can be stored open on chain and in a contract that can accept takers to move
it to the second stage. On Bisq, the client reserves the deposit without moving it. On Ergo, the
contract for the first step can hold it with the ability for the maker to cancel the offer and pay
back the deposit.
Open question: How to do automated prices?
On bisq, someone taking the offer triggers the following actions:
- Taker defines the actual amount to sell/buy (within min/max bounds defined by maker)
- Deposits of both participants and BTC amount of BTC seller is moved to 2-of-2 multisig wallet as
described above, transaction to move everything to the arbitration DAO is signed and stored on both
- Offer is closed even when amount bought is less than max amount
- Payment information is revealed to both participants
On Ergo, for fiat this had to be a two-step process (step 2.1/2.2) since payment information of maker
is not available on chain. The offer is closed and moved to another contract 2a with the takers
payment information stored encrypted only to be decrypted by the maker. Then the maker can move the
contract to the second step 2.2 adding his encrypted payment information to be only decrypted by the
taker. Note that the maker must move the contract, so this can cause some delay.
For Altcoins, this is not needed and the taker can move to step 2.2 directly.
Open questions: how can the payment information be interchanged securely and on-chain so that only makers and takers can access it?
On bisq, after the payment information is exchanged, the buyer marks as paid within 24 hours.
When received, the seller marks as received and the software of both participants sign a transaction
releasing the deposit and BTC amount to be paid out.
On Ergo, this two-step process can be reproduced with a smart contract state movement or the payout
to both participant’s p2pk addresses.
On bisq, when there is a problem the participants can chat to solve any problems in the process.
This of course needs another layer of communication as, at the time of writing, there is no
communication layer present on the Ergo Platform.
After some time of waiting, when the funds are released to the control of the DAO - which is not
needed on Ergo as the smart contracts can handle this case without any movement -, both participants
can also chat with an arbitrator.
Open question: what communication platform can be used?
- bisq can do an automatic price shift. Offers can be maked for BTC/fiat pairs that are “current
price +/- x%” when the offer is taken. This could be done via an Oracle, but we only have ERG/USD.
- how can the payment information be interchanged securely and on-chain so that only makers and takers can access it?
- what communication platform can be used for chat in step 3b?
- how to form a DAO?