Ripple

From Bitcoin
Jump to: navigation, search

A ripple exchange is a form of peer to peer currency exchange that allows you to trade Bitcoin for state backed currencies, without the need for a centralized clearing house like Mt Gox. It has a design loosely inspired by the Ripple monetary system from Ryan Fugger.

Introduction

Buying and selling Bitcoins for dollars, euros and others is today a complex process that relies heavily on centralized institutions. These institutions are vulnerable to being hacked, to becoming monopolies/duopolies, and having their bank accounts arbitrarily frozen by bankers fearful of vague regulations. They also levy fees.

On the other hand, centralized exchanges present a simple, familiar trading model and by connecting to the banking network allow people to easily move large sums of money in and out of the economy.

A peer to peer system takes a different approach that is less centralized, less vulnerable, but may be harder for users to get started with.

It starts with a social network, in which the relationships between people are defined by lines of credit. For example, I know Stefan and Andreas. I am willing to let them get up to $1000 and $2000 in debt to me, respectively. In turn, they both know Elli. Stefan only recently met her and is only willing to give her $300 of credit. Andreas knows her better, knows she has a stable job etc - he is willing to give her $500 of credit. I have Bitcoins to sell.

Elli would like to purchase some Bitcoins for dollars. She does not know me, but that doesn't matter. She can instruct her exchange software to purchase coins and receive them from me immediately. By doing so, she becomes in debt to Stefan and Andreas by whatever amounts were necessary to make her desired purchase, and they both become transitively in debt to me. The fact that this debt exists may be a matter of public record for some implementations. For others, only the two actors in each line of credit know the balances. At some later date I will settle up with Stefan and Andreas. We can settle with cash, PayPal, wire transfers, whatever makes the most sense. We can use even quite reversible forms of payment like PayPal because of the pre-existing trust relationships. And of course, Elli will pay both Stefan and Andreas in the same manner.

In this way, debt "ripples" through the social graph.

There are some obvious issues with such a system:

  1. It's only usable by people who are socially connected to people already taking part. If you are introduced to Bitcoin through word of mouth, that might not be a problem. If you are introduced to it via news media or some other form of broadcast, you start out by not knowing anyone and cannot use it.
  2. Trust relationships can be destroyed by failure to settle up. It's probably not easily usable by people without reliable income, as even their friends may harbor legitimate doubts about their ability or willingness to repay.
  3. The size of trades can you make are limited by the aggregate amount of debt people are willing to take on, on your behalf.

Nodes in the social graph do not necessarily have to be people. They can also be businesses, or existing currency trading platforms.

Feasibility

The power law combined with the density of modern social interactions can lead to surprising results. Facebook's social graph can be traversed with only four degrees of separation, rather than the more famous six:

http://www.telegraph.co.uk/technology/facebook/8906693/Facebook-cuts-six-degrees-of-separation-to-four.html

Any social graph of Bitcoin users and traders would not be so dense, but it would still likely to be highly connected as Bitcoin itself is an idea and technology that normally spreads through word of mouth. The act of receiving your first Bitcoins from whoever introduces you to the topic could also link you into the trading network (eg, via your phone).

Implementation

Here is one suggested way to implement the system, though it's by no means the only way.

We start with the familiar infrastructure of a broadcast P2P network and merge-mined alternative blockchain, made up of clients that run on users laptops, desktops and smartphones. The alternative blockchain orders transactions within the ripple system, and it can share mining power with Bitcoin.

The client is also able to talk to the Bitcoin network and maintain a wallet. So, it actually connects to the two independent P2P networks simultaneously.

To use the client you must configure some social connections and set up credit lines. Re-using social networks like Google+ can help simplify this step. Everyone in the Ripple network is identified by a keypair. One easy way to publish this is to create a fake email address such as <encoded pubkey>@keys.ripple.bitcoin.org and add it into your profile. Problematically, Facebook does not allow apps to read email addresses of friends, but you can do this trick with Google+.

To set up credit lines, the software broadcasts a transaction signed with your key, identifying which keys you wish to open lines of credit to, and in which currencies. Nodes verify the signature on the transaction and then update their database to reflect the new credit lines. You can edit credit lines at any point by broadcasting new transactions. Miners include the transaction into the current block.

To sell some Bitcoins, first the user transfers coins into the wallet maintained by their Ripple app. They then set a price in whatever currencies are preferred. Their client begins broadcasting an advertisement that there are coins for sale from user (key) X. The announcement contains a signature from the Bitcoin key holding the coins, along with the unspent outpoints, so nodes can verify that the coins really exist and weren't spent yet. The advertisement is incorporated into the ripple chain.

To buy, a user tells their client to try and obtain X coins at a price of Y or less. When the buyers client sees the signed advert from user X, it starts a pathfinding algorithm that searches through the social graph. If a path can be found from the seller to the buyer and sufficient credit is available on that path, the buyers client sends a new signed transaction asserting that they are willing to buy the coins, that they should be delivered to Bitcoin address A, and the transaction also includes the discovered path through the social graph.

Each node verifies that the path given in the purchase message is valid and consistent with their database - there is really enough credit there for the transaction to take place. The nodes then waits until they see a Bitcoin transaction that moves the coins be confirmed on the Bitcoin chain. Once the coins have moved, the transaction is finalized on the ripple chain and available credit along that path is reduced. The client for each user along the credit path informs them that they are now owed by/owe to the relevant people.

Buttons are provided for each debt item. Once the users settle up offline, they press the button for that particular debt and the client broadcasts another signed message incrementing the available credit once again.

All state changes in the system are incorporated into the alt chain, so you can leave your client offline most of the time. It will sync up occasionally and make the trades for you when it can.

External links

References