Block Information
4.1 Get block by tag
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."Get <example-tag> block with detail"
str: A formatted string containing the block data.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!
from crypto_com_agent_client import Agent
agent = Agent.init(
llm_config={
"provider": "OpenAI",
"model": "gpt-4",
"provider-api-key": "sk-proj-example-key",
"temperature": "float-controlling-output-randomness",
"transfer-limit": -1, # -1 means no limit (unlimited), 0 disables transfers completely, any positive number (e.g. 5) allows exactly that transfer amount
},
blockchain_config={
"api-key": "your-crypto.com-developer-platform-api-key",
"private-key": "your-private-key",
"sso-wallet-url": "your-sso-wallet-url",
"timeout": "timeout-in-seconds-for-API-calls-default-20s")
},
)
response = agent.interact("Get lastest block with detail")
print(response)
Last updated
Was this helpful?