- First, install the required dependencies:
npm install
- Create a .env file in the same directory as your script with these variables:
TELEMETRY_WEBSOCKET_URL=wss://telemetry.subspace.foundation/feed
# Google Cloud Service Account credentials
GOOGLE_CLOUD_CLIENT_EMAIL=your-service-account@your-project.iam.gserviceaccount.com
GOOGLE_CLOUD_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\nYour Private Key Here\n-----END PRIVATE KEY-----"
GOOGLE_SHEET_ID=your-spreadsheet-id
# Optional: Add any network-specific configuration if needed for @autonomys/auto-utils
Here's what you need to do to get these credentials:
- Google Cloud Setup:
- Go to the Google Cloud Console (https://console.cloud.google.com)
- Create a new project or select an existing one
- Enable the Google Sheets API for your project
- Create a Service Account:
- Go to "IAM & Admin" > "Service Accounts"
- Click "Create Service Account"
- Give it a name and grant it the "Editor" role
- Create a key (JSON type)
- Download the JSON file
- Google Sheet Setup:
- Create a new Google Sheet
- Share the sheet with the service account email address (with editor access)
- Copy the spreadsheet ID from the URL (it's the long string between /d/ and /edit in the URL)
- To run the script:
node local-test-mainnet.js
The script will: - Subscribe to Telemetry websocket - Collect information on nodes uptime - Write the collected data to your Google Sheet