Skip to content

bluepagesdoteth/bluepages_examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bluepages.fyi Code Examples

Working code examples for the bluepages.fyi API - map Ethereum addresses to social profiles (Twitter, Farcaster, ENS).

Examples Included

1. Per-Request Payment (javascript/fetch_twitter_data.js)

Status: ✅ Tested and working

Batch lookup script using x402 micropayments:

  • Reads addresses from CSV
  • Checks which addresses exist ($0.04 per 50)
  • Fetches full data only for found addresses ($2.00 per 50)
  • Optimized two-phase approach saves money

2. API Key Authentication (javascript/api-key-example.js)

Status: ✅ Tested and working

Shows the complete API key workflow:

  • Authenticate with wallet signature
  • Get your API key automatically
  • View available credit packages
  • Purchase credits with x402 payment
  • Use API key for lookups (no per-request payment)
  • Check your stats and regenerate keys

3. Python Per-Request Payment (python/fetch_twitter_data.py)

Status: ✅ Tested and working

Python version of the batch lookup script:

  • Uses x402 library for per-request payments
  • Two-phase optimization (check then fetch)
  • Reads from CSV, outputs JSON

4. Python API Key Example (python/api-key-example.py)

Status: ✅ Tested and working

Python version of the API key workflow:

  • Authenticate and get API key
  • View packages
  • Use API key for lookups
  • Check stats
  • Regenerate keys

Quick Start

JavaScript Per-Request

cd javascript/
npm install
echo "PAYMENT_PRIVATE_KEY=0xyour_key" > ../.env
npm start

JavaScript API Key

cd javascript/
npm install
echo "PAYMENT_PRIVATE_KEY=0xyour_key" > ../.env
node api-key-example.js

Python Per-Request

cd python/
pip install -r requirements.txt
echo "PAYMENT_PRIVATE_KEY=0xyour_key" > ../.env
python3 fetch_twitter_data.py

Python API Key

cd python/
pip install -r requirements.txt
echo "PAYMENT_PRIVATE_KEY=0xyour_key" > ../.env
python3 api-key-example.py

Requirements

  • Node.js (for JavaScript)
  • Python 3.8+ (for Python)
  • USDC on Base mainnet (for purchases)
  • Private key with USDC balance

Actual API Costs

Per-Request (x402):

  • batch/check: $0.04 per 50 addresses
  • batch/data: $2.00 per 50 addresses

API Key (Credits):

  • Starter: 5,000 credits for $5
  • Pro: 50,000 credits for $45
  • Enterprise: 1,000,000 credits for $600

1 credit = 1 API call

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors