samedi 29 novembre 2014

In a mutual credit network, how would you program an automatic jubilee?


A little explanation might be needed. I mean mutual credit the way that it's defined here:



a type of alternative currency in which the currency used in a transaction can be created at the time of the transaction



Imagine you have a network of accounts. Each starts out at zero and any account can extend a limited line of credit to any other account. My total balance would just be the sum of what others "owe" to me, minus the sum of what I owe to others.


Lines of credit can be represented with a simple table. In pseudo-code for some kind of ORM:



type LineOfCredit struct {
Creditor string, // Account ID of person offering credit
Borrower string, // Account ID of person taking on debt
Owed int, // Amount owed
Limit int, // Credit limit
}


I'll use "$" to represent the currency, though, of course, the units are arbitrary. Imagine that...



  • Bob owes $20 to Sally

  • Sally owes $20 to Joe

  • Joe owes $20 to Bob


It's clear that there's no actual debt here and they don't owe one another anything.


So, how would you detect these kinds of cycles in a balance sheet and then eliminate them? Is this a problem for graph theory? I imagine this can be represented as a directed network graph. My knowledge here is very limited, but I understand it's possible to detect cycles with Tarjan's strongly connected components algorithm, though that doesn't seem to offer much help, especially as those cycles get larger. I also thought that, maybe, shortest-paths could be crunched at the time of a transaction, with the reciprocals of outstanding "debts" represented as edge-weights/distances.


I think Ripple pay possibly did something like this, but I'm having trouble finding a precedent.





Aucun commentaire:

Enregistrer un commentaire