APIs & SDKs Overview
Circle Layer provides comprehensive APIs and SDKs for seamless blockchain integration. This section covers all the endpoints, libraries, and tools you need for development.
π§ Available APIsβ
JSON-RPC APIβ
- Endpoint:
https://testnet-rpc.circlelayer.com
- Compatibility: Full Ethereum JSON-RPC compatibility
- Use Cases: Transaction submission, contract deployment, balance queries, block data
WebSocket APIβ
- Endpoint:
wss://testnet-rpc.circlelayer.com
- Purpose: Real-time blockchain events and subscriptions
- Features: Block subscriptions, transaction notifications, contract events
- Use Cases: Live updates, event monitoring, real-time dApp features
GraphQL APIβ
- Endpoint:
https://testnet.circlelayer.com/graphiql
- Purpose: Flexible, efficient data queries with filtering capabilities
- Status: Available for testing with enhanced querying and indexing
π Supported Web3 Librariesβ
Circle Layer works seamlessly with all popular Ethereum libraries:
Web3.jsβ
const Web3 = require('web3');
const web3 = new Web3('https://testnet-rpc.circlelayer.com');
// Standard Ethereum methods work identically
const balance = await web3.eth.getBalance(address);
const gasPrice = await web3.eth.getGasPrice();
Ethers.jsβ
const { ethers } = require('ethers');
const provider = new ethers.providers.JsonRpcProvider('https://testnet-rpc.circlelayer.com');
// Same patterns as Ethereum development
const wallet = new ethers.Wallet(privateKey, provider);
const contract = new ethers.Contract(address, abi, wallet);
Viemβ
import { createPublicClient, http } from 'viem';
const client = createPublicClient({
transport: http('https://testnet-rpc.circlelayer.com')
});
// Modern TypeScript-first Web3 library support
π οΈ Development Environment Integrationβ
Smart Contract Developmentβ
- Hardhat: Full development environment with Circle Layer network configuration
- Truffle: Complete framework support with CLAYER gas configuration
- Remix: Browser-based IDE with injected provider support
- Foundry: Rust-based toolkit for advanced smart contract development
Frontend Frameworksβ
- React: Complete integration examples with Web3 hooks
- Vue.js: Component libraries and reactive Web3 integration
- Angular: Service-based Web3 integration patterns
- Next.js: Server-side rendering with Web3 provider handling
π API Reference Categoriesβ
- RPC Endpoints - Complete JSON-RPC API documentation
- Web3 Libraries - Integration examples and configurations
- Smart Contract Development - Contract deployment guides
- Web3 Integration - Frontend integration patterns
π API Status & Availabilityβ
Service | Status | Documentation | Rate Limits |
---|---|---|---|
JSON-RPC API | π’ Live | Complete | Standard Ethereum limits |
WebSocket API | π’ Live | Complete | 100 connections/IP |
Block Explorer API | π’ Live | Available | 1000 requests/hour |
GraphQL API | π’ Live | Available | 1000 requests/hour |
π API Security & Best Practicesβ
Rate Limitingβ
- JSON-RPC: Standard Ethereum rate limits apply
- WebSocket: Maximum 100 concurrent connections per IP
- Public Endpoints: Fair usage policy enforced
Error Handlingβ
// Proper error handling example
try {
const result = await web3.eth.sendTransaction(txParams);
console.log('Transaction sent:', result.transactionHash);
} catch (error) {
if (error.code === -32603) {
console.error('Internal error:', error.message);
} else if (error.code === -32000) {
console.error('Transaction failed:', error.message);
}
}
Network Resilienceβ
// Multiple endpoint configuration for redundancy
const providers = [
'https://testnet-rpc.circlelayer.com',
// Additional endpoints can be added for failover
];
const provider = new ethers.providers.FallbackProvider(
providers.map(url => new ethers.providers.JsonRpcProvider(url))
);
π Getting Started Quick Guideβ
1. Basic Setupβ
# Install required dependencies
npm install web3 ethers
# or
npm install @wagmi/core viem
2. Network Configurationβ
// Basic provider setup
const provider = new ethers.providers.JsonRpcProvider('https://testnet-rpc.circlelayer.com');
// Or with Web3.js
const web3 = new Web3('https://testnet-rpc.circlelayer.com');
3. Contract Interactionβ
// Deploy or interact with contracts
const contract = new ethers.Contract(contractAddress, abi, provider);
const result = await contract.someMethod();
π Developer Supportβ
Documentation Resourcesβ
- π Complete API reference documentation
- π¬ Community support via Telegram
- π Issue tracking on GitHub
- π§ Direct developer support available
Integration Examplesβ
- React dApp: Complete React integration example
- Smart Contracts: Contract development guide
- Wallet Connection: MetaMask and WalletConnect setup
Next Stepsβ
Ready to start building? Check out our development guides:
- RPC API Documentation - Complete endpoint reference
- Web3 Integration Examples - Library-specific guides
- Smart Contract Development - Contract deployment
- Frontend Integration - dApp development patterns