blocksPkg

package
v0.0.0-...-3f8eaf4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2024 License: GPL-3.0 Imports: 25 Imported by: 0

README

chifra blocks

The chifra blocks tool retrieves block data from your Ethereum node or, if previously cached, from the TrueBlocks cache. You may specify multiple blocks per invocation.

By default, chifra blocks queries the full transactional details of the block (including receipts). You may optionally retrieve only the transaction hashes in the block (which is significantly faster). Additionally, you may also use this tool to retrieve uncle blocks at a give height.

Another useful feature of chifra blocks is the ability to extract address appearances from a block. TrueBlocks uses a similar feature internally to build its index of appearances. This type of data is very insightful when studying end user behavior and chain-wide adoption analysis.

Purpose:
  Retrieve one or more blocks from the chain or local cache.

Usage:
  chifra blocks [flags] <block> [block...]

Arguments:
  blocks - a space-separated list of one or more block identifiers (required)

Flags:
  -e, --hashes            display only transaction hashes, default is to display full transaction detail
  -c, --uncles            display uncle blocks (if any) instead of the requested block
  -t, --traces            export the traces from the block as opposed to the block data
  -u, --uniq              display a list of uniq address appearances per transaction
  -f, --flow string       for the --uniq option only, export only from or to (including trace from or to)
                          One of [ from | to | reward ]
  -l, --logs              display only the logs found in the block(s)
  -m, --emitter strings   for the --logs option only, filter logs to show only those logs emitted by the given address(es)
  -B, --topic strings     for the --logs option only, filter logs to show only those with this topic(s)
  -i, --withdrawals       export the withdrawals from the block as opposed to the block data
  -a, --articulate        for the --logs option only, articulate the retrieved data if ABIs can be found
  -r, --big_range uint    for the --logs option only, allow for block ranges larger than 500 (default 500)
  -U, --count             display only the count of appearances for --addrs or --uniq
  -H, --ether             specify value in ether
  -w, --raw               report JSON data from the source with minimal processing
  -o, --cache             force the results of the query into the cache
  -D, --decache           removes related items from the cache
  -x, --fmt string        export format, one of [none|json*|txt|csv]
  -v, --verbose           enable verbose output
  -h, --help              display this help screen

Notes:
  - Blocks is a space-separated list of values, a start-end range, a special, or any combination.
  - Blocks may be specified as either numbers or hashes.
  - Special blocks are detailed under chifra when --list.
  - With the --logs option, optionally specify one or more --emitter, one or more --topics, either or both.
  - The --logs option is significantly faster if you provide an --emitter and/or a --topic.
  - Multiple topics match on topic0, topic1, and so on, not on different topic0's.
  - For the --logs option, large block ranges may crash the node, use --big_range to specify a larger range.
  - The --decache option removes the block(s), all transactions in those block(s), and all traces in those transactions from the cache.
  - The --withdrawals option is only available on certain chains. It is ignored otherwise.

Data models produced by this tool:

Other Options

All tools accept the following additional flags, although in some cases, they have no meaning.

  -v, --version         display the current version of the tool
      --output string   write the results to file 'fn' and return the filename
      --append          for --output command only append to instead of replace contents of file
      --file string     specify multiple sets of command line options in a file

Note: For the --file string option, you may place a series of valid command lines in a file using any valid flags. In some cases, this may significantly improve performance. A semi-colon at the start of any line makes it a comment.

Note: If you use --output --append option and at the same time the --file option, you may not switch export formats in the command file. For example, a command file with two different commands, one with --fmt csv and the other with --fmt json will produce both invalid CSV and invalid JSON.

Documentation

Overview

Package blocksPkg handles the chifra blocks command. It The tool retrieves block data from your Ethereum node or, if previously cached, from the TrueBlocks cache. You may specify multiple blocks per invocation. By default, queries the full transactional details of the block (including receipts). You may optionally retrieve only the transaction hashes in the block (which is significantly faster). Additionally, you may also use this tool to retrieve uncle blocks at a give height. Another useful feature of is the ability to extract address appearances from a block. TrueBlocks uses a similar feature internally to build its index of appearances. This type of data is very insightful when studying end user behavior and chain-wide adoption analysis.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResetOptions

func ResetOptions(testMode bool)

func RunBlocks

func RunBlocks(cmd *cobra.Command, args []string) error

RunBlocks handles the blocks command for the command line. Returns error only as per cobra.

func ServeBlocks

func ServeBlocks(w http.ResponseWriter, r *http.Request) error

ServeBlocks handles the blocks command for the API. Returns an error.

Types

type BlocksOptions

type BlocksOptions struct {
	Blocks      []string                 `json:"blocks,omitempty"`      // A space-separated list of one or more block identifiers
	BlockIds    []identifiers.Identifier `json:"blockIds,omitempty"`    // Block identifiers
	Hashes      bool                     `json:"hashes,omitempty"`      // Display only transaction hashes, default is to display full transaction detail
	Uncles      bool                     `json:"uncles,omitempty"`      // Display uncle blocks (if any) instead of the requested block
	Traces      bool                     `json:"traces,omitempty"`      // Export the traces from the block as opposed to the block data
	Uniq        bool                     `json:"uniq,omitempty"`        // Display a list of uniq address appearances per transaction
	Flow        string                   `json:"flow,omitempty"`        // For the --uniq option only, export only from or to (including trace from or to)
	Logs        bool                     `json:"logs,omitempty"`        // Display only the logs found in the block(s)
	Emitter     []string                 `json:"emitter,omitempty"`     // For the --logs option only, filter logs to show only those logs emitted by the given address(es)
	Topic       []string                 `json:"topic,omitempty"`       // For the --logs option only, filter logs to show only those with this topic(s)
	Withdrawals bool                     `json:"withdrawals,omitempty"` // Export the withdrawals from the block as opposed to the block data
	Articulate  bool                     `json:"articulate,omitempty"`  // For the --logs option only, articulate the retrieved data if ABIs can be found
	BigRange    uint64                   `json:"bigRange,omitempty"`    // For the --logs option only, allow for block ranges larger than 500
	Count       bool                     `json:"count,omitempty"`       // Display only the count of appearances for --addrs or --uniq
	CacheTxs    bool                     `json:"cacheTxs,omitempty"`    // Force a write of the block's transactions to the cache (slow)
	CacheTraces bool                     `json:"cacheTraces,omitempty"` // Force a write of the block's traces to the cache (slower)
	List        uint64                   `json:"list,omitempty"`        // Summary list of blocks running backwards from latest block minus num
	ListCount   uint64                   `json:"listCount,omitempty"`   // The number of blocks to report for --list option
	Globals     globals.GlobalOptions    `json:"globals,omitempty"`     // The global options
	Conn        *rpc.Connection          `json:"conn,omitempty"`        // The connection to the RPC server
	BadFlag     error                    `json:"badFlag,omitempty"`     // An error flag if needed

}

BlocksOptions provides all command options for the chifra blocks command.

func GetBlocksOptions

func GetBlocksOptions(args []string, g *globals.GlobalOptions) *BlocksOptions

GetBlocksOptions returns the options for this tool so other tools may use it.

func GetOptions

func GetOptions() *BlocksOptions

func (*BlocksOptions) BlocksInternal

func (opts *BlocksOptions) BlocksInternal() error

BlocksInternal handles the internal workings of the blocks command. Returns an error.

func (*BlocksOptions) HandleCounts

func (opts *BlocksOptions) HandleCounts() error

func (*BlocksOptions) HandleDecache

func (opts *BlocksOptions) HandleDecache() error

func (*BlocksOptions) HandleHashes

func (opts *BlocksOptions) HandleHashes() error

func (*BlocksOptions) HandleList

func (opts *BlocksOptions) HandleList() error

func (*BlocksOptions) HandleLogs

func (opts *BlocksOptions) HandleLogs() error

func (*BlocksOptions) HandleShow

func (opts *BlocksOptions) HandleShow() error

func (*BlocksOptions) HandleTraces

func (opts *BlocksOptions) HandleTraces() error

func (*BlocksOptions) HandleUncles

func (opts *BlocksOptions) HandleUncles() error

func (*BlocksOptions) HandleUniq

func (opts *BlocksOptions) HandleUniq() error

func (*BlocksOptions) HandleWithdrawals

func (opts *BlocksOptions) HandleWithdrawals() error

func (*BlocksOptions) String

func (opts *BlocksOptions) String() string

String implements the Stringer interface

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL