Taiko

Taiko

Quick Start Guide

This guide will help you quickly integrate TheRPC into your project. Follow these steps to start making blockchain API calls.

Step 1: Get an API Key

To use TheRPC, you'll need an API key:

  1. Sign up at TheRPC.io
  2. Navigate to the dashboard
  3. Create or retrieve your API key

Step 2: Choose Your Network

TheRPC supports multiple networks. Configure your environment with your API endpoint and key:

API_ENDPOINT="YOUR_API_ENDPOINT"
API_KEY="YOUR_API_KEY"

Step 3: Make Your First Call

Here are basic examples for different programming languages. For more comprehensive examples and language-specific features, check out our Tools & SDKs Overview.

Using Curl

curl --request POST ${API_ENDPOINT} \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer ${API_KEY}' \
--data '{
"jsonrpc": "2.0",
"method": "eth_blockNumber",
"params": [],
"id": 1
}'

Using JavaScript

const axios = require('axios');
const config = {
url: 'YOUR_API_ENDPOINT',
apiKey: 'YOUR_API_KEY',
};
async function getBlockNumber() {
const response = await axios.post(
config.url,
{
jsonrpc: '2.0',
method: 'eth_blockNumber',
params: [],
id: 1,
},
{
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${config.apiKey}`,
},
},
);
console.log('Latest Block Number:', response.data.result);
}

Using Python

import requests
config = {
'url': 'YOUR_API_ENDPOINT',
'api_key': 'YOUR_API_KEY'
}
def get_block_number():
response = requests.post(
config['url'],
headers={
'Content-Type': 'application/json',
'Authorization': f"Bearer {config['api_key']}"
},
json={
'jsonrpc': '2.0',
'method': 'eth_blockNumber',
'params': [],
'id': 1
}
)
return response.json()['result']

Step 4: Using Web3 Libraries

For more complex interactions, we recommend using Web3 libraries. You can find detailed examples for all supported languages and frameworks in our Tools & SDKs documentation.

Web3.js (JavaScript)

const Web3 = require('web3');
const web3 = new Web3('YOUR_API_ENDPOINT');
// Add API key to requests
web3.setHeader('Authorization', 'Bearer YOUR_API_KEY');
async function getBalance(address) {
const balance = await web3.eth.getBalance(address);
return web3.utils.fromWei(balance, 'ether');
}

Web3.py (Python)

from web3 import Web3
from web3.middleware import http_retry_request_middleware
w3 = Web3(Web3.HTTPProvider(
'YOUR_API_ENDPOINT',
request_kwargs={
'headers': {'Authorization': 'Bearer YOUR_API_KEY'}
}
))
# Add retry middleware
w3.middleware_onion.add(http_retry_request_middleware)

Available Methods

All supported API methods with examples in different programming languages can be found in our Ethereum Methods documentation. This includes:

  • Detailed method descriptions
  • Request and response formats
  • Language-specific code examples
  • Common use cases

Network Selection

When using TheRPC, you'll receive specific API endpoints for each network you want to access. Simply replace YOUR_API_ENDPOINT with the appropriate endpoint for your chosen network.

Next Steps

  1. Browse our Ethereum Methods documentation for all available API methods
  2. Check out Tools & SDKs for language-specific guides
  3. Learn about Authentication
  4. Review Rate Limits
  5. Explore Basic Operations

See also

Ready to call this in production?

Free tier covers personal projects. Pay-as-you-go scales without a card.