Objective
Run a local instance of the Validator Rewards API, expose it on an HTTP port, and verify the main service endpoints.Prerequisites
- A local checkout of the
ton-validators-rewards-apisource code. - Go 1.25.0 or later.
- Optional: Docker Engine.
Build and start the binary
Run the following commands from the project root:8080 by default.
When -config is not set, startup downloads
https://ton.org/global-config.json and uses the liteservers from that file.
Configure the process
The process loads environment variables from a.env file in the working
directory, when present.
Supported environment variables:
| Variable | Description |
|---|---|
PORT | HTTP port. Default: 8080. |
UPTRACE_DSN | Uptrace DSN for tracing. If unset, telemetry stays disabled. |
<CONFIG_PATH>: path to a TON global config JSON file.
Use a custom TON global config file:
Run with Docker
Build and start the container image:Verify
Check the health endpoint:block, election_id, total_stake, and
validators.
Troubleshoot
- If startup fails while downloading the default config, start the service with
-config <CONFIG_PATH>and use a local TON global config file. - If port
8080is already in use, setPORTto a different value. - If
GET /api/round-rewardsreturns an error that the round is not finished, query an older finished round byelection_idor by ablockinside that round.