A Node.js based REST API service for querying token supply data. The service reads tokenomics data in CSV format and provides an interface to query token supply information based on timestamps.
- Parse and read tokenomics CSV data
- Query supply by timestamp
- Return total supply and circulating supply
- RESTful API design
- Time-based supply calculation
Requires Node.js (v14+). To install:
# Clone repository
git clone [repository-url]
# Install dependencies
cd [project-directory]
npm installThe following environment variables can be configured:
PORT: The port on which the server will run (default: 3000)CSV_FILE_PATH: Path to the tokenomics CSV file (default:./tokenomics.csv)
The tokenomics.csv file should contain these columns:
- Date: Release date (YYYY/MM/DD)
- Month: Month number
- Node Rewards: Node rewards allocation
- Operating Funds: Operating funds allocation
- Community Funds: Community funds allocation
- User Rewards: User rewards allocation
- Initial Liquidity & MM Fund: Initial liquidity and market maker fund
- Fundraising: Fundraising allocation
- Core Team & Consultants: Core team and consultants allocation
- Total: Total supply
- Circulating Percent: Circulating percentage
# Start server
npm startServer will run at http://localhost:3000
Query token supply data for a specific timestamp.
Parameters:
- timestamp (optional): ISO format timestamp, defaults to current time
Example Requests:
# Query current supply
curl http://localhost:3000/
# Query supply for specific time
curl http://localhost:3000/?timestamp=2024-12-12T00:00:00ZResponse Format:
{
"timestamp": "2024-12-12T00:00:00.000Z",
"timeRange": "2024/12/12 - 2025/01/12 (Current: 2024/12/12)",
"totalSupply": 10000000000,
"circulatingSupply": 800000000,
"circulatingPercent": 0.08
}Query circulating supply data for a specific timestamp.
Parameters:
- timestamp (optional): ISO format timestamp, defaults to current time
Example Requests:
# Query current circulating supply
curl http://localhost:3000/circulatingSupply
# Query circulating supply for specific time
curl http://localhost:3000/circulatingSupply?timestamp=2024-12-12T00:00:00ZResponse Format:
800000000Query circulating supply data for a specific timestamp and return as JSON.
Parameters:
- timestamp (optional): ISO format timestamp, defaults to current time
Example Requests:
# Query current circulating supply
curl http://localhost:3000/circulatingSupply/json
# Query circulating supply for specific time
curl http://localhost:3000/circulatingSupply/json?timestamp=2024-12-12T00:00:00ZResponse Format:
{
"result": 800000000
}Query total supply data for a specific timestamp.
Parameters:
- timestamp (optional): ISO format timestamp, defaults to current time
Example Requests:
# Query current total supply
curl http://localhost:3000/totalSupply
# Query total supply for specific time
curl http://localhost:3000/totalSupply?timestamp=2024-12-12T00:00:00ZResponse Format:
10000000000Query total supply data for a specific timestamp and return as JSON.
Parameters:
- timestamp (optional): ISO format timestamp, defaults to current time
Example Requests:
# Query current total supply
curl http://localhost:3000/totalSupply/json
# Query total supply for specific time
curl http://localhost:3000/totalSupply/json?timestamp=2024-12-12T00:00:00ZResponse Format:
{
"result": 10000000000
}- express: Web framework for creating REST API
- csv-parser: CSV parsing library for reading tokenomics data
- moment: Date handling and formatting library
- web3: Ethereum JavaScript API (currently included but not actively used)
├── index.js # Main application file
├── package.json # Project dependencies and scripts
├── tokenomics.csv # Tokenomics data file
└── README.md # Project documentation
MIT