A Netlify serverless function that collects network telemetry data from the Autonomys (Subspace) blockchain networks and writes it to Google Sheets for tracking and analysis.
This scraper collects data from two networks:
- Chronos (testnet) - Basic telemetry stats
- Mainnet - Extended telemetry stats with additional on-chain metrics
| Column | Description |
|---|---|
| Timestamp | ISO 8601 timestamp of data collection |
| Node Count | Total number of nodes on the network |
| Space Pledged | Raw space pledged in bytes |
| Subspace Node Count | Nodes running Subspace CLI |
| Space Acres Node Count | Nodes running Space Acres |
| Linux Node Count | Nodes on Linux |
| Windows Node Count | Nodes on Windows |
| macOS Node Count | Nodes on macOS |
| Column | Description |
|---|---|
| Space Pledged (PiB) | Space pledged in Pebibytes (bytes ÷ 2^50) |
| Space Pledged (PB) | Space pledged in Petabytes (bytes ÷ 1000^5) |
| Fee per GB (AI3) | Transaction fee per GB in AI3 tokens |
| Total Staked (AI3) | Total staked amount including storage fees |
- Telemetry Stats: Scraped from telemetry.subspace.network using Puppeteer
- Space Pledged: Fetched via
@autonomys/auto-consensusSDK - Transaction Fees: Queried from
transactionFees.transactionByteFee()pallet - Staking Data: Aggregated from all operators via
@autonomys/auto-consensus
- Node.js 18+
- npm or yarn
- Google Cloud service account with Sheets API access
- Netlify account (for deployment)
npm installCreate a .env file or configure in Netlify:
GOOGLE_CLOUD_CLIENT_EMAIL=your-service-account@project.iam.gserviceaccount.com
GOOGLE_CLOUD_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n"
GOOGLE_SHEET_ID=your-spreadsheet-idUse the test script to verify scraping and API calls work correctly:
# Test both networks (chronos + mainnet)
node test-scraper.js
# Test only mainnet (includes all extra columns)
node test-scraper.js mainnet
# Test only chronos
node test-scraper.js chronosThe test script outputs:
- Scraped stats from telemetry page
- On-chain data (space pledged, fees, staking)
- Formatted row data as it would appear in Google Sheets
# Install Netlify CLI
npm install -g netlify-cli
# Run locally
netlify devnetlify deploy --prodThe function is configured to run daily via Netlify scheduled functions:
export const config = {
schedule: "@daily"
};The function also includes a 10-minute deduplication check to prevent duplicate entries if triggered multiple times.
telemetry_scrapper/
├── netlify/
│ └── functions/
│ └── updatesheet.js # Main Netlify function
├── test-scraper.js # Local testing script
├── netlify.toml # Netlify configuration
├── package.json
└── README.md
[functions]
node_bundler = "esbuild"
[functions.updatesheet]
timeout = 60| Package | Purpose |
|---|---|
@autonomys/auto-utils |
Blockchain connection and token utilities |
@autonomys/auto-consensus |
Consensus layer queries (space pledged, operators) |
puppeteer / puppeteer-core |
Browser automation for scraping |
@sparticuz/chromium |
Chromium binary for serverless environments |
googleapis |
Google Sheets API client |
ISC