BlockchainBlockData(for Bitcoin)

$BlockchainBase = "Bitcoin"

BlockchainBlockData["hash"]

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

BlockchainBlockData[n]

gives information about block n on the Bitcoin blockchain.

BlockchainBlockData[-n]

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

BlockchainBlockData[bspec,prop]

gives the specified property of the block.

Details

  • BlockchainBlockData[-1] gives information on the latest Bitcoin block.
  • Properties include:
  • "BlockHash"hash of this block
    "BlockNumber"number (height) of this block in the Bitcoin blockchain
    "Timestamp"time when this block was mined
    "Amounts"amount information for this block
    "ByteCount"byte count for this block
    "Nonce"nonce used in the hash for this block
    "Version"version of the block
    "Confirmations"number of confirmations
    "PreviousBlockHash"hash of the previous block
    "MerkleRoot"Merkle root hash of the transactions
    "TotalTransactions"total number of transactions in this block
    "TransactionList"list of transaction IDs in this block
  • "Amounts" gives an association with the following properties as its keys:
  • "BlockReward"reward for mining this block
    "TotalFee"sum of all the fees in this block's transactions
    "TotalInput"sum of all the input amounts in this block's transactions
    "TotalOutput"sum of all the output amounts in this block's transactions
  • Possible options include:
  • BlockchainBase Automaticsets the blockchain and its network
    MaxItems Allthe maximum number of items to return
  • BlockchainBlockData can access the Bitcoin mainnet (default) and testnet. To specify these networks, use the BlockchainBase option.
  • The setting for MaxItems specifies the maximum number of transactions to include in the result.

Examples

open allclose all

Basic Examples  (6)

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

Get the latest block of the Bitcoin testnet blockchain:

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

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

Get a property from a Bitcoin block:

Get multiple properties from a Bitcoin block:

Scope  (12)

Amounts  (1)

Get information about the amounts associated with a Bitcoin block:

BlockHash  (1)

Get the block hash of a Bitcoin block:

BlockNumber  (1)

Get the height hash of a Bitcoin block:

ByteCount  (1)

Get the number of bytes of a Bitcoin block:

Confirmations  (1)

Get the number of confirmations of a Bitcoin block:

MerkleRoot  (1)

Get the Merkle root of a Bitcoin block:

Nonce  (1)

Get the nonce used in the hash of a Bitcoin block:

PreviousBlockHash  (1)

Get the block hash of the preceding Bitcoin block:

Timestamp  (1)

Get the time when a Bitcoin block was mined:

TotalTransactions  (1)

Get the total number of transactions included in a Bitcoin block:

TransactionList  (1)

Get the list of transactions included in a Bitcoin block:

Version  (1)

Get the version of a Bitcoin block:

Options  (3)

BlockchainBase  (2)

Mainnet  (1)

Get information from a random Bitcoin mainnet block:

Testnet  (1)

Get information from a random Bitcoin testnet block:

MaxItems  (1)

Get the first 5 transactions from the latest Bitcoin block:

Applications  (3)

Get the size of the latest Bitcoin block in megabytes:

Get a random transaction included in a Bitcoin block:

Get information about a block's miner:

Extract the coinbase transaction ID:

Get the miner's address:

Get information about the address:

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  (2)

Generate sounds from a Bitcoin block:

Get the input script of a coinbase transaction and decode it as ASCII characters:

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

Text

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

CMS

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

APA

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

BibTeX

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

BibLaTeX

@online{reference.wolfram_2024_blockchainblockdata, organization={Wolfram Research}, title={BlockchainBlockData}, year={2019}, url={https://reference.wolfram.com/language/ref/blockchain/BlockchainBlockData-Bitcoin.html}, note=[Accessed: 22-December-2024 ]}