{
    "jsonrpc": "2.0",
    "method": "eth_blockNumber",
    "params": [],
    "id": 67
}
{
  "jsonrpc": "2.0",
  "id": 67,
  "result": "0x484419"
}
With access to the RPC, you can interact with Shibarium and Puppynet networks and fetch relevant data to your needs, such as the latest block, gas price and other standard Ethereum JSON-RPC API functions. You can use all the standard Ethereum JSON-RPC API methods, such as eth_blockNumber to retrieve the network’s latest block.
Access to the RPC data requires authentication. Head to the Developer Portal to get your API Key.
Find a complete list of all possible functions on Ethereum’s documentation.

Base URLs

The RPC endpoints are available for both Shibarium mainnet and Puppynet testnet:
NetworkBase URLDescription
Shibariumhttps://api.shibrpc.com/shibarium/Mainnet production environment
Puppynethttps://api.shibrpc.com/puppynet/Testnet for development

Request Examples

curl -s "https://api.shibrpc.com/puppynet/{api_key}" \
 -H "Content-Type: application/json" \ 
 -X POST --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":67}'

Request Format

Endpoint

POST /{api_key}

Request Body

{
    "jsonrpc": "2.0",
    "method": "eth_blockNumber",
    "params": [],
    "id": 67
}

Body Parameters

jsonrpc
string
required
JSON-RPC specification version. Must be “2.0”.
method
string
required
Function to retrieve data from the network. Find more methods on Ethereum’s documentation.
params
array
required
Extra parameters required by the specific method. Can be empty array if no parameters are needed.
id
number
required
Unique identifier for the RPC call. Used to match responses with requests.

Header Parameters

Content-Type
string
required
Must be set to “application/json” for all requests.

Response Format

{
  "jsonrpc": "2.0",
  "id": 67,
  "result": "0x484419"
}

Response Fields

jsonrpc
string
required
JSON-RPC specification version. Always “2.0”.
id
number
required
The same ID that was sent in the request, used to match responses with requests.
result
any
required
The result of the RPC call. The format depends on the method called. For eth_blockNumber, this is the latest block number in hexadecimal format.
error
object
Error information if the request failed.

Common RPC Methods

Get Latest Block Number

{
    "jsonrpc": "2.0",
    "method": "eth_blockNumber",
    "params": [],
    "id": 1
}

Get Gas Price

{
    "jsonrpc": "2.0",
    "method": "eth_gasPrice",
    "params": [],
    "id": 2
}

Get Account Balance

{
    "jsonrpc": "2.0",
    "method": "eth_getBalance",
    "params": [
        "0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6",
        "latest"
    ],
    "id": 3
}

Get Block by Number

{
    "jsonrpc": "2.0",
    "method": "eth_getBlockByNumber",
    "params": [
        "0x484419",
        false
    ],
    "id": 4
}

Web3.js Integration

If you are building a frontend or backend project, you can use the web3.js library for easier integration:
import Web3 from 'web3';

// Initialize Web3 with Shibarium RPC
const web3 = new Web3('https://api.shibrpc.com/shibarium/{api_key}');

// Example: Get latest block
async function getLatestBlock() {
  try {
    const blockNumber = await web3.eth.getBlockNumber();
    console.log('Latest block:', blockNumber);
    
    const block = await web3.eth.getBlock(blockNumber);
    console.log('Block details:', block);
  } catch (error) {
    console.error('Error:', error);
  }
}

// Example: Get account balance
async function getBalance(address) {
  try {
    const balance = await web3.eth.getBalance(address);
    const balanceInEth = web3.utils.fromWei(balance, 'ether');
    console.log(`Balance of ${address}: ${balanceInEth} ETH`);
  } catch (error) {
    console.error('Error:', error);
  }
}

// Example: Send transaction
async function sendTransaction(fromAddress, toAddress, amount) {
  try {
    const transaction = {
      from: fromAddress,
      to: toAddress,
      value: web3.utils.toWei(amount, 'ether')
    };
    
    const gasEstimate = await web3.eth.estimateGas(transaction);
    transaction.gas = gasEstimate;
    
    // Note: You'll need to sign this transaction with a private key
    console.log('Transaction object:', transaction);
  } catch (error) {
    console.error('Error:', error);
  }
}

Error Handling

Best Practices

  • Always include proper error handling in your RPC calls
  • Use appropriate timeouts for network requests
  • Implement retry logic with exponential backoff
  • Cache frequently requested data when appropriate
  • Monitor your API usage and stay within rate limits
  • Use Web3.js or similar libraries for easier integration
  • Validate addresses and parameters before making requests
Never expose your API key in client-side code. Always make RPC calls from your backend server to keep your key secure.

Rate Limits

The RPC endpoints have rate limits to ensure fair usage. Monitor your request frequency and implement appropriate caching strategies for production applications.

Use Cases

DApp Development

Build decentralized applications that interact directly with the Shibarium blockchain.

Blockchain Explorers

Create custom blockchain explorers to display transaction and block information.

Analytics Platforms

Develop analytics tools to track blockchain metrics and trends.

Wallet Applications

Build wallet applications that can read blockchain state and send transactions.

Next Steps