The Rain Protocol

A reputation chain, and the economy that can be built on it


Rain is a reputation chain: a public log of promises and what became of them. On that log it offers three separate things that can stand behind a promise, so that people who have never met can lend, trade and pay each other, with or without a connection.

This post says why it exists, what the three things are and which of them need each other, and what we are aiming for. Testing the Rain protocol records the experiments behind every number here.

1. Why: an economy of strangers

Imagine people who have never met being able to lend to each other, insure each other and trade, with no bank between them. Each of these needs one thing first: a reason to believe that a stranger will do what they said they would.

The case that started this is a market with no internet. In the Rohingya camps about half of all transactions are on credit, and there is no connection to check anyone against. There the problem is sharper. A payment that cannot be checked when it is made is itself a promise.

2. What can be checked, and what has to be believed

To lend to a stranger you need several things to be true, and they are not all the same kind of thing.

Some can be checked.

  • The rules will be applied as written. A blockchain provides this, and Rain relies on it.
  • This contract does what it claims. Rain cannot check that for you. It keeps every contract’s code and actions in the open so that you, or someone you rely on, can.

Others can only be believed, because they are about what a person will choose to do later.

  • This person will keep their promise. Nothing can verify a choice that has not been made. What can be had is evidence: what they have done before, and what they would lose.
  • Their record is what it appears to be. A history of repayments is evidence only if the repayments were real, and two friends can pass a loan back and forth. So a reader also has to judge the counterparties in the record.

Under both sits identity. Evidence about a person is useful, and a loss of standing hurts, only if they are the same person tomorrow and cannot return as someone new. Rain gives each user a non-transferable identity token, which makes an identity persistent. It does not prove that a person has only one; for that it is meant to be combined with a proof-of-personhood system.

Where something can be checked, nobody needs to be trusted. Trust is what is left where checking is impossible: how much you are willing to put at risk on a belief. That part is what Rain is built for.

3. Three things that can stand behind a promise

A promise that cannot be checked in advance can still be made believable. There are three ways, and they do not depend on each other.

  • Collateral. The money is locked before the promise is made. This needs funds and no history.
  • Standing. The promisor has a record that would be costly to lose. This needs a history and an identity that cannot be swapped for a new one, and no funds.
  • Information. Other people know what the promisor has already promised. This needs neither, and it strengthens both.

Rain is a set of pieces, each serving one of these. What each needs:

Piece What it is for Needs
The promise log, and scripts A true record of commitments and what became of them Nothing else
Signed promises Making a promise with no connection The log
Locked funds and a certificate Collateral: payment by people who have the money Signed promises, an attester
A fee on every promise Making a record cost something to fake The log
Reputation and the fee dividend A score for whoever wants one; giving the fees back The fee
Reading the record: limits, trust, guarantees Standing: credit for people who do not have the money The log, the fee, identity
Syncing, gossip, freshness Information: limiting how far a copied promise travels Signed promises
Identity Making a lost standing stay lost Outside the protocol

So the pieces can be taken apart. The log with locked funds and syncing is an offline payment system that uses no reputation at all. The log with the fee and a reader’s tools is a credit record that needs no offline layer. Together they are what the camp needs: most people there cannot lock funds, and standing is what serves them. The only pieces that cannot be separated are the fee, the reputation score and the dividend, for a reason section 5 gives.

4. The base: a log of promises

A promise is a small record: who promises, to whom, what, and by when. It is pending until it is either fulfilled or, once its deadline has passed, defaulted.

The protocol is a public log of promises, and a reputation that is earned by keeping them. Everything else is built on top by anyone who wants to, as a script: a contract that records promises and moves money on behalf of the people using it.

The pieces of Rain and how they connect

The pieces. Users give a script its powers. The script writes to the promise log and can hold a user’s reputation as a bond. An oracle reads the log and credits reputation for kept promises. Every promise pays a fee, and the fees are shared out among everyone holding reputation.

One rule makes this safe to open to anyone. A script has only the powers you gave it. It can record a promise in your name only if you authorised it or signed that promise yourself, move only the money you allowed it, and bond only as much of your reputation as you agreed. Nobody can be made a promisor, and so nobody can be made a defaulter, without consenting.

A promise can also be made by signature alone. The promisor signs its terms with no transaction, and whoever next reaches the chain records it. The signature is the consent, and it cannot be withdrawn by emptying an account or revoking a permission. This is what lets a promise be made with no connection.

5. Standing: a record that is costly to lose

Three more rules turn the log into a record worth reading.

  • Every promise pays a fee, a percentage of the amount promised.
  • Keeping a promise earns reputation in proportion to that fee, at a fixed price per point. Reputation is therefore a record of fees paid on promises that were kept. A large promise counts for more than a small one, and a new identity starts with none.
  • Reputation fades. Every period each score shrinks by a fixed fraction. A promise kept three years ago says less about someone than one kept last month.

A broken promise is recorded too, on a second counter beside the first, in the same unit and fading at the same rate. The two together are the evidence for a simple estimate: how likely is this person to keep their next promise?

Where fees go and how reputation is earned

Fees and reputation. All fees go into a fund. Each cycle a fixed fraction of the fund is paid out, shared in proportion to reputation. The fraction is the same as the rate at which reputation fades.

These three are the pieces that come as one. The fee is what makes a record costly to fake. The fees have to go somewhere, and paying them out to holders of reputation returns them to the people who paid, slowly, without making the fee refundable. And the payout is set so that a point is always worth less than the fees it cost: if it were worth more, people would buy reputation by trading empty promises with each other.

So reputation is not collateral. It is tempting to read it that way: bond enough of it and the loan is safe. But a point worth less than it cost can only ever secure a small loan. Reputation does two other jobs.

  • It is a record that costs something to make. What someone has repaid, and how much, is evidence about what they will do next, and every entry cost a fee. The fee is small, though, and two friends can pass a loan back and forth. So what an entry is worth depends on who is reading. A lender who knows the counterparty can take it at face value. A lender who knows nobody can take it for what it cost: the fees sunk in a record are credit that nobody can profit from faking.
  • It is a standing that is costly to lose. A borrower who has worked up to large loans, and expects to keep borrowing, gives that up by defaulting. So does anyone who holds a role or a service that requires good standing. This is most of what a default costs.

Two scripts use it.

A loan. The reference script is a fixed-term loan.

The life of a loan

  1. The borrower asks for a loan and may bond some reputation: it is locked, and only the script can unlock it.
  2. The lender pays the principal. Only now is the borrower’s promise to repay recorded, and the fee paid.
  3. If the borrower repays in time, the bond is returned and they earn reputation.
  4. If the deadline passes, anyone can declare the default. The bond is destroyed and the broken promise goes on the borrower’s record. The lender receives a claim token for the amount owed, which they can keep or sell. The borrower is marked delinquent: they cannot borrow, and promises they keep while delinquent earn nothing.
  5. To clear their name the borrower must get the claim token back, which in practice means paying whoever holds it, and burn it. The destroyed bond does not come back.

A guarantee. A newcomer has no record for a lender to read. Someone who has one can answer for them.

A guaranteed loan is two promises

The loan is two promises: the borrower’s to the guarantor, and the guarantor’s to the lender. If the borrower defaults, the guarantor pays the lender and holds the claim on the borrower. A newcomer can therefore borrow on the first day, and every loan they repay sinks fees that a lender can count. A newcomer borrowing 10,000 a cycle needs no guarantor from loan 44.

6. Without a connection

A payer with no connection cannot be checked against a ledger, so the same money can be promised twice. No design prevents this. A system that keeps working while it is cut off cannot also keep every copy of its ledger in agreement: that is the CAP theorem, and the earlier post explains why it leaves deterrence as the only tool.

No system gets every tick.

  Works with no connection A double spend is impossible Needs no third party to enforce it Leaves a record to borrow on
Bank transfers, mobile money ✗ ✓ ✗ ✓
Blockchains (Bitcoin, Ethereum) ✗ ✓ ✓ ✗
Chip cards and hardware wallets, offline ✓ ✓ ✗ ✗
Cash ✓ ✓ ✓ ✗
Offline e-cash1 ✓ ✗ ✗ ✗
Rain ✓ ✗ ✓ ✓

The first two rows choose consistency: they stop when they cannot reach their ledger. The rest stay available. Cards and hardware wallets prevent a double spend only while the hardware resists tampering, and someone has to answer when it does not: the issuing bank, or the maker of the device. Cash prevents it by being a physical object. Offline e-cash and Rain give prevention up. E-cash reveals who spent twice and leaves the penalty to a bank or a court. Rain puts the second payment on the payer’s record as a broken promise, and the penalty is inside the system: the credit that record would have supported. It does lean on two shared services: an oracle that turns the log into scores, and a registry of identities that cannot be replaced for free. Neither needs an owner. The oracle’s rule is open code and a function of the public log, so anyone can recompute what it posts, and both can be run by an organisation its users govern.

Rain’s own ledger is a blockchain, so it too stops when it cannot agree. Offline payments are a layer on top of it that stays available. In that layer a payment is a signed promise, a note, and a double spend is a note the payer cannot cover.

An offline payment and a double spend

A payer who holds 60 signs a note for 50 to each of two shops. Neither shop can see the chain or the other. When a carrier presents both notes, the first is paid. The second is recorded all the same, and when its deadline passes it is a broken promise: the shop holds a claim and the payer is delinquent.

The layer does not prevent a double spend. It makes one visible and permanent. What limits the damage is the three things of section 3, each in its offline form.

On standing. With nothing locked, a shop that accepts a note is a lender, and what it should accept is a credit limit read from the payer’s record. One thing is different offline. A limit is on everything a person owes at once, and a shop that is cut off sees only its own notes.

Default rate against the number of shops, with and without dividing the limit

Shops that each accept a payer’s whole limit meant to accept a 10% chance of default. With two shops it is 55%, with five 82%. Shops that each accept a fifth are back at 10% when the payer visits all five.

So a shop should divide the limit by the number of places the payer could be spending before anyone syncs. That is the price of staying available: each shop accepts less. Standing is also spent offline faster than it is built. With the limit divided among five shops, no single note shows more than the payer has already shown, and a stranger’s limit stays at 108.9.

On collateral. A payer who has the money can remove the question. Before losing the connection they lock an amount on the chain, with a further deposit, and carry a certificate of it signed by a key every shop knows. Every note quotes the certificate.

  • Notes within the amount are certain to be paid, whatever becomes of the payer. A shop needs no record and no belief about them.
  • An overspend proves itself. Notes under one certificate that total more than its amount are proof of fraud, from the notes alone, and nobody but the payer can produce them. A shop cannot be talked into refusing an honest payer.
  • The deposit is what overspending costs. On the chain, the first note past the amount hands the deposit to whoever presents it.

This part uses no reputation.

On information. Neither of those stops a note being copied to a shop that has not heard of the others. A signed note can be copied to anyone who will take it: an attacker who visits every shop in a market of 1,000, where each shop divided by five, takes 200 limits. Nothing on the payer’s side can prevent that, so the bound has to come from what the shops share.

  • Make the news travel. A double spender has to outrun word of their own notes. When notes are carried to the chain and shops sync from it, the attacker takes what they can reach while the news gets there and back, whatever the size of the market: 2.9 limits if carrying a note takes as long as five visits and a shop syncs every five. Ten helpers make that 21. Speed is what matters, and carrying notes quickly is worth paying for.
  • Share a hub. A camp is cut off from the internet and still connected to itself. If every shop in a market asks one local hub before accepting, the hub sees the whole payer. A double spend is then possible only between markets, and shops that share a hub can count what a payer owed at once, so standing grows there as it would on a ladder of loans.
  • Refuse to deal on old information. A shop that will not accept notes when its own sync is stale caps its risk whatever the attacker does. That is a dial between staying available and staying consistent, and each shop can set its own.

Information works the same for both kinds of note. With locked funds the attacker gets the same 2.9 amounts accepted, but shops lose 1.9 of them where they lost 2.9, and against a deposit of twice the amount the attacker ends 0.09 down. One with ten helpers is still 15 up against a deposit of five times the amount. So the deposit a shop should want to see depends on how fast it thinks a payer can move.

Both note scripts and the engine’s support for signed promises are built and tested. The hub is not.

7. What we are aiming for

Seven properties, each stated so that an experiment could contradict it. The first six are about standing, and the seventh draws on all three. The right-hand column is where each stands; the testing note has the experiments.

Aim Where it stands
1. Reputation cannot be bought at a profit. A point is worth 0.375 of what it cost, whatever the parameters. Passing a loan between two accounts costs 0.625% of its amount.
2. Reputation has a stable value. A point’s value over its cost stays at 0.375 through a tenfold rise in activity and 0.375 through a tenfold fall.
3. Defaulting costs more than it gains, at loan sizes people would want. Not through the bond, which secures a loan only at 2.67 times the loan in fees. Through access: on a ladder of growing loans, a borrower who would be shut out does not gain by defaulting on loans 0 to 57. One who can return under a new name is deterred only on loans 20 to 48.
4. A new identity gets nothing for free. An identity starts with no reputation. A stranger’s first loan is small, and the lender’s expected loss on it is the price of learning who is genuine.
5. Reputation follows what people do, not when they arrived or how large they are. After about 550 periods a late arrival’s standing is 1.00 of an early one’s. Someone who defaults one time in ten gets 0.64 of their fees back; a reliable one 1.07.
6. A record cannot be manufactured at a profit, and a newcomer has somewhere to start. A lender who believes the whole log can be robbed without limit. One who counts a record at what it cost cannot: of 671 strategies searched for a ring, none profits. A newcomer starts with a guarantor.
7. It works without a connection. Section 6. Dividing the limit holds defaults at the 10% shops intended, if they guess the payer’s reach correctly. Against an attacker who visits every shop, the loss is set by how fast news of the notes travels.

Of 137 predictions written down before the experiments were run, 103 held, 23 held in part and 11 were wrong. Several of the wrong ones changed the design.

8. What Rain does not do

Rain does not decide what a good deal is. A script may lend too much against too little, or set a deadline nobody could meet. The log will record it faithfully, and a careful user or their wallet can read the script before agreeing to it. Rain’s part is to make sure the record is true, that nobody is bound by a script they did not choose, and that a record cannot be manufactured cheaply.

It does not decide whom to believe. The on-chain counters treat every counterparty alike; a reader weighs the log by its own trust.

It does not solve identity. Being shut out only hurts someone who cannot come back under a new name, and aim 3 shows how much that matters.

9. Where it stands, and where next

The contracts, a model of their accounting that is checked against them, and 22 experiments are in the repository. Nothing is deployed, the contracts are unaudited, and the oracle that credits reputation is, for now, a single trusted role.

  • A hub for offline markets that answers for the notes it allows.
  • The cost of an identity, which every result above leans on and none models.
  • Real parameters. How borrowers differ is assumed throughout. Lending data would let it be fitted.
  • More primitives, such as a promise that only takes effect if another is kept or broken.
  • Governance. An organisation run by its users (a DAO) to hold the few parameters (the fee, the price of a point, the rate at which reputation fades), the identity registry, and the oracle, with the oracle’s updates open to challenge by anyone who recomputes them.
  1. Chaum, D., Fiat, A., & Naor, M. (1990). Untraceable electronic cash. Advances in Cryptology: CRYPTO ‘88. ↩

Comments