Gauss Docs
  • 🌐Getting Started
    • Welcome to Gauss
    • Whitepaper
      • Blockchain Providers Need to Do Better
        • Solving a Lack of Token Adoption
          • An Evolving Space With Untapped Potential
        • Security & Reliability
          • Curation & Vetting
            • Important Note For Brands
        • Token Creation
      • WHY BUILD WITH GAUSS?
      • Use Cases
        • Use Cases (Chart)
      • Roadmap
      • Technical Background and Blockchain Development
        • Why Another Blockchain?
        • Gauss 1.0: Built With Efficiency and a Strong Infrastructure to Launch Rapidly
        • Gauss 2.0: Added Functionality For a Better User Experiance
          • Noble Swap 2.0
          • NFTs in Gauss 2.0
          • Token Development Kit (TDK)
          • Gaming DAO
          • Omnipool
      • Token Economics
        • Gang Token Economics: Designed to Ensure Trust and Transparency
        • Token Locking Schedule
        • Reflections: Rewarding the Gauss Community
        • Charitable Allocations: Grants, Scholarships, & Financial Assistance
      • The Gauss Team
      • Important Definitions
      • DISCLAIMER
        • PURCHASER WARNING
        • PROMINENT STATEMENTS
        • FUTURE STATEMENTS
        • VALUE RISKS
        • NOT A SECURITY
    • How To Connect
      • Create Metamask Wallet
    • Links
  • ⚡Launching with Gauss
    • Benefits of Building with Gauss
      • Fostering an Environment for Success
      • Gauss Growth Grant Program
      • Gauss Liquidity Program
      • Ecosystem Integrity Fund
      • Client Referral Program
    • A Guide to Curation
      • Core Principles and Curation Guidelines
      • Curation Stages and Processing Fees
    • Building on Gauss
  • 🖥️Gauss Ecosystem
    • Gauss Chain
      • Polygon-Edge Overview
      • Architecture
      • Consensus
      • Client Modules
        • Blockchain
        • Minimal
        • Networking
        • State
        • TxPool
        • JSON RPC
        • Consensus
        • Storage
        • Types
        • Syncer
        • Sealer
        • Other Modules
      • Polygon-Edge Performance Reports
      • For Developers
        • Operate a Node
          • Local Install
          • Genesis Contract
          • Server Config
          • CLI Commands
          • Key Management
        • Run a Validator
          • Validator FAQ
        • Smart Contract Deployment Permissioning
        • Deploying Contracts
          • Remix
          • Truffle
          • Hardhat
          • Replit
    • Gauss Explorer
      • Features
      • Navigating the Explorer
        • Menus
        • Blocks
        • Transactions
      • Verifying a Smart Contract
        • Hardhat Plugin
        • Sourcify Plugin
        • OpenZeppelin Plugin
      • Interacting With Smart Contracts
      • Exporting Transactions
      • FAQ
      • For Developers
        • Gauss Explorer Dependencies
        • Deployment Guide
          • Smart Contract Verification
          • Cleaning an instance from the previous deployment
          • ENV Variables
          • Testing
        • APIs
          • Requests & Limits
          • GraphQL
          • ETH RPC
    • Noble Swap
      • Liquidity Boost Program
    • Tokens
    • Gauss NFTs
      • Ferro Cards
      • F.E.R.R.E.T. NFTs
    • Contests & Giveaways
    • Gauss Faucet
      • For Developers
    • Address List
  • 💡Additional Resources
    • Partnerships & Affiliates
    • Discord Channel
    • Contact Us
    • Learning Materials
      • Web3 Glossary
    • Media Kit
Powered by GitBook
On this page
  • eth_blockNumber
  • eth_getBalance
  • eth_getLogs
  1. Gauss Ecosystem
  2. Gauss Explorer
  3. For Developers
  4. APIs

ETH RPC

PreviousGraphQLNextNoble Swap

Last updated 2 years ago

The Blockscout ETH RPC API supports 3 methods in the exact format specified for Ethereum nodes, see the for more details. These methods are provided for your convenience. In general, custom RPC methods are recommended.

The following 3 methods are supported:

  • eth_blockNumber

  • eth_getBalance

  • eth_getLogs

In the following examples we use the Ethereum mainnet with the base instance url https://blockscout.com/eth/mainnet. 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 hexidecimal 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://blockscout.com/eth/mainnet/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://blockscout.com/eth/mainnet/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://blockscout.com/eth/mainnet/api/eth-rpc

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 .

🖥️
Ethereum JSON-RPC Specification
post on eth_getLogs