Giter Club home page Giter Club logo

fbas-reward-distributor's Introduction

FBAS Reward Distributor

MIT CI codecov dependency status

Framework for the computation of a node's influence and reward distribution in a Federated Byzantine Agreement Systems (FBASs) like Stellar.

The framework is suitable for usage as both a binary and a library and can mainly do the following:

  • read node data in stellarbeat's JSON format;
  • rank the nodes using a variety of implemented algorithms;
  • based on the rankings, compute a reward distribution for each node.

Required toolchain

Build and optionally run tests

  1. Build:
cargo build --release
  1. Tests
cargo test --release

Usage as a binary

  1. Command line arguments
cargo run --release -- {distribute | rank} [-i -p -r reward] <fbas-path> {node-rank|power-index-approx|power-index-enum}

    - fbas-path: Path to file describing the FBAS.
        If no path is passed, the program will attempt to read from the command line.
    - i: Ignore inactive nodes in the FBAS. Optional. Default = false.
    - r reward: reward value that is to be distributed - only used with the rank subcommand. Default = 1.
    - p: Include the nodes' public keys in the output. Default = false.

The rank subcommand is similar to distribute with the exception that it only calculates the nodes' weights without allocating rewards. The output is always a sorted list of tuples: (NodeID, Public Key (where available), Ranking, [Reward]).

  1. Compute a reward distribution for the nodes in the mobilecoin_nodes_2021-10-22.json FBAS using

    1. the Shapley-Shubik power index

          cargo run --release -- rank test_data/mobilecoin_nodes_2021-10-22.json power-index-enum
      

      This algorithm computes the players' Shapley-Shubik indices via enumeration in O(2^n) time, and is therefore not recommended for larger FBASs.

    2. As an alternative, we provide a polynomial time approximation algorithm using Castro et al.'s algorithm based on sampling.

      cargo run --release -- rank test_data/mobilecoin_nodes_2021-10-22.json power-index-approx 1000
      
    3. Distributions can also be computed based on a graph-theoretic (NodeRank) metric:

      cargo run --release -- rank test_data/mobilecoin_nodes_2021-10-22.json node-rank
      
      

Usage as a library

[dependencies]
fbas-reward-distributor = { git = "https://github.com/cndolo/fbas-reward-distributor", default-features = true}

See the fbas-graph-generator for some examples.

Performance and approximation measurements

  1. Build with
cargo build --release --features "measurements"
  1. then run performance measurements using the selected ranking algorithm
target/release/performance_tests -m $MAX_TOP_TIER --no-quorum-intersection -r $ITERATIONS -o $OUTPUT_FILE -j $JOBS -u $FBAS_TYPE $RANKING_ALGO
  1. and/or approximation measurements
target/release/approximation_tests -m $MAX_TOP_TIER --no-quorum-intersection -r $ITERATIONS -o $OUTPUT_FILE -j $JOBS -u $FBAS_TYPE

fbas-reward-distributor's People

Contributors

cndolo avatar dependabot[bot] avatar

Watchers

 avatar

Forkers

benjamin-loison

fbas-reward-distributor's Issues

Optionally minimise FBAS to top tier

The current default is to shrink all input FBASs to the top tier before running both power index computations.
But as measurements show, this actually makes things much slower when approximating the scores given the exponential time complexity of finding minimal quorums.

Hence, we should only minimise the FBAS for approximations when explicitly asked to do so by the user.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.