Join AWS, Dust Labs & OrangeDAO at QuickPitch. Win $80k — Apply Today.

Contents

eth_getBlockTransactionCountByNumber RPC Method

The API credit value for this method is 2 . To learn more about API credits and each method's value, visit the API Credits page.

Parameters:

  1. blockNumber - string - The block number as a string in hexadecimal format or tags. The supported tag values include earliest for the earliest/genesis block, latest for the latest mined block, pending for the pending state/transactions, safe for the most recent secure block, and finalized for the most recent secure block accepted by more than 2/3 of validators. safe and finalized are only supported on Ethereum, Gnosis, Arbitrum, Arbitrum Nova, and Avalanche C-chain

Returns:

  1. result - The number of transactions in a specific block represented in hexadecimal format

Code Examples:

require "uri"
require "json"
require "net/http"

url = URI("http://sample-endpoint-name.network.quiknode.pro/token-goes-here/")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request.body = JSON.dump({
  "method": "eth_getBlockTransactionCountByNumber",
  "params": [
    "0xc5043f"
  ],
  "id": 1,
  "jsonrpc": "2.0"
})

response = https.request(request)
puts response.read_body
Ready to get started? Create a free account