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.
Golang
- Install golang
- Also, install postgresql and make sure it is running in the background
- After postgres is installed, copy the commands in
db/postgres_script.sql
into the terminal - Add following to your
~/.bashrc
or~/.zshrc
:export SOLANA_API_KEY=api_key
export DATABASE_URL=postgres://username:password@localhost:5432/postgres
- In a separate terminal, run
go run core/main.go
. This will start the core logic of calculating the nakamoto coefficients. - If you want to start the server, run
go run server/main.go
in another terminal.
- Cosmos
- Polygon
- Binance Smart Chain
- Osmosis Zone
- Mina
- Solana
- Avalanche
- Terra
- Graph Protocol
- Thorchain
- Near
- Juno
- Ethereum 2
- Regen Network
- Agoric
- The actual logic is present inside
/core
. So, ideally a cron job would be run after everyJOB_INTERVAL
which would save/refresh the nakamoto-coefficientsdatabase
. - The server code resides inside
/server
. It is a simple server which would only respond toGET /nakamoto-coefficients
. It basically queries the database and returns the values.
To add support for multiple other chains in /v1