Base API Quick Start Guide
BlockEden.xyz provides high-performance infrastructure for Base, Coinbase's Layer 2 solution built on the OP Stack. Access Base's ultra-low fees and enterprise-grade security through our global API endpoints with sub-second response times.
What is Base?
Base is Coinbase's Layer 2 blockchain that brings the next billion users onchain:
- Ultra-Low Fees: Transactions cost fractions of a penny
- EVM Compatibility: Full Ethereum tooling and smart contract support
- OP Stack Technology: Built on Optimism's proven infrastructure
- Enterprise Security: Backed by Coinbase's institutional-grade infrastructure
- No Native Token: Uses ETH for gas fees, simplifying the user experience
- Instant Finality: Fast transaction confirmation with L2 scaling
API Endpoints
BlockEden.xyz supports all Base API methods through our global infrastructure:
Mainnet
- JSON-RPC:
https://api.blockeden.xyz/base/<your-api-key>
- WebSocket:
wss://api.blockeden.xyz/base/<your-api-key>
Testnet (Sepolia)
- JSON-RPC:
https://api.blockeden.xyz/base-sepolia/<your-api-key>
- WebSocket:
wss://api.blockeden.xyz/base-sepolia/<your-api-key>
Quick Start
Step 1: Get Your API Key
- Visit BlockEden.xyz Dashboard
- Create a new API key for Base
- Select Mainnet or Testnet
Step 2: Test Connection
Get Latest Block Number
curl -X POST https://api.blockeden.xyz/base/<your-api-key> \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_blockNumber",
"params": [],
"id": 1
}'
Get Account Balance
curl -X POST https://api.blockeden.xyz/base/<your-api-key> \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_getBalance",
"params": ["0x742D5Cc6bF2442E8C7c74c7b4Be6AB9d6f10f5B4", "latest"],
"id": 1
}'
Get Gas Price
curl -X POST https://api.blockeden.xyz/base/<your-api-key> \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_gasPrice",
"params": [],
"id": 1
}'
Supported API Methods
Core JSON-RPC Methods
All standard Ethereum JSON-RPC methods are supported:
- Account Methods:
eth_getBalance
,eth_getTransactionCount
,eth_getCode
- Block Methods:
eth_blockNumber
,eth_getBlockByNumber
,eth_getBlockByHash
- Transaction Methods:
eth_sendRawTransaction
,eth_getTransactionReceipt
- Contract Methods:
eth_call
,eth_estimateGas
,eth_getLogs
- Gas Methods:
eth_gasPrice
,eth_feeHistory
,eth_maxPriorityFeePerGas
- Network Methods:
eth_chainId
,net_version
Layer 2 Specific Methods
- L1 to L2 Messages: Track cross-layer transactions
- L2 to L1 Withdrawals: Monitor withdrawal status
- Gas Estimation: Optimized for L2 fee structure
Code Examples
JavaScript/TypeScript
// Using ethers.js with Base
import { ethers } from 'ethers';
const provider = new ethers.JsonRpcProvider('https://api.blockeden.xyz/base/<your-api-key>');
// Get latest block
const blockNumber = await provider.getBlockNumber();
console.log('Latest block:', blockNumber);
// Get account balance
const balance = await provider.getBalance('0x742D5Cc6bF2442E8C7c74c7b4Be6AB9d6f10f5B4');
console.log('Balance:', ethers.formatEther(balance), 'ETH');
// Get current gas price
const gasPrice = await provider.getFeeData();
console.log('Gas price:', ethers.formatUnits(gasPrice.gasPrice, 'gwei'), 'gwei');
// Deploy a contract to Base
const contractFactory = new ethers.ContractFactory(abi, bytecode, wallet);
const contract = await contractFactory.deploy({
gasLimit: 1000000,
// Base uses very low gas prices
gasPrice: ethers.parseUnits('0.001', 'gwei')
});
await contract.waitForDeployment();
console.log('Contract deployed to:', await contract.getAddress());
Python
import requests
from web3 import Web3
# Connect to Base
w3 = Web3(Web3.HTTPProvider('https://api.blockeden.xyz/base/<your-api-key>'))
# Check connection
print(f"Connected: {w3.is_connected()}")
print(f"Chain ID: {w3.eth.chain_id}")
print(f"Latest block: {w3.eth.block_number}")
# Get account balance
balance = w3.eth.get_balance('0x742D5Cc6bF2442E8C7c74c7b4Be6AB9d6f10f5B4')
print(f"Balance: {w3.from_wei(balance, 'ether')} ETH")
# Get gas price
gas_price = w3.eth.gas_price
print(f"Gas price: {w3.from_wei(gas_price, 'gwei')} gwei")
Go
package main
import (
"context"
"fmt"
"log"
"math/big"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/common"
)
func main() {
// Connect to Base
client, err := ethclient.Dial("https://api.blockeden.xyz/base/<your-api-key>")
if err != nil {
log.Fatal(err)
}
// Get latest block number
header, err := client.HeaderByNumber(context.Background(), nil)
if err != nil {
log.Fatal(err)
}
fmt.Printf("Latest block: %s\n", header.Number.String())
// Get account balance
account := common.HexToAddress("0x742D5Cc6bF2442E8C7c74c7b4Be6AB9d6f10f5B4")
balance, err := client.BalanceAt(context.Background(), account, nil)
if err != nil {
log.Fatal(err)
}
balanceInEth := new(big.Float)
balanceInEth.SetString(balance.String())
balanceInEth = balanceInEth.Quo(balanceInEth, big.NewFloat(1e18))
fmt.Printf("Balance: %f ETH\n", balanceInEth)
}
Authentication
All API requests require your API key in the URL path:
https://api.blockeden.xyz/base/<your-api-key>
Example:
https://api.blockeden.xyz/base/abc123def456/
Rate Limits
- Free Tier: 100 requests/second, 86,400 requests/day
- Pro Tier: 1,000 requests/second, 10M requests/day
- Enterprise: Custom limits based on your needs
Rate limit headers are included in responses:
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 99
X-RateLimit-Reset: 1640995200
Network Information
Mainnet
- Chain ID:
8453
- Native Token: ETH (18 decimals)
- Block Time: ~2 seconds
- Explorer: https://basescan.org
Testnet (Base Sepolia)
- Chain ID:
84532
- Native Token: ETH (18 decimals)
- Faucet: https://www.coinbase.com/faucets/base-ethereum-sepolia-faucet
Layer 2 Benefits
Ultra-Low Transaction Costs
// Example transaction costs on Base vs Ethereum
const estimateGas = async () => {
const gasLimit = await contract.estimateGas.transfer(recipient, amount);
const gasPrice = await provider.getFeeData();
// Base: typically 0.001-0.01 gwei
const baseCost = gasLimit * gasPrice.gasPrice;
console.log(`Transaction cost: ${ethers.formatEther(baseCost)} ETH`);
// Usually less than $0.01
};
Fast Finality
- Soft Finality: ~2 seconds on Base
- Hard Finality: ~7 days (L1 challenge period)
- Practical Finality: Immediate for most applications