/nakomoto-coefficient-calculator

Nakomoto coefficient for different blockchains to understand levels of decentralization

Primary LanguageGoMIT LicenseMIT

Nakamoto Coefficient Calculator

AIM

The aim of this project is to calculate the nakamoto coefficients for various popular blockchains.

Nakamoto coefficient is a way to calculate the level of decentralization in a particular chain.

Programming Languages

Golang

Steps to run

  1. Install golang
  2. Also, install postgresql and make sure it is running in the background
  3. After postgres is installed, copy the commands in db/postgres_script.sql into the terminal
  4. Add following to your ~/.bashrc or ~/.zshrc:
    1. export SOLANA_API_KEY=api_key
    2. export DATABASE_URL=postgres://username:password@localhost:5432/postgres
  5. In a separate terminal, run go run core/main.go. This will start the core logic of calculating the nakamoto coefficients.
  6. If you want to start the server, run go run server/main.go in another terminal.

Chains currently supported

  1. Cosmos
  2. Polygon
  3. Binance Smart Chain
  4. Osmosis Zone
  5. Mina
  6. Solana
  7. Avalanche
  8. Terra
  9. Graph Protocol
  10. Thorchain
  11. Near
  12. Juno
  13. Ethereum 2
  14. Regen Network
  15. Agoric

Notes

  1. The actual logic is present inside /core. So, ideally a cron job would be run after every JOB_INTERVAL which would save/refresh the nakamoto-coefficients database.
  2. The server code resides inside /server. It is a simple server which would only respond to GET /nakamoto-coefficients. It basically queries the database and returns the values.

Future Work

To add support for multiple other chains in /v1