|
Aug 10 2014
swarm-redistribution.js https://github.com/resilience-me/resilience.me/blob/master/Code/swarm_redistribution.js Example of how the swarm-redistribution script will work. This example uses the Ripple API to compute an accounts swarm (a tree-like-map of transaction patterns). This is just an example. The resilience.me-server script will use an algorithm similar to Ripple APIs account_balance, but it will return dividend pathways instead: [{account: ""},{ currency: "", amount: "", taxRate: ""},{currency: "", amount: "", taxRate: ""}...] [{account: ""},{ currency: "", amount: "", taxRate: ""},{currency: "", amount: "", taxRate: ""}...] [{account: ""},{ currency: "", amount: "", taxRate: ""},{currency: "", amount: "", taxRate: ""}...] resilience.me-server stores a sum of an accounts financial history with another account. as that account receives dividends, those dividends are subtracted from the sum for example, {account: XXX} with {currency: USD, amount: 10,000 taxRate: 0.02} receives 20 USD in dividend. their dividend pathway is then 9980 USD. this is a measure of citizenship, but on a peer-to-peer level the script will then loop back recursively. the following example-script shows part of the logic. To test: install npm download swarm_redistribution.js install ripple-lib and run the script: $ npm install ripple-lib $ node swarm_redistribution.js Example output: SWARM_USD_rfCFLzNJYvvnoGHWQYACmJpTgkLUaugLEw |
|