WatchData Documentation
  • πŸ“–Welcome to WatchData Docs
    • 🧩Features
      • ⛓️Blockchain API
      • ⚑Powered API
      • πŸͺ™Price API
    • πŸ’ΌWhat products are suitable for our solutions
  • πŸ‘‹Introduction
    • πŸ› οΈQuick start guide to WatchData!
    • πŸ€”Why Use WatchData?
    • πŸ’‘Supported chains
    • πŸ›‘Error Reference
    • πŸ—οΈChange Log (update)
  • πŸ’ŽPowered API
    • πŸ”€Transfers
      • watch_getTransfers
      • watch_getTransfersByAddress
    • πŸ’ Parity
      • parity_getBlockReceipts
    • πŸŒ€Trace
      • trace_transaction
      • trace_block
    • ⏹️Blocks
      • watch_getBlockNumberByTimestamp
    • *️⃣Token API
      • watch_getTokenBalances
      • πŸ†•watch_getTokenMetadata
    • πŸ†’Stats
      • watch_getStatsByDay
  • πŸ•ΈοΈBlockchain API's
    • Ethereum API
      • eth_getBlockByHash
      • eth_getBlockByNumber
      • eth_getTransactionCount
      • eth_getTransactionByHash
      • eth_getTransactionReceipt
      • eth_getBlockTransactionCountByHash
      • eth_getBlockTransactionCountByNumber
      • eth_getTransactionByBlockHashAndIndex
      • eth_getTransactionByBlockNumberAndIndex
      • eth_getUncleCountByBlockHash
      • eth_getUncleCountByBlockNumber
      • eth_getLogs
      • eth_call
      • eth_chainId
      • eth_estimateGas
      • eth_gasPrice
      • eth_getBalance
      • eth_getCode
      • net_version
      • eth_getStorageAt
      • eth_sendRawTransaction
      • eth_blockNumber
    • ♨️Polygon API
      • eth_blockNumber - Polygon
      • eth_getBlockByHash - Polygon
      • eth_getBlockByNumber - Polygon
      • eth_getTransactionByHash - Polygon
      • eth_getTransactionCount - Polygon
      • eth_getTransactionReceipt -Polygon
      • eth_getBlockTransactionCountByHash - Polygon
      • eth_getBlockTransactionCountByNumber - Polygon
      • eth_getTransactionByBlockHashAndIndex - Polygon
      • eth_getTransactionByBlockNumberAndIndex - Polygon
      • eth_getUncleCountByBlockHash - Polygon
      • eth_getUncleCountByBlockNumber - Polygon
      • eth_getLogs - Polygon
      • eth_call - Polygon
      • eth_chainId - Polygon
      • eth_estimateGas - Polygon
      • eth_gasPrice - Polygon
      • eth_getBalance - Polygon
      • eth_getCode - Polygon
      • net_version - Polygon
      • eth_getStorageAt - Polygon
      • eth_sendRawTransaction - Polygon
    • Binance Smart Chain API
      • eth_blockNumber (BSC)
      • eth_getBlockByHash (BSC)
      • eth_getBlockByNumber (BSC)
      • eth_getTransactionCount (BSC)
      • eth_getTransactionByHash (BSC)
      • eth_getTransactionReceipt (BSC)
      • eth_getBlockTransactionCountByHash (BSC)
      • eth_getBlockTransactionCountByNumber (BSC)
      • eth_getTransactionByBlockHashAndIndex (BSC)
      • eth_getTransactionByBlockNumberAndIndex (BSC)
      • eth_getUncleCountByBlockHash (BSC)
      • eth_getUncleCountByBlockNumber (BSC)
      • eth_getLogs (BSC)
      • eth_call (BSC)
      • eth_chainId (BSC)
      • eth_estimateGas (BSC)
      • eth_gasPrice (BSC)
      • eth_getBalance (BSC)
      • eth_getCode (BSC)
      • net_version (BSC)
      • eth_getStorageAt (BSC)
      • eth_sendRawTransaction (BSC)
    • Tron API
      • Full Node API Overview
      • Address Utilities
        • CreateAddress
        • GenerateAddress
        • ValidateAddress
      • Transactions
        • CreateTransaction
        • EasyTransferByPrivate
        • EasyTransfer
        • BroadcastHex
        • BroadcastTransaction
      • Accounts
        • AccountPermissionUpdate
        • UpdateAccount
        • GetAccount
        • CreateAccount
      • Account Resources
        • GetAccountNet
        • GetAccountResource
        • UnfreezeBalance
        • FreezeBalance
        • GetDelegatedResource
        • GetDelegatedResourceAccountIndex
      • Query The Network
        • GetBlockByNum
        • GetBlockById
        • GetBlockByLatestNum
        • GetBlockByLimitNext
        • GetNowBlock
        • GetTransactionById
        • GetTransactionInfoById
        • GetTransactionInfoByBlockNum
        • GetNodeInfo
        • GetChainParameters
      • TRC 10 Token
        • GetAssetIssueByAccount
        • GetAssetIssueById
        • GetAssetIssueList
        • GetPaginatedAssetIssueList
        • TransferAsset
        • CreateAssetIssue
        • ParticipateAssetIssue
        • UnfreezeAsset
        • UpdateAsset
        • EasyTransferAsset
        • EasyTransferAssetByPrivate
      • Smart Contracts
        • GetContract
        • TriggerSmartContract
        • TriggerConstantContract
        • DeployContract
        • UpdateSetting
        • UpdateEnergyLimit
        • ClearAbi
      • TRONZ Shielded Smart Contract
        • GetSpendingKey
        • GetExpandedSpendingKey
        • GetAkFromAsk
        • GetNkFromNsk
        • GetIncomingViewingKey
        • GetDiversifier
        • GetZenPaymentAddress
        • GetNewShieldedAddress
        • CreateShieldedContractParameters
        • CreateSpendAuthSig
        • GetTriggerInputForShieldedTrc20Contract
        • ScanShieldedTrc20NotesByIvk
        • ScanShieldedTrc20NotesByOvk
        • IsShieldedTrc20ContractNoteSpent
      • Voting & SRs
        • ListWitnesses
        • CreateWitness
        • UpdateWitness
        • GetBrokerage
        • UpdateBrokerage
        • VoteWitnessAccount
        • GetReward
        • WithdrawBalance
        • GetNextMaintenanceTime
      • Proposals
        • ListProposals
        • GetProposalById
        • ProposalCreate
        • ProposalApprove
        • ProposalDelete
      • DEX Exchange
        • ListExchanges
        • GetExchangeById
        • ExchangeCreate
        • ExchangeInject
        • ExchangeWithdraw
        • ExchangeTransaction
      • Pending Pool
        • GetTransactionListFromPending
        • GetTransactionFromPending
        • GetPendingSize
    • Bitcoin API
      • Blockchain RPCs
        • getbestblockhash
        • getblock
        • getblockchaininfo
        • getblockcount
        • getblockhash
        • getblockheader
        • getblockstats
        • getchaintips
        • getchaintxstats
        • getdifficulty
        • getmempoolancestors
        • getmempooldescendants
        • getmempoolentry
        • getmempoolinfo
        • getrawmempool
        • gettxout
        • gettxoutproof
      • Rawtransactions RPCs
        • analyzepsbt
        • combinepsbt
        • combinerawtransaction
        • converttopsbt
        • createpsbt
        • createrawtransaction
        • decodepsbt
        • decoderawtransaction
        • decodescript
        • finalizepsbt
        • fundrawtransaction
        • getrawtransaction
        • joinpsbts
        • sendrawtransaction
        • testmempoolaccept
        • utxoupdatepsbt
  • πŸͺ™Price API
    • Price API
      • All tickers
      • Current price
  • ⛓️Web3
    • Web3 SDK
      • Web3.js
      • Web3.py
      • Ethers.js
      • Ethereum.rb
  • πŸ—ΊοΈTutorials and Guides
    • How to guides
      • How Getting Ethereum Account Balance and Transactions
      • How do I add WatchData to MetaMask?
      • How can i Get stats by Day
      • How to get the balance of an ERC-20 token
      • How can i get transfers using watch_getTransfersByAddress?
    • WatchData PriceΒ API and how it works?
    • How eth_getLogs works?
  • πŸ—ƒοΈResources
    • Pricing and Limits
      • Watch Units
    • FAQ
      • General
      • Pricing
      • Privacy
    • Support
    • Community
Powered by GitBook
On this page
  1. Blockchain API's
  2. Polygon API

eth_getBlockByHash - Polygon

Returns information about a block by hash.

Parameters

  • DATA, 32 Bytes - Hash of a block.

  • Boolean - If true it returns the full transaction objects, if false it returns only the hashes of the transactions.

params: [
    '0x8d9120cedf65b970b951c4b7a67c20075f32359bf19e310ecd1118d11a12bc69',
    true
]

Returns

Object - A block object with the following fields, or null when no block was found:

  • number: QUANTITY - the block number. null when its pending block.

  • hash: DATA, 32 Bytes - hash of the block. null when its pending block.

  • parentHash: DATA, 32 Bytes - hash of the parent block.

  • nonce: DATA, 8 Bytes - hash of the generated proof-of-work. null when its pending block.

  • sha3Uncles: DATA, 32 Bytes - SHA3 of the uncles data in the block.

  • logsBloom: DATA, 256 Bytes - the bloom filter for the logs of the block. null when its pending block.

  • transactionsRoot: DATA, 32 Bytes - the root of the transaction trie of the block.

  • stateRoot: DATA, 32 Bytes - the root of the final state trie of the block.

  • receiptsRoot: DATA, 32 Bytes - the root of the receipts trie of the block.

  • miner: DATA, 20 Bytes - the address of the beneficiary to whom the mining rewards were given.

  • difficulty: QUANTITY - integer of the difficulty for this block.

  • totalDifficulty: QUANTITY - integer of the total difficulty of the chain until this block.

  • extraData: DATA - the "extra data" field of this block.

  • size: QUANTITY - integer the size of this block in bytes.

  • gasLimit: QUANTITY - the maximum gas allowed in this block.

  • gasUsed: QUANTITY - the total used gas by all transactions in this block.

  • timestamp: QUANTITY - the unix timestamp for when the block was collated.

  • transactions: Array - Array of transaction objects, or 32 Bytes transaction hashes depending on the last given parameter.

  • uncles: Array - Array of uncle hashes.

Request example

curl https://polygon.api.watchdata.io/node/jsonrpc?api_key=your_api_key
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_getBlockByHash","params":["0x8d9120cedf65b970b951c4b7a67c20075f32359bf19e310ecd1118d11a12bc69", true],"id":0}'
URL: https://polygon.api.watchdata.io/node/jsonrpc?api_key=your_api_key
RequestType: POST
Body: 
{
    "jsonrpc":"2.0",
    "method":"eth_getBlockByHash",
    "params":["0x8d9120cedf65b970b951c4b7a67c20075f32359bf19e310ecd1118d11a12bc69", true],
    "id":0
}

Result

{
    "jsonrpc": "2.0",
    "id": 0,
    "result": {
        "number": "0x1d763ed",
        "hash": "0x8d9120cedf65b970b951c4b7a67c20075f32359bf19e310ecd1118d11a12bc69",
        "parentHash": "0xf83ad5151f15afab92eafd54674a91484bb99e3e2b08f996f8c94440ab346541",
        "nonce": "0x0000000000000000",
        "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
        "logsBloom": "0x0910839d381643800481512280e8022c182103c0000850806c057c216380b7007219181acd10e044a441091904200a01e0068e585a362408a443331009ae21c2281ca92c02002009140f108990e90ddb925a306e0904e0085003741100112542ba0082743b62a8c44a012a2b00c08cc0b00d300103d078c8a568423443384e1910145494d89d5c4e084846b10cd220c0003117acc2014325c8586402062a5372320b0a32717682201a800e023ba8004111064090620229023d182806014030407a03c0039e4258ee0d0187cb2216c009405184e1862a808f1d5883581c90e0a6001029ec19212dfdc421603469622920faa80c0b040644850662282460f0700e",
        "transactionsRoot": "0xbc3f787fa03e2b3af644521d20cec04d867685519f7bf2f5c740d2cb5794432c",
        "stateRoot": "0x71646d6cb789c95362eca6eaee7811a6e33207a80f16b65a217a8e52716c9303",
        "receiptsRoot": "0x4c002bc814f434bb6444d540fb4144172fb97cbc97733dc9562031a305dae6f1",
        "miner": "0x0000000000000000000000000000000000000000",
        "difficulty": "0x14",
        "totalDifficulty": "0x1ac4d50f",
        "extraData": "0xd682021083626f7288676f312e31382e33856c696e7578000000000000000000448d1ee49a9f16d8b56744e1d32d4c263ebb6e85620823845be5a3ada1e9ceb5410877b76c0ebd63ad922d6550e2280441a5a666f3aa1dcc4a42c2fe2a2b9d2700",
        "size": "0xa14c",
        "gasLimit": "0x1c9c380",
        "gasUsed": "0x81ff1c",
        "timestamp": "0x62d67b7d",
        "uncles": [],
        "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "transactions": [
            {
                "hash": "0x92bb0c20f3d256978eda3f75c369497c1a058351581cda26e5df3a96fdcfe15b",
                "nonce": "0x265df2",
                "transactionIndex": "0x0",
                "from": "0x4f27769c38169e402ffbb38b19f2606be60fdf97",
                "to": "0x7abba724a26d23aaca42d9b65cb4c35bbff1f577",
                "value": "0x0",
                "gasPrice": "0x45d964b800",
                "gas": "0x3d0900",
                "input": "0xb5cdffa8000000000000000000000000a34ab23406a237eec17af4d1496bfaadd2f48efd0000000000000000000000000000000000000000000000000000000000b7782f000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000018215cdb4f800000000000000000000000000000000000000000000000000000000000000034e465400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000013323032322d30372d31395430393a33323a353900000000000000000000000000",
                "v": "0x136",
                "r": "0x5b2fd90ee53860af8e159e0bf14033d91ab6599948c4ca70ed31a41764d71c35",
                "s": "0x69333f5c60a3a9f7f040279f75fddb2a2b81803866d00c8072dc90a5334eaf01",
                "chainId": null,
                "blockHash": "0x8d9120cedf65b970b951c4b7a67c20075f32359bf19e310ecd1118d11a12bc69",
                "blockNumber": "0x1d763ed"
            }
        ]
    }
}
Previouseth_blockNumber - PolygonNexteth_getBlockByNumber - Polygon

Last updated 2 years ago

πŸ•ΈοΈ
♨️