How would such a decentralised exchange work?
It is possible, and not conceptually difficult, to extend the way ownership of Bitcoin is determined in a decentralized way using the blockchain to more complicated constructs such as the ownership of other things or the commitment to contracts, including offers to trade at certain prices. Yet there are two nontrivial issues a decentralized exchange, or its underlying protocol has to solve: How to enforce trades (solving the counter-party risk any exchange has), and how to detect if a trade has occurred.
Obviously there are many ways all of this could be settled. For example, exchanges in real finance leave fulfillment and enforcement to the trading parties and the authorities, but that has huge real-world problems even with a limited number of tightly regulated and registered participants that one may hope to avoid in a decentralized approach.
There is a simple solution for exchanging (specially designed) cryptocurrencies where ownership and contract fulfillment is determined by a blockchain. At least typically, protocols enabling a decentralized exchange include at least one such cryptocurrency, such that as a partial solution an automatic escrow can be implemented. But full automation requires that the ownership of the other currency involved in the exchange can also be automatically established, i.e. it must also be some kind of altcoin.
To extend this to cover fiat currency, there must be some form of agreement to honor the obligation to transfer fiat and to reflect its completion in the decentralized exchange. Sadly, this is at the core of all kinds of blockchain-based contracts: How do we get them to be enforceable, ideally by becoming legally binding? I see two possibilities:
Limit trading to participants that sign some kind of real-world contract to honor them in a way that makes them legally enforceable. This has the problem of being difficult to do in a truly decentralized way, unless legal systems start to recognize at least some kind of digital id and digital contracts.
Require some kind of security deposit to be confiscated in case of breach of contract---possibly from both sides of a contract or exchange-brokered trade, to remove profitability for both sides in the event that one party fails to deliver a fiat payment or that the other party fails to admit having received it. Sadly, designing a system where it is ensured that no kind of fraud pays off is not easy and may require a very large security deposit, giving this approach severe disadvantages as well: A cyber-troll willing to suffer a loss could cause someone else to suffer an even larger loss (and potentially blackmail such a victim into letting the troll get away with a profit), and potential users wanting to use the exchange because they need cryptocurrency may find it difficult to cough up a cryptocurrency-based security deposit.
Apparently it's possible just with bitcoin. Here's a snippet from Vitalik Buterin's Ethereum white paper:
[Bitcoin] Scripts can also be used to pay bounties for solutions to computational problems, and one can even construct a script that says something like "this Bitcoin UTXO [unused transaction output] is yours if you can provide an SPV [simplified payment verification] proof that you sent a Dogecoin transaction of this denomination to me," essentially allowing decentralized cross-cryptocurrency exchange [emphasis added]. (Buterin, 2014)
So, it sounds like you could do decentralized exchange by basically bidding for other currency through your transaction outputs.
Buterin, Vitalik. "A Next Generation Smart Contract & Decentralized Application Platform" Ethereum White Paper. Updated August 2, 2014. Accessed August 13, 2014. https://github.com/ethereum/wiki/wiki/%5BEnglish%5D-White-Paper
It would not.
The fiats are not part of the blockchain except for book entries. The strength of cryptocurrencies, the cryptography, isn't yet strong enough to beat down the door of the exchange and take the fiats back when their holders misbehave. Blockchains currently have no legal rights to knock down their doors and collect. Courts will have to intervene.
Anyone who thinks a system like this is decentralized is kidding themselves. Whoever holds the fiats is the center: the exchange, the police, the courts, the thieves, etc.
If the blockchain had "smashers" who could go force others to comply with the blockchain's rules for a smashing reward & fee, there'd be decentralization since they could force the transfer of fiat, but then you'd be violating anonymity since the smashers have no idea whose door to kick down without identification, but that data probably can't be verified anyways.
Concerning fiat, maybe you could build something like that on top of those services using escrow agents with user trust ratings?
I still haven't seen a good model. At some point you have to trust someone to hold the fiat. Who would you trust aside from a bank or similar institutions insured to protect your fiat?
- Bob is looking to sell his bitcoins for Euros and enters a sell order (ask) via the MetaLair network.
- Alice is looking to buy bitcoins in exchange for her Euros and enters a buy order (bid).
- The MetaLair system connects Bob and Alice who both agree to use Ivan as the escrow agent.
- Ivan is a small time Europe based escrow agent who has a good trust rating via the MetaLair network.
- Ivan acts as the escrow agent for the fiat funds and holds Alice’s Euros in his bank account! (Emphasis mine)
- Ivan therefore also acts as the escrow agent for the Bitcoin transfer which is done via the Bitcoin network using a 2 of 3 transaction. (or this may be automated)
- The Bitcoin transaction completes successfully.
- Ivan transfers the Euros to Bob’s bank account. Ivan receives a fee for his services.
Would you trust Ivan, who is ultimately just some stranger, with a significant amount of your Euros?
In Ripple and Bitcoin – Foundations of a Decentralized Economy a similar model using Ripple is explained except that the trusted agents are really people you trust. But even in that case, how much fiat would you trust most of your friends with? More concerning, what happens when you have a $200 relationship with 20 friends and in one unlucky week you end up in debt for near the max to each one for a total approaching $4000, each of those friends having a real need for that money? These kinds of inevitable breakdowns lead to urban legends and an erosion of trust in the system.
Digging a bit deeper into Ripple, it has the concept of Gateways (very well illustrated at the link) which is defined as "any business that allows its customers to move money into or out of the Ripple network." Although it looks decentralized in theory, I don't see how it could be in practice. The future gateways will ultimately be today's exchanges: Mt. Gox et. al. The infrastructure doesn't do anything to change the nature of those companies.
Note that while at first glance Ripple looks decentralized, there is still at least one component (the UNL) which is maintained by a central authority. See this question for more details and the road map for making UNLs decentralized.
Although Ripple looks promising in terms of infrastructure all of these solutions fail to tackle the real challenge: how do you decentralize trust, accountability, and insurance against default?
For anything other than small amounts, history would tend to point to the average person only trusting large centralized institutions that are accountable to federal law and backed against risk by their government.
I believe it could technically happen with Mastercoin/coloured coins linked to a Ripple account, and the coöperation of a Ripple gateway: he whom holds the coin can withdraw fiat whenever they wish, after the gateway verifies the ownership of the token.
Of course it'd add the question of trust in the gateway: that it will not fall for scams, will do an adequate validation of the coin's ownership, will be sufficiently solvent at any point in time, etc. As with anything involving fiat, this would be unavoidable.
The Bitsquare project describes a system for the decentralized exchange of bitcoin for national (fiat) currencies. The whitepaper goes into the details, but the gist is that the bitcoin being bought is first locked into a multi-signature (multsig) address and then the fiat payment is made directly from the buyer to the bitcoin seller using a traditional payment method (eg. bank transfer).
The three signatures on the multisig address are the buyer, seller and an independent arbitrator, pre-selected by both, which only becomes involved if there is a dispute about whether or not the non-bitcoin side has been settled as agreed. Both buyer and seller also pay into the bitcoin multisig address a security deposit that is used to pay for active arbitration in case of a dispute.