This directory contains tools and data for managing blockchain network information and RPC endpoints for https://rpc.info.
- Node.js: Version 22.18.0 or higher
- pnpm: Package manager
The external data system consists of several key components:
- Data Sources: Primary data comes from chainid.network
- Override Files: Custom configurations for networks and RPCs not in the primary source
- Generated Output: Consolidated data in
chains.generated.json
rpc.info.data/
├── refresh-data.ts # Main data aggregation script
├── chains.generated.json # Generated consolidated data
├── override-networks.json # Custom networks
├── override-rpc.json # Custom RPC endpoints by chain ID
├── override-chain-names.json # Custom chain name mappings
├── types.ts # TypeScript type definitions
└── tests/ # Test files
-
Install dependencies:
pnpm install
-
Refresh data:
pnpm run refresh-data # or node refresh-data.ts -
Run tests:
pnpm test # or pnpm test:watch
If the network exists in chainid.network/chains.json:
-
Simply run the refresh script:
node refresh-data.ts
-
Commit the updated
chains.generated.jsonfile
If the network is not in chainid.network/chains.json:
-
Add the network configuration to
override-networks.json:{ "chain": "blockchain-name", "slug": "network-slug", "name": "Network Display Name", "chainId": 1234567890, "networkId": null, "nativeCurrency": { "name": "TOKEN", "symbol": "TOKEN", "decimals": 18 }, "rpc": ["https://rpc-endpoint.com"] }The
networkIdfield is not currently used but is required for compatibility with chainid.network/chains.json. You can safely set it to null. -
Run the refresh script:
node refresh-data.ts
-
Commit the updated
chains.generated.jsonfile
If the RPC endpoint exists in chainid.network/chains.json:
-
Run the refresh script:
node refresh-data.ts
-
Commit the updated
chains.generated.jsonfile
If the RPC endpoint is not in the primary source:
-
Add the RPC to
override-rpc.jsonusing the chain ID as the key:{ "1": [ "https://new-ethereum-rpc.com", "https://another-ethereum-rpc.com" ] } -
Run the refresh script:
node refresh-data.ts
-
Commit the updated
chains.generated.jsonfile
- Add the RPC endpoints directly to the network configuration in
override-networks.json:
{
"chain": "blockchain-name",
"rpc": [
"https://my-rpc.com"
]
}-
Run the refresh script:
node refresh-data.ts
-
Commit the updated
chains.generated.jsonfile
# Run all tests
pnpm test
# Run tests in watch mode
pnpm run test:watchThe system includes comprehensive tests to ensure data integrity and proper formatting. Always run tests after making changes to override files.
The test should have unique first words for all chains ensures correct grouping of networks.
Sometimes, the data from the primary source contains several networks belonging to the same blockchain, but with slightly different names.
Usually, the first word is the same.
For example, Boba BNB Mainnet and Boba BNB Testnet are both networks of the chain Boba BNB.
This test identifies such inconsistencies.
To fix them, add mappings to override-chain-names.json. In this case:
"Boba BNB Mainnet": "Boba BNB",
"Boba BNB Testnet": "Boba BNB",
- Check existing data: Always verify if the network/RPC already exists in the primary source
- Use override files: Only add custom data when necessary
- Test changes: Run the test suite before committing
- Node.js version: Ensure you're using Node.js 22.18.0+
- Network connectivity: The script requires internet access to fetch from chainid.network
- JSON formatting: Ensure all JSON files are properly formatted
- Duplicate entries: Check for existing entries before adding new ones