Base API Quick Start Guide
BlockEden.xyz provides high-performance, reliable Base infrastructure through our comprehensive JSON-RPC API. Connect to Ethereum mainnet, testnets, and layer 2 solutions with enterprise-grade reliability and developer-friendly tools.
Overviewโ
Our Base API supports:
- Base Mainnet and all major testnets (Sepolia, Holesky)
- Layer 2 Solutions (Polygon, Arbitrum, Optimism)
- Full JSON-RPC Specification with debug and trace methods
- WebSocket Connections for real-time data
- Archive Node Access for historical data
- MEV Protection and transaction simulation
Quick Startโ
Step 1: Get Your API Keyโ
- Visit BlockEden.xyz Dashboard
- Sign up for a free account if you haven't already
- Create a new API key for Base
- Select your target network (Mainnet, Sepolia, etc.)
Step 2: Make Your First Requestโ
Using cURLโ
curl -X POST https://api.blockeden.xyz/base/${accessKey} \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "eth_blockNumber",
    "params": [],
    "id": 1
  }'
Using JavaScript (Fetch)โ
const response = await fetch('https://api.blockeden.xyz/base/${accessKey}', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    jsonrpc: '2.0',
    method: 'eth_blockNumber',
    params: [],
    id: 1
  })
});
const data = await response.json();
console.log('Current block number:', parseInt(data.result, 16));
Using Pythonโ
import requests
import json
url = "https://api.blockeden.xyz/base/${accessKey}"
payload = {
    "jsonrpc": "2.0",
    "method": "eth_blockNumber",
    "params": [],
    "id": 1
}
response = requests.post(url, json=payload)
result = response.json()
print(f"Current block number: {int(result['result'], 16)}")
Core RPC Methodsโ
Account Informationโ
// Get account balance
{
  "jsonrpc": "2.0",
  "method": "eth_getBalance",
  "params": ["0x742D5Cc6bF2442E8C7c74c7b4Be6AB9d6f10f5B4", "latest"],
  "id": 1
}
// Get transaction count (nonce)
{
  "jsonrpc": "2.0",
  "method": "eth_getTransactionCount",
  "params": ["0x742D5Cc6bF2442E8C7c74c7b4Be6AB9d6f10f5B4", "latest"],
  "id": 1
}
Block Informationโ
// Get latest block
{
  "jsonrpc": "2.0",
  "method": "eth_getBlockByNumber",
  "params": ["latest", true],
  "id": 1
}
// Get block by hash
{
  "jsonrpc": "2.0",
  "method": "eth_getBlockByHash",
  "params": ["0x1234...abcd", true],
  "id": 1
}
Transaction Operationsโ
// Get transaction by hash
{
  "jsonrpc": "2.0",
  "method": "eth_getTransactionByHash",
  "params": ["0x1234...abcd"],
  "id": 1
}
// Send raw transaction
{
  "jsonrpc": "2.0",
  "method": "eth_sendRawTransaction",
  "params": ["0x1234...abcd"],
  "id": 1
}
Network Endpointsโ
Mainnetโ
- HTTP: https://api.blockeden.xyz/base/${accessKey}
- WebSocket: wss://api.blockeden.xyz/base/${accessKey}
Testnetsโ
- Sepolia: https://ethereum-sepolia.blockeden.xyz/<your-api-key>
- Holesky: https://ethereum-holesky.blockeden.xyz/<your-api-key>
Layer 2 Networksโ
- Polygon: https://polygon-mainnet.blockeden.xyz/<your-api-key>
- Arbitrum: https://arbitrum-mainnet.blockeden.xyz/<your-api-key>
- Optimism: https://optimism-mainnet.blockeden.xyz/<your-api-key>
Authentication & Securityโ
API Key Authenticationโ
All requests require your API key in the URL path. Keep your API key secure and never expose it in client-side code.
Rate Limitsโ
- Free tier: 100 requests per second
- Pro tier: 1,000 requests per second
- Enterprise: Custom limits
Best Practicesโ
- Use HTTPS for all API calls
- Implement retry logic with exponential backoff
- Cache responses when appropriate
- Monitor your usage in the dashboard
- Use batch requests for multiple operations
Common Use Casesโ
Check Account Balanceโ
async function getBalance(address) {
  const response = await fetch('https://api.blockeden.xyz/base/${accessKey}', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
      jsonrpc: '2.0',
      method: 'eth_getBalance',
      params: [address, 'latest'],
      id: 1
    })
  });
  
  const data = await response.json();
  const balanceWei = BigInt(data.result);
  const balanceEth = balanceWei / BigInt('1000000000000000000');
  return balanceEth.toString();
}
Monitor New Blocksโ
// Using WebSocket for real-time updates
const ws = new WebSocket('wss://api.blockeden.xyz/base/${accessKey}');
ws.on('open', () => {
  ws.send(JSON.stringify({
    jsonrpc: '2.0',
    method: 'eth_subscribe',
    params: ['newHeads'],
    id: 1
  }));
});
ws.on('message', (data) => {
  const result = JSON.parse(data);
  if (result.params) {
    console.log('New block:', result.params.result);
  }
});
Smart Contract Interactionโ
async function callContract(contractAddress, data) {
  const response = await fetch('https://api.blockeden.xyz/base/${accessKey}', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
      jsonrpc: '2.0',
      method: 'eth_call',
      params: [
        {
          to: contractAddress,
          data: data
        },
        'latest'
      ],
      id: 1
    })
  });
  
  return await response.json();
}
Error Handlingโ
Common Error Codesโ
// Handle RPC errors properly
async function safeRpcCall(method, params) {
  try {
    const response = await fetch(endpoint, {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({
        jsonrpc: '2.0',
        method,
        params,
        id: 1
      })
    });
    
    const data = await response.json();
    
    if (data.error) {
      throw new Error(`RPC Error ${data.error.code}: ${data.error.message}`);
    }
    
    return data.result;
  } catch (error) {
    console.error('RPC call failed:', error);
    throw error;
  }
}
Retry Logicโ
async function withRetry(fn, maxRetries = 3) {
  for (let i = 0; i < maxRetries; i++) {
    try {
      return await fn();
    } catch (error) {
      if (i === maxRetries - 1) throw error;
      await new Promise(resolve => setTimeout(resolve, 1000 * Math.pow(2, i)));
    }
  }
}
Next Stepsโ
- Explore the [Base JSON-RPC API Reference]./base-json-rpc-api.md for complete method documentation
- Learn about [WebSocket Connections]./base-websockets.md for real-time data
- Follow our [Web3.js Integration Guide]./base-web3-integration.md for frontend development
- Check out our [Ethers.js Integration Guide]./base-ethers-integration.md for modern development patterns
Resourcesโ
- Base Official Documentation
- JSON-RPC Specification
- EIP Standards
- BlockEden.xyz Dashboard
- Support & Community
Need Help?โ
- ๐ง Email: support@blockeden.xyz
- ๐ฌ Discord: Join our community
- ๐ฆ Twitter: @BlockEdenHQ
- ๐ Documentation: docs.blockeden.xyz
Cost: 300 CUs / req