blocksPkg

package
v0.0.0-...-2a3d9f8 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2024 License: GPL-3.0 Imports: 29 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
  -U, --count             display only the count of appearances for --addrs or --uniq
  -X, --cache_txs         force a write of the block's transactions to the cache (slow)
  -R, --cache_traces      force a write of the block's traces to the cache (slower)
  -H, --ether             specify value in ether
  -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.
  - 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.
  - The --traces option requires your RPC to provide trace data. See the README for more information.

Data models produced by this tool:

further information

The --traces option requires your node to enable the trace_block (and related) RPC endpoints. Please see the README file for the chifra traces command for more information.

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.

Copyright (c) 2024, TrueBlocks, LLC. All rights reserved. Generated with goMaker.

Documentation

Overview

blocksPkg implements the chifra blocks command.

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.

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
	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)
	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 BlocksFinishParseInternal

func BlocksFinishParseInternal(w io.Writer, values url.Values) *BlocksOptions

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(rCtx *output.RenderCtx) error

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

func (*BlocksOptions) HandleCount

func (opts *BlocksOptions) HandleCount(rCtx *output.RenderCtx) error

func (*BlocksOptions) HandleDecache

func (opts *BlocksOptions) HandleDecache(rCtx *output.RenderCtx) error

func (*BlocksOptions) HandleHashes

func (opts *BlocksOptions) HandleHashes(rCtx *output.RenderCtx) error

func (*BlocksOptions) HandleLogs

func (opts *BlocksOptions) HandleLogs(rCtx *output.RenderCtx) error

func (*BlocksOptions) HandleShow

func (opts *BlocksOptions) HandleShow(rCtx *output.RenderCtx) error

func (*BlocksOptions) HandleTraces

func (opts *BlocksOptions) HandleTraces(rCtx *output.RenderCtx) error

func (*BlocksOptions) HandleUncles

func (opts *BlocksOptions) HandleUncles(rCtx *output.RenderCtx) error

func (*BlocksOptions) HandleUniq

func (opts *BlocksOptions) HandleUniq(rCtx *output.RenderCtx) error

func (*BlocksOptions) HandleWithdrawals

func (opts *BlocksOptions) HandleWithdrawals(rCtx *output.RenderCtx) 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