Blockscout
SupportWebsiteGithubDiscord
  • Blockscout Open-Source Explorer
  • 💡About BlockScout
    • Features
      • Ethereum Bytecode Database Microservice
      • Blockscout Redesign
    • Chains Using Blockscout
    • Partners & Integrations
      • RaaS Providers
      • Vera: Verifier Alliance
        • Adding your chain to the Vera database
        • Programmatic verification via the API
    • News & Media
      • Newsletter & Blog
    • Funding
      • L2 Funding Proposal
        • Aux Funding Images
    • Roadmap
  • 🙎Using Blockscout
    • Getting Started
      • Glossary of Terms
      • Main Menu
      • Blocks
      • Transaction Types
      • Beacon Chain Withdrawal Views
    • My Account
      • Watch list
      • Private tags
      • Public tags
      • API keys
      • Custom ABI
      • Verified addresses
        • Copy and Sign Message
      • For developers
    • Dappscout Apps Marketplace
      • DApp Integration
    • Swapscout
      • Earn Merits when using Swapscout
    • Revokescout
    • Autoscout Explorer Launchpad
    • CSV Exports
    • Token Support
      • ERC-1155 Support
    • Merits
      • Streak rewards
      • Activity Pass
      • Leaderboard
      • Badges
      • FAQs
  • 👩‍💻Developer Support
    • For Web3 Developers
    • Link to Blockscout
    • Blockscout APIs
      • Requests & Limits
      • REST API Endpoints
        • Stats API
        • Interpreter API
      • JSON RPC & ETH Compatible RPC Endpoints
        • Account
        • Block
        • Contract
        • Logs
        • Stats
        • Token
        • Transaction
        • ETH RPC API
      • GraphQL in Blockscout
    • Smart Contract Verification
      • Blockscout UI
      • Blockscout smart-contract verification API
      • Hardhat Verification Plugin
        • Sourcify Plugin for Hardhat
      • Foundry Verification
      • Sourcify Verification
      • OpenZeppelin Contract Verification
      • Automate verifications with Catapulta
      • Verification via thirdweb
      • Interacting with Smart Contracts
    • Blockscout SDK
    • Integrate Merits
    • Chainscout chains list
  • 🏃‍♂️Setup and Run Blockscout
    • General Overview
      • Separate Indexer, Web App, and API
      • Umbrella Project Organization
      • Indexer Architecture Overview
      • ShareLock
      • EVM Version Information
    • Requirements
      • General Backend Requirements / Blockscout Backend Prerequisites
      • Backend/Frontend Compatibility Matrix
      • Hardware & Hosting Requirements
      • Database Storage Requirements
      • Client Setting Requirements
      • Node Tracing / JSON RPC Requirements
      • L2 -> L1 JSON-RPC Method Requests
    • ☑️ENV Variables
      • Backend ENVs: Common
      • Backend ENVs: Chain-Specific
      • Backend ENVs: Integrations
      • Frontend ENVs: Common
        • ENVs
        • Deprecated ENVs
      • Deprecated Backend ENVs
        • Previous ENV Variable Home Page
    • Deployment
      • ⭐Manual Deployment Guide
        • Ubuntu Setup
        • MacOS setup
      • ⭐Docker-compose Deployment
      • ⭐Kubernetes Deployment
      • Rollup Deployment
      • 🌟Cosmos-based chains
      • 🍀Upgrade Guide (v7.0 & v8.0)
      • Frontend Migration
        • All-In-One Container
        • Separate Frontend
        • Customized Backend
        • Proxy Setup
        • FAQs
      • Manual Deployment (backend + old UI)
        • Manual cleaning an instance from the previous deployment
      • Terraform Deployment
      • Ansible Deployment (AWS Cloud)
        • Overview
        • Prerequisites
        • AWS Permissions & Settings
          • Creating a Secret Key Pair
          • Login with AWS CLI
          • Creating an AWS certificate for SSL
          • Manually Cleaning Terraform Related Instances
        • Variables
        • Deploying the Blockscout Infrastructure
        • Deploying Blockscout
        • Destroying Provisioned Infrastructure
        • Common Additional Tasks
        • Common Errors and Questions
        • AWS Marketplace (deprecated)
          • Overview
          • CloudFormation Template
          • Prerequisites & Install Parameters
          • Install from AWS Marketplace
          • AWS EC2 archive node setup with OpenEthereum (formerly Parity)
          • Updating & Redeploying in AWS
          • Customizing CSS
    • Microservices
      • Blockscout ENS (BENS) Name Service Integration
      • Smart Contract Verification
    • Configuration Options
      • Admin Panel Usage
      • Automating Restarts
      • Branding Configs
      • Circle CI Updates
      • Charts and Stats
      • CSS Configuration & Presets
      • Exchange Rates
      • Front-end Config Files
      • haproxy Settings for Blockscout.com
      • Internationalization
      • Logger Configs
      • Memory Usage
      • Metrics
      • My Account Settings
      • Sorting and Pagination
      • Tracing
      • Reown Project ID for contract Read/Write
    • Indexing
      • How do I fix indexer timeouts?
      • How do I update memory consumption to fix indexer memory errors?
    • Testing
    • DB schema
  • FAQs
    • User FAQs
    • Developer FAQs
  • 🧩Resources
    • EaaS: Hosting with Blockscout
    • Contributing to Blockscout
    • Bug Bounty Program
    • Media kit
    • Release Notes
      • v5.3.0: 10/23/23
      • v5.2.0: 6/20/23
      • v5.1.0: 2/13/23
      • v5.0.0: 1/11/23
    • Discord Channel
    • Discussion
    • GitHub Repo
Powered by GitBook
LogoLogo

Privacy and Terms

  • Privacy Notice
  • Terms and Conditions

Copyright © Blockscout Limited 2023-2024

On this page
  • eth_blockNumber
  • eth_getBalance
  • eth_getLogs
  • More examples

Was this helpful?

Export as PDF
  1. Developer Support
  2. Blockscout APIs
  3. JSON RPC & ETH Compatible RPC Endpoints

ETH RPC API

Last updated 4 months ago

Was this helpful?

In addition to the custom , the Blockscout ETH RPC API supports most used methods in the exact format specified for Ethereum nodes, see the for more details.

These methods are provided for your convenience and are most suitable as a fallback option in your JSON RPC API providers. For other use cases, REST or custom RPC methods are recommended.

The following methods are supported:

  • eth_blockNumber

  • eth_getBalance

  • eth_getLogs

  • eth_gasPrice

  • eth_getTransactionByHash

  • eth_getTransactionReceipt

  • eth_chainId

  • eth_maxPriorityFeePerGas

  • eth_getTransactionCount

  • eth_getCode

  • eth_getStorageAt

  • eth_estimateGas

  • eth_getBlockByNumber

  • eth_getBlockByHash

  • eth_sendRawTransaction

  • eth_call

In the following examples we use the Ethereum mainnet with the base instance url https://eth.blockscout.com. When sending a request add /api/eth-rpc to the end of the base url.

eth_blockNumber

Returns the latest block number in the chain in hexadecimal format. No params are needed. Type: POST

Example

// Request
curl -H "content-type: application/json" -X POST --data '{"id":0,"jsonrpc":"2.0","method":"eth_blockNumber","params":[]}' https://eth.blockscout.com/api/eth-rpc
// Response
{
  "jsonrpc": "2.0",
  "result": "0xfa0b0e",
  "id": 0
}

eth_getBalance

Returns the balance of a given address in wei. Note the earliest parameter does not work as expected because genesis block balances are not currently imported. Parameters are required.

Required Parameters

Type

POST

Data (string)

20 Byte address to check balance

Quantity or Tag (string)

Integer value of a block number, or a tag "latest" for the most recent block.

Example

// Request
curl -H "content-type: application/json" -X POST --data '{"id":0,"jsonrpc":"2.0","method":"eth_getBalance","params":["0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045","latest"]}' https://eth.blockscout.com/api/eth-rpc
// Response
{
  "jsonrpc": "2.0",
  "result": "0x1d863bf76508104fb", //34039260923474019579
  "id": 0
}

eth_getLogs

Note: Never returns more than 1000 log entries. You can use pagination options to request the next page. Pagination options params: {"logIndex": "3D", "blockNumber": "6423AC"} which include parameters from the last log received from the previous request. These three parameters are required for pagination.

Parameters

Type

POST

address (string, array)

20Byte contract address or list of addresses to collect logs from.

fromBlock (Quantity/Tag)

Integer block number, "latest" (default) for the last mined block or "pending", "earliest" for not yet mined transactions.

toBlock (Quantity/Tag)

Integer block number, "latest" (default) for the last mined block or "pending", "earliest" for not yet mined transactions.

topics (string, array)

Array of 32 Byte DATA topics. Topics are order-dependent. Each topic can also be an array of DATA with "or" options

paging_options

logIndex and blockNumber explained above.

Example Query

//Request
curl -H "content-type: application/json" -X POST --data '{"id":0,"jsonrpc":"2.0","method":"eth_getLogs","params":[{"address":"0xc78Be425090Dbd437532594D12267C5934Cc6c6f","paging_options":{"logIndex":"3D","blockNumber":"6423AC"},"fromBlock":"earliest","toBlock":"latest","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]}]}' https://eth.blockscout.com/api/eth-rpc
//Response (end)
{"address":"0xc78be425090dbd437532594d12267c5934cc6c6f","blockHash":"0x574755e06bf0cec6d59a8cc7db183d4545a90242d03d5bc3806681277356cf4b","blockNumber":"0x79D4CF","data":"0x000000000000000000000000000000000000000000000c81c6f8fe7064224e6e","logIndex":"0x42","removed":false,"topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x00000000000000000000000078c04412a6eb2f524ccf50b5f3d863a82e2f8d6f"],"transactionHash":"0xd35fe29c81484258f38b4848a4d44f54f3dc0b9b3d10ad094b8cd5f3a4815e64","transactionIndex":"0x6D","type":"mined"},{"address":"0xc78be425090dbd437532594d12267c5934cc6c6f","blockHash":"0xcb58a082f58bea43dfb6be8addf97c915190175b9f0f0abc1e05bfd02573f010","blockNumber":"0x7BA949","data":"0x000000000000000000000000000000000000000000000c81c6272987dea5867a","logIndex":"0x38","removed":false,"topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000001082e1c4a9c9f946ba102667a14f206c0f81e147"],"transactionHash":"0xd12770e7a1dfa759f6a645981e4bd1d75d2ed131b52565e436bce90b5b39f137","transactionIndex":"0x89","type":"mined"}],"id":0}

More examples

Returns an array of logs matching a specified filter object. Params are optional based on data you want to receive. From more information, see this .

Refer to the for more examples and info on the remaining methods.

👩‍💻
RPC endpoints documented here
Ethereum JSON-RPC Specification
post on eth_getLogs
Ethereum JSON-RPC Specification