BlockchainBlockData(for Ethereum)

$BlockchainBase = "Ethereum"

BlockchainBlockData["hash"]

gives information about the block with the specified hash on the Ethereum blockchain.

BlockchainBlockData[n]

gives information about block n on the Ethereum blockchain.

BlockchainBlockData[-n]

gives information about the block n elements from the end of the Ethereum blockchain.

BlockchainBlockData[bspec,prop]

gives the specified property of the block.

Details

  • BlockchainBlockData[-1] gives information on the latest Ethereum block.
  • Properties include:
  • "BlockHash"hash of this block
    "BlockNumber"number (height) of this block in the Ethereum blockchain
    "Status"finality status of this block
    "Timestamp"time when this block was mined
    "Size"size of this block in bytes
    "Nonce"nonce used in the hash for this block
    "Confirmations"number of confirmations
    "ConsensusData"information from Ethereum's consensus mechanism
    "PreviousBlockHash"hash of the previous block
    "MerkleRoot"Merkle root hash of the transactions
    "FeeRecipient"address that receives the transaction fees of this block
    "GasUsed"amount of gas used in this block
    "GasLimit"maximum gas allowed in this block
    "BaseFeePerGas"base fee value per unit of gas
    "BurntFees"amount of fees burnt in this block
    "TotalTransactions"total number of transactions in this block
    "TransactionList"list of transaction IDs in this block
  • "Status" property has the following values:
  • "Unfinalized"block has been recently added to the blockchain
    "Safe"block received votes from two thirds of the validators
    "Finalized"block cannot be reverted outside of manual intervention
  • "ConsensusData" gives an association with the following properties as its keys:
  • "Slot"slot when this block was proposed
    "Epoch"32-slot period when this block was proposed
    "ProposerIndex"index of the validator that proposed this block
    "SlotRootHash"hash tree root of the slot in the consensus layer
    "DepositCount"number of successful deposits from validators
    "Graffiti"arbitrary data used by the validator to tag this block
    "BlockRandomness"value used for validator selection
    "RandaoReveal"one of the values used to select the next block proposer
  • Possible options include:
  • BlockchainBase Automaticsets the blockchain and its network
    MaxItems Allthe maximum number of items to return
  • BlockchainBlockData can access the Ethereum mainnet (default) and testnet (goerli). To specify these networks, use the BlockchainBase option.
  • The setting for MaxItems specifies the maximum number of transactions to include in the result.
  • "BaseFeePerGas" and "BurntFees" information is only available for blocks created after Ethereum's London hard fork upgrade on block 12965000 on mainnet and block 5062605 on testnet.
  • Consensus information is only available after Ethereum's transition to proof-of-stake on block 15537394 on mainnet and block 7382819 on testnet.

Examples

open allclose all

Basic Examples  (6)

Get information about a block from the Ethereum blockchain using its height:

Get the latest block of the Ethereum testnet blockchain:

Use a block hash to get information about a Ethereum block:

Get multiple Ethereum blocks by providing a list of heights or block hashes:

Get a property from an Ethereum block:

Get multiple properties from an Ethereum block:

Scope  (17)

BaseFeePerGas  (1)

Get the base fee per unit of gas of an Ethereum block:

BlockHash  (1)

Get the block hash of an Ethereum block:

BlockNumber  (1)

Get the height hash of an Ethereum block:

BurntFees  (1)

Get the amount of fees burnt in an Ethereum block:

Confirmations  (1)

Get the number of confirmations of an Ethereum block:

ConsensusData  (1)

Get information about the consensus mechanisms associated with an Ethereum block:

FeeRecipient  (1)

Get the fee recipient of an Ethereum block:

GasLimit  (1)

Get the gas limit of an Ethereum block:

GasUsed  (1)

Get the gas used in an Ethereum block:

MerkleRoot  (1)

Get the Merkle root of an Ethereum block:

Nonce  (1)

Get the nonce used in the hash of an Ethereum block:

PreviousBlockHash  (1)

Get the block hash of the preceding Ethereum block:

Size  (1)

Get the status of an Ethereum block:

Status  (1)

Get the finality status of an Ethereum block:

Timestamp  (1)

Get the time when an Ethereum block was mined:

TotalTransactions  (1)

Get the total number of transactions included in an Ethereum block:

TransactionList  (1)

Get the list of transactions included in an Ethereum block:

Options  (3)

BlockchainBase  (2)

Mainnet  (1)

Get information from a random Ethereum mainnet block:

Testnet  (1)

Get information from a random Ethereum testnet block:

MaxItems  (1)

Get the first 5 transactions from the latest Ethereum block:

Applications  (2)

Get the size of the latest Ethereum block in megabytes:

Get a random transaction included in an Ethereum block:

Possible Issues  (2)

Nonexistent Hashes  (1)

Using a block hash from one blockchain in another blockchain will return a Missing output:

Incorrect Hashes  (1)

Providing a block hash that is not a hex number will return a $Failed output:

Neat Examples  (1)

Generate sounds from an Ethereum block:

Wolfram Research (2019), BlockchainBlockData, Wolfram Language function, https://reference.wolfram.com/language/ref/blockchain/BlockchainBlockData-Ethereum.html.

Text

Wolfram Research (2019), BlockchainBlockData, Wolfram Language function, https://reference.wolfram.com/language/ref/blockchain/BlockchainBlockData-Ethereum.html.

CMS

Wolfram Language. 2019. "BlockchainBlockData." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/blockchain/BlockchainBlockData-Ethereum.html.

APA

Wolfram Language. (2019). BlockchainBlockData. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/blockchain/BlockchainBlockData-Ethereum.html

BibTeX

@misc{reference.wolfram_2023_blockchainblockdata, author="Wolfram Research", title="{BlockchainBlockData}", year="2019", howpublished="\url{https://reference.wolfram.com/language/ref/blockchain/BlockchainBlockData-Ethereum.html}", note=[Accessed: 29-March-2024 ]}

BibLaTeX

@online{reference.wolfram_2023_blockchainblockdata, organization={Wolfram Research}, title={BlockchainBlockData}, year={2019}, url={https://reference.wolfram.com/language/ref/blockchain/BlockchainBlockData-Ethereum.html}, note=[Accessed: 29-March-2024 ]}