The AI Agent SDK provides robust block operation capabilities, allowing developers to fetch blocks by tag (e.g., latest, pending) or by specific block number on Cronos Chains.
This feature makes it easy to retrieve detailed block information, enabling seamless integration of real-time blockchain data into your AI-powered applications.
4.1 Get block by tag
Retrieve block data for a specified tag using the Crypto.com developer platform.
Example Query
Query: "Get <example-tag> block with detail"
Example Response
The latest block data with details is as follows:
Block Number: <example-block-number>
Block Hash: <example-block-hash>
Parent Hash: <example-parent-hash>
Timestamp: <example-timestamp>
Transactions Root: <example-transaction-root>
Receipts Root: <example-receipts-root>
State Root: <example-state-root>
Gas Limit: <example-gas-limit>
Gas Used: <example-gas-used>
Miner: <example-miner>
Difficulty: <example-difficulty>
Total Difficulty: <example-total-difficulty>
Gas Price: <example-gas-price>
Base Fee Per Gas: <example-base-fee-per-gase>
Nonce: <example-nonce>
Transactions:
Transaction Hash: <example-transaction-hash>
From: <example-from>
To: <example-to>
Value: <example-value>
Gas: <example-gas>
Transaction Index: <example-transaction-index>
Max Fee Per Gas: <example-max-fee-per-gas>
Max Priority Fee Per Gas: <example-max-priority-fee-per-gas>
This block contains a single transaction and has not been mined by a specific miner. The details also indicate that the block has a gas limit of approximately <example-number> trillion and has utilized around <example-percentage> of that limit. If you need further information or specific details, please let me know!
Query Arguments
tag (str): Integer of a block number in hex, or the string "earliest", "latest"
or "pending".
tx_detail (str, optional): If "true", returns full transaction objects;
if "false", only transaction hashes.
Query Returns
str: A formatted string containing the block data.