Giter VIP home page Giter VIP logo

blockchain-infra-decentralization-metrics's Introduction

Blockchain Infra Decentralization Metrics

This repo is a collection of scripts that measure the infrastructure decentralization of multiple blockchains.

This project measures:

  • Stake distribution across infrastructure providers.
  • Stake distribution across geographies.
  • RPC nodes distribution across infrastructure providers
  • RPC nodes distribution across geographies

How it Works

The individual scripts inside each chain directory get/crawls the IP addresses of the validators and finds their respective stake and other relevant information. Each script outputs the data for their chain to a JSON file inside the json folder in the root directory. That JSON file must follow the specification below. Some of the scripts or programs inside each directory may need some work, so contributions are welcomed.

The main.py script uses the JSON files for a given chain to find the infrastructure provider and the geographic location where each node is running.

JSON specification

The output should be a JSON objects in the following format:

{
    "timestamp": <str> # When was the analysis last ran
    "collection_method": <str>, <"crawl" for nodes manually crawled, or "api" for IPs found via the chain RPC API>
    "chain_data": {Any other information to add about the chain},
    "nodes": {
        <IP Address> : {
            "is_validator": <bool>, #Differentiate between RPC nodes and validator nodes.
            "stake": <int>, #Stake of the validator or null if RPC node.
            "address": <string>, #On-chain address of the validator.
            "extra_info": {
                <Any other info you want to add that may be useful in processing (validator name, skip rate, etc)>
            }
        },
        <IP Address 2> : {},
        <IP Address 3> : {},
        .
        .
    }
}

Usage

The tool takes 1 mandatory parameter and 2 optional parameters in the following format:

  • [MANDATORY] --blockchain=[value]

    • Defines the target blockchain.
    • There must exist a file in the json/ directory matching [value] (i.e. [value].json).
  • --providers=[val1],[val2]

    • Defines the providers for which to track nodes, based on the config/ProviderConfig.json.
    • Only accepted values are the "short" attribute defined for each ASN in the ProviderConfig.json.
      • The keys are ASN numbers for the providers you want to track.
      • The values have the provider name, description, website, and "short".
  • --countries=[val1],[val2]

    • Defines the countries for which to track nodes, based on the ISO Alpha-2 country code convention.
    • Only accepted values are the ISO Alpha-2 country code. A table of each country code to its respective country can be found at config/CountryConfig.json.
  • --output -> Prints an overview of the results upon completion.

  • --help -> Prints this message.

Things to note

  1. Criteria for active in flow is defined by those nodes whose stake is lower than the minimum specified requirement for that node role - as per Flow's documentation.
  2. RPC node data is not available for all chains, and some stake data may be incomplete for some chains. See each chain's documentation for more information.
  3. For chains in which the IPs were acquired via crawling, there is no way to guarantee that the crawler has found an exhaustive list of all the nodes in the network.
  4. No IP data is found in this repo, just tools.

Disclaimer & License

This is not an officially supported Google product.

Apache Header:

Copyright 2022 Google LLC

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

blockchain-infra-decentralization-metrics's People

Contributors

davidmehi avatar kremermichael avatar thesampadilla avatar

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.