|
|
InstallingTheServerThis first version of the server is standalone -- it does not implement the Ripple protocol for inter-server transactions. That comes later. First we'll get the client protocol nailed. Get the code from: http://github.com/rfugger/ripple/ Install (by linux package system preferably):
(* keep a fresh checkout of the sqlalchemy svn repository trunk (http://svn.sqlalchemy.org/sqlalchemy/trunk) somewhere, and link to the lib/sqlalchemy directory in /usr/local/lib/python2.5/site-packages, or wherever your python install's site-packages directory is located.) Make sure your PYTHONPATH environment variable includes the directory where you put the ripplebase code (ie, the directory containing the ripplebase directory). Settings for various things like the database are in ripplebase/settings.py. Then in the ripplebase directory, run To run the test suite: What the server can do so farCommunication with the server uses HTTP, with data in JSON format, utf-8 encoded, of course. UnitsRipple clients need a common set of value units to refer to when creating accounts and making payments. Any client may add a value unit by name, and all clients may refer to all such units.
{"name": <unitname>}
AddressesRipple addresses are identities for sending and receiving payments, like email addresses are identities for sending and receiving email. An address can have zero or more accounts (described below), although it is not useful for payment until it has at least one account.
{"address": <address>,
"owner": <string>,
"accounts": [<accountname1>, <accountname2>, ...]}
The
Only the fields with new values need to be included. AccountsA credit relationship connection between two participants in the system is made of two accounts, one for each participant. (You could say each participant keeps its own copy of the account.)
{"name": <accountname>,
"owner": <string>,
"balance": <decimal_string>,
"unit": <unitname>,
"upper_limit": <decimal_string>,
"lower_limit": <decimal_string>,
"limits_expiry_time": <YYYY-MM-DD HH:mm:ss>,
"address": <address>,
"partner": <address>,
"note": <string>}
The Posting a new account generates an account confirmation request for the account partner. The partner must confirm by posting her own version of the account before the account is made active.
{"name": <accountname>,
"relationship": <integer>,
"owner": <string>,
"balance": <decimal_string>,
"unit": <unitname>,
"upper_limit": <decimal_string>,
"lower_limit": <decimal_string>,
"limits_effective_time": <YYYY-MM-DD HH:mm:ss>,
"limits_expiry_time": <YYYY-MM-DD HH:mm:ss>,
"is_active": <boolean>}
{"relationship": <integer>,
"source_address": <address>,
"dest_address": <address>,
"unit": <unitname>,
"note": <note>}
{"name": <accountname>,
"relationship": <integer>,
"owner": <string>,
"balance": <decimal_string>,
"unit": <unitname>,
"upper_limit": <decimal_string>,
"lower_limit": <decimal_string>,
"limits_expiry_time": <YYYY-MM-DD HH:mm:ss>}
Exchange RatesEach client can define as many named exchange rates as it wants. Exchange rates determine the rate at which that client will exchange value on one account or payment unit for value on another account or payment unit (see Exchanges below).
{"name": <ratename>,
"value": <decimal_string>,
"expiry_time": <YYYY-MM-DD HH:mm:ss>}
The expiry time is when the given value for this rate expires if it is not updated. That means that any transactions that depend on this rate being known will not be processed.
When retrieving exchange rates, there is an addition read-only field
ExchangesExchanges tell the Ripple server how different accounts can be connected together for building payment paths. There are three types of exchanges: thru-exchanges, in-exchanges, and out-exchanges. Thru-exchanges define an exchange rate from one account to another account. A payment path can be viewed as a sequence of thru exchanges, beginning on the paying account, and ending on the receiving account. In-exchanges define an exchange rate between an account for receiving payment and a payment unit. In-exchanges allow Ripple to convert a payment amount to an amount on the receiving account, for when a payment specifies that the recipient receive a pre-defined amount. In-exchanges determine which payment units may be used to receive payment on a particular account. Out-exchanges define an exchange rate between a payment unit and an account for sending payment. Out-exchanges allow Ripple to convert a payment amount to an amount on the paying account, for when a payment specifies that the payer pay a specified amount. Out-exchanges determine which payment units may be used to send payment from a particular account.
{"from": <sourceaccountname>,
"to": <targetaccountname>,
"rate": <ratename>}
This tells the server that it may, as part of Ripple transactions, convert value on the
The only field the client is permitted to change is
{"from": <receivingaccountname>,
"to": <unitname>,
"rate": <ratename>}
This tells the server that it may receive payment in the specified value unit to the specified account at the specified rate. The conversion takes place by multiplying the amount in account units by the rate to get the amount in payment units.
The only field the client is permitted to change is If the key order,
{"from": <unitname>,
"to": <payingaccountname>,
"rate": <ratename>}
This tells the server that it may send payment in the specified value unit from the specified account at the specified rate. The conversion takes place by multiplying the amount in payment units by the rate to get the amount in account units.
The only field the client is permitted to change is Next up, payments. To get an idea of where this is going, look at ClientAPI. |