This is a Next.js project bootstrapped with create-next-app
.
Rename the .env.example file to .env and fill in the values.
install dependencies
yarn install
Then, run the development server:
yarn dev
Open http://localhost:3000 with your browser to see the result.
There is a configuration file in the root of the project config.json
. You can change the configurations in this file.
The file has the following key/value configs
- teams: An array of teams. Each team has a name and an array of nodes to attack.
- points_config: An object with the following key/value configs
- points_per_lagging_node: The points awarded to a node if it is lagging behind the latest block.
- points_per_unreachable_node: The points awarded to a node if it is unreachable.
- core_version: The additional points awarded to a lagging/unreachable node if its version matches the version defined here.
- config: An object with the following key/value configs
- blocks_behind_before_considered_lagging: The amount of blocks behind the latest tip before a node is considered as lagging
- fork_observer_api: The source of data to poll from
Note: Without the fork_observer_api, the game will start with dummy data located at /public/header-and-teams.json
and simulate increaing heighest tip from 80 to 82 every 5 seconds.
An editable team-points config can be found in data/team-points.json
. (Do not worry if you don't have this file, it will be generated for you on first run)
Note: This file is auto-generated and should not be overwritten. Points awarded to teams gets written to this file. Only edit this file if you want to setup initial points for certain teams.
/data/events.json
contains generated events from awarding points. Do not edit this file. It is autogenerated.
The admin panel is located at /admin
. You can use the admin panel to award points to teams.
It will request you authentication to access the admin panel. You should enter the admin key in the form that is displayed which is stored as cookies.
If your key is invalid and you try assigning points the form will be displayed again.
ensure you have the admin key in your .env file "ADMIN_KEY = {{ADMIN_KEY_HERE}}"
/api/initialize
initializes the game.
- auto generates teams from the fork observer api and populates teams in the config file
- initalizes team points config (overwrites existing points config)
- initalizes events log (overwrites existing events log)
/api/reset
resets the data in the /data
folder. This is useful if you want to restart the game.
The logic and APIs used in this project will only work on a local machine with yarn dev
. Running with yarn start
or deploying to Vercel will not work. Because they run in a different environment.
A feature to deploy this project to Vercel can be found here: server.