Infura icon

Infura

Interact with blockchain APIs via Infura

Get Block

AI-generated

Overview

This node operation retrieves detailed information about a specific blockchain block using the Infura API. It supports fetching a block by its number or hash and can optionally include full transaction details within the block. This is useful for blockchain analysis, monitoring block data, or integrating blockchain data into applications.

Use Case Examples

  1. Retrieve the latest block details with basic transaction hashes.
  2. Fetch a specific block by its number and include full transaction details for in-depth analysis.

Properties

Name Meaning
Block Number The block number to retrieve, specified as a hexadecimal string or tags like 'latest', 'earliest', or 'pending'. Used to identify the block by number.
Block Hash The hash of the block to retrieve. Used to identify the block by its unique hash value.
Include Full Transactions Boolean flag indicating whether to include full transaction details in the block data. If false, only transaction hashes are included.

Output

JSON

  • blockNumberDecimal - Block number in decimal format.
  • timestampDate - Block timestamp as an ISO date string.
  • gasLimitDecimal - Gas limit of the block in decimal.
  • gasUsedDecimal - Gas used in the block in decimal.
  • sizeDecimal - Size of the block in decimal.
  • transactions - List of transactions or transaction hashes included in the block.

Dependencies

  • Infura API key credential with project ID and optional project secret for authentication.

Troubleshooting

  • Ensure the block number or hash is correctly formatted (hexadecimal or valid tags).
  • If 'Include Full Transactions' is true, the response may be large and slow; consider setting it to false for faster responses.
  • Common errors include invalid credentials, network issues, or invalid parameters. Verify API credentials and parameter values.

Links

Discussion