Alkimist Validator Rewards API Documentation

This documentation describes two related components:

  1. Data API: A PHP script that retrieves data from two external APIs, performs calculations, and returns the results in JSON or HTML format. This is the core data-processing engine.
  2. Calculator Interface: A PHP-based web form that allows users to interact with the Data API and view the results.

1. Data API (api_script.php)

Endpoint: https://theworm.me/api/validator_revenue.php (Replace with your actual URL)

Method: GET

Description: This API retrieves data from the pub_earningads_api.php and daily.php APIs on arena.alkimist.xyz, calculates daily, weekly, monthly, and quarterly revenue, and computes validator rewards based on a configurable number of validators.

Parameters:

Parameter Type Required Default Description
num_validators integer No 1 The number of validators to use in the reward calculations. Must be a positive integer.
format string No json The desired output format. Must be either json (for JSON output) or html (for an HTML table).

Response Codes:

Response Format (JSON):

{
    "daily_revenue": 1234.56,
    "weekly_revenue": 5678.90,
    "monthly_revenue": 20000.00,
    "quarterly_revenue": 60000.00,
    "validator_daily": 123.46,
    "validator_monthly": 456.78,
    "validator_quarterly": 789.01
}
    

Response Format (HTML):

A simple HTML table containing the same data as the JSON response, with column headers. Numeric values are formatted to two decimal places.

Example Request (JSON):

https://yourdomain.com/api_script.php?num_validators=5&format=json

Example Request (HTML):

https://yourdomain.com/api_script.php?num_validators=2&format=html

Error Handling:

If an error occurs while fetching data from the external APIs or processing the data, the API will return a 500 status code and an error message.

2. Calculator Interface (calculator.php)

Endpoint: https://theworm.me/api/validator_rev_form.php (Replace with your actual URL)

Method: GET (initial page load), POST (form submission)

Description: This provides a web form for users to interact with the Data API. Users can specify the number of validators and the desired output format (HTML or JSON).

Form Fields: