Retrieves information on a block and its transactions

get_block_info(latest = TRUE, block_number = NULL, max_attempts = 3L)

Arguments

latest

(boolean): indicator of whether the latest block's information should be retrieved (TRUE by default).

block_number

(character): number of the block to retrieve the information for (NULL by default). If latest = TRUE, this argument is ignored.

max_attempts

(integer, positive): specifies the maximum number of additional attempts to call a URL if the first attempt fails (i.e. its call status is different from 200). Additional attempts are implemented with an exponential backoff. Defaults to 3.

Value

A nested tibble with the following columns:

  • block_number (integer): number of the block;

  • timestamp (POSIXct): date and time when the block was created;

  • hash (character): hash ID of the block;

  • parent_hash (character): hash ID of the parent block;

  • tx_trie_root (character): hash ID of the trie root of the block creation transaction;

  • confirmed (boolean): an indicator of whether this block has been confirmed;

  • size (integer): size of the block (in bytes);

  • witness_address (character): address of the block's creator;

  • tx_count (integer): number of transactions associated with this block;

  • tx (list): a list with one element that contains a tibble with basic info on transactions associated with this block: tx_id (character) - transaction ID, contract_type (character) - type of the contract that performed this transaction, from_address (character) - address of the account that initiated the transaction, and to_address (character) - address of the recieving account. All addresses are presented in the base58check format.

Details

Additional details on the block producing process can be found in the official documentation.

Examples

# latest block r1 <- get_block_info(latest = TRUE)
#>
#> - Fetching data... Elapsed time: 00:00:00
#>
#> \ Fetching data... Elapsed time: 00:00:00
#>
#> | Fetching data... Elapsed time: 00:00:00
print(r1)
#> # A tibble: 1 x 11 #> request_time block_number timestamp hash parent_hash #> <dttm> <chr> <dttm> <chr> <chr> #> 1 2021-07-12 22:03:51 31884267 2021-07-12 22:02:45 000000000… 0000000001e68… #> # … with 6 more variables: tx_trie_root <chr>, confirmed <lgl>, size <int>, #> # witness_address <chr>, tx_count <int>, tx <list>
# specific block: r2 <- get_block_info(latest = FALSE, block_number = "26810333")
#>
#> - Fetching data... Elapsed time: 00:00:00
#>
#> \ Fetching data... Elapsed time: 00:00:00
#>
#> | Fetching data... Elapsed time: 00:00:01
print(r2)
#> # A tibble: 1 x 11 #> request_time block_number timestamp hash parent_hash #> <dttm> <chr> <dttm> <chr> <chr> #> 1 2021-07-12 22:03:52 26810333 2021-01-16 15:15:03 000000000… 0000000001991… #> # … with 6 more variables: tx_trie_root <chr>, confirmed <lgl>, size <int>, #> # witness_address <chr>, tx_count <int>, tx <list>