Barter's functionality centers around a few basic object types: denominations, users, notes, events, values, and portfolios.
Denominations are the units of value. They can be created by any user with appropriate permissions. A denomination has the following attributes: issuer (the user which created it) and profile (a text string describing its meaning).
Users are accounts on the Barter Server. Users have the following attributes: flags (set of permissions flags), public (the user's public key, an integer), secret (the user's secret key, an integer), modulus (the user's modulus, also an integer), and a portfolio that the server recognizes the user's ownership of. The server does not need to know the value of secret, but any client applications will need this information.
Notes are instruments of value transfer. They have the
following attributes: portfolio (a portfolio that the
note contains), challenge (a random integer used for
signing the note), and issuer (the user that created it).
A user can use the note_withdraw
command to
create a note. The user specifies a portfolio in the command,
which becomes the portfolio of the note and is deducted
from the user's account balance. To deposit a note, a user
must have its signature which the issuer produces by signing
the challenge of the note using his secret key. Then
the depositor uses the note_deposit
command to
transfer the portfolio of the note into his own account.
So if user A wants to transfer a portfolio P to
user B, A must first withdraw a note containing
P, sign it, then communicate the note's identity and
signature to B who can then deposit it. More complex
schemes can also be created, such as re-encrypting the signature
of the note with the public key of its intended recipient.
Events are the temporal units of the Barter Server. Every
event has a unique serial number, starting from 1 and going up.
Events have the following attributes: time (Epochal time of
its creation), users (a list of users who have permission
to see this event), type (a string representing what kind
of event this is: e.g., "user_create", "note_destroy"), and
data (a hash of attributes whose meaning is dependent on
the type of the event). Users can also use events as a communications
device, using the event_send
command, which works
a lot like email. An event can be created and made visible to
any user containing an arbitrary message. The preferred way
for users to exchange value is by communicating notes through
the event_send
command.
Values are simply (denomination, quantity) pairs. A "quantity" is simply any non-negative rational number. So a value is just some amount of some thing. "A third of all the IBM stock" or "$52.40".
Portfolios are simply sets of values. The canonical form of a portfolio contains at most one value of each denomination.