Documentation ¶
Overview ¶
exportPkg implements the chifra export command.
The chifra export tools provides a major part of the functionality of the TrueBlocks system. Using the index of appearances created with chifra scrape and the list of transaction identifiers created with chifra list, chifra export completes the actual extraction of an address's transactional history from the node.
You may use topics, fourbyte values at the start of a transaction's input data, and/or a log's source address or emitter to filter the results.
You may also choose which portions of the Ethereum data structures (--transactions, --logs, --traces, etc.) as you wish.
By default, the results of the extraction are delivered to your console, however, you may export the results to any database (with a little bit of work). The format of the data, its content and its destination are up to you.
Index ¶
- func ResetOptions(testMode bool)
- func RunExport(cmd *cobra.Command, args []string) error
- func ServeExport(w http.ResponseWriter, r *http.Request) error
- type ExportOptions
- func (opts *ExportOptions) ExportInternal(rCtx *output.RenderCtx) error
- func (opts *ExportOptions) FreshenMonitorsForExport(rCtx *output.RenderCtx, monitorArray *[]monitor.Monitor) (bool, error)
- func (opts *ExportOptions) GetMax() uint64
- func (opts *ExportOptions) HandleAccounting(rCtx *output.RenderCtx, monitorArray []monitor.Monitor) error
- func (opts *ExportOptions) HandleAppearances(rCtx *output.RenderCtx, monitorArray []monitor.Monitor) error
- func (opts *ExportOptions) HandleBalances(rCtx *output.RenderCtx, monitorArray []monitor.Monitor) error
- func (opts *ExportOptions) HandleCount(rCtx *output.RenderCtx, monitorArray []monitor.Monitor) error
- func (opts *ExportOptions) HandleDecache(rCtx *output.RenderCtx, monitorArray []monitor.Monitor) error
- func (opts *ExportOptions) HandleLogs(rCtx *output.RenderCtx, monitorArray []monitor.Monitor) error
- func (opts *ExportOptions) HandleNeighbors(rCtx *output.RenderCtx, monitorArray []monitor.Monitor) error
- func (opts *ExportOptions) HandleReceipts(rCtx *output.RenderCtx, monitorArray []monitor.Monitor) error
- func (opts *ExportOptions) HandleShow(rCtx *output.RenderCtx, monitorArray []monitor.Monitor) error
- func (opts *ExportOptions) HandleStatements(rCtx *output.RenderCtx, monitorArray []monitor.Monitor) error
- func (opts *ExportOptions) HandleTraces(rCtx *output.RenderCtx, monitorArray []monitor.Monitor) error
- func (opts *ExportOptions) HandleWithdrawals(rCtx *output.RenderCtx, monitorArray []monitor.Monitor) error
- func (opts *ExportOptions) IsMax(cnt uint64) bool
- func (opts *ExportOptions) String() string
- func (opts *ExportOptions) Validate() error
- type Reason
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ResetOptions ¶
func ResetOptions(testMode bool)
func RunExport ¶
RunExport handles the export command for the command line. Returns error only as per cobra.
func ServeExport ¶
func ServeExport(w http.ResponseWriter, r *http.Request) error
ServeExport handles the export command for the API. Returns an error.
Types ¶
type ExportOptions ¶
type ExportOptions struct { Addrs []string `json:"addrs,omitempty"` // One or more addresses (0x...) to export Topics []string `json:"topics,omitempty"` // Filter by one or more log topics (only for --logs option) Fourbytes []string `json:"fourbytes,omitempty"` // Filter by one or more fourbytes (only for transactions and trace options) Appearances bool `json:"appearances,omitempty"` // Export a list of appearances Receipts bool `json:"receipts,omitempty"` // Export receipts instead of transactional data Logs bool `json:"logs,omitempty"` // Export logs instead of transactional data Traces bool `json:"traces,omitempty"` // Export traces instead of transactional data Neighbors bool `json:"neighbors,omitempty"` // Export the neighbors of the given address Accounting bool `json:"accounting,omitempty"` // Attach accounting records to the exported data (applies to transactions export only) Statements bool `json:"statements,omitempty"` // For the accounting options only, export only statements Balances bool `json:"balances,omitempty"` // Traverse the transaction history and show each change in ETH balances Withdrawals bool `json:"withdrawals,omitempty"` // Export withdrawals for the given address Articulate bool `json:"articulate,omitempty"` // Articulate transactions, traces, logs, and outputs CacheTraces bool `json:"cacheTraces,omitempty"` // Force the transaction's traces into the cache Count bool `json:"count,omitempty"` // For --appearances mode only, display only the count of records FirstRecord uint64 `json:"firstRecord,omitempty"` // The first record to process MaxRecords uint64 `json:"maxRecords,omitempty"` // The maximum number of records to process Relevant bool `json:"relevant,omitempty"` // For log and accounting export only, export only logs relevant to one of the given export addresses 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) Reverted bool `json:"reverted,omitempty"` // Export only transactions that were reverted Asset []string `json:"asset,omitempty"` // For the accounting options only, export statements only for this asset Flow string `json:"flow,omitempty"` // For the accounting options only, export statements with incoming, outgoing, or zero value Factory bool `json:"factory,omitempty"` // For --traces only, report addresses created by (or self-destructed by) the given address(es) Unripe bool `json:"unripe,omitempty"` // Export transactions labeled unripe (i.e. less than 28 blocks old) Reversed bool `json:"reversed,omitempty"` // Produce results in reverse chronological order NoZero bool `json:"noZero,omitempty"` // For the --count option only, suppress the display of zero appearance accounts FirstBlock base.Blknum `json:"firstBlock,omitempty"` // First block to process (inclusive) LastBlock base.Blknum `json:"lastBlock,omitempty"` // Last block to process (inclusive) 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 }
ExportOptions provides all command options for the chifra export command.
func ExportFinishParseInternal ¶
func ExportFinishParseInternal(w io.Writer, values url.Values) *ExportOptions
func GetExportOptions ¶
func GetExportOptions(args []string, g *globals.GlobalOptions) *ExportOptions
GetExportOptions returns the options for this tool so other tools may use it.
func GetOptions ¶
func GetOptions() *ExportOptions
func (*ExportOptions) ExportInternal ¶
func (opts *ExportOptions) ExportInternal(rCtx *output.RenderCtx) error
ExportInternal handles the internal workings of the export command. Returns an error.
func (*ExportOptions) FreshenMonitorsForExport ¶
func (*ExportOptions) GetMax ¶
func (opts *ExportOptions) GetMax() uint64
func (*ExportOptions) HandleAccounting ¶
func (*ExportOptions) HandleAppearances ¶
func (*ExportOptions) HandleBalances ¶
func (*ExportOptions) HandleCount ¶
func (*ExportOptions) HandleDecache ¶
func (opts *ExportOptions) HandleDecache(rCtx *output.RenderCtx, monitorArray []monitor.Monitor) error
HandleDecache handles the command chifra monitors --decache
func (*ExportOptions) HandleLogs ¶
func (*ExportOptions) HandleNeighbors ¶
func (*ExportOptions) HandleReceipts ¶
func (*ExportOptions) HandleShow ¶
func (*ExportOptions) HandleStatements ¶
func (*ExportOptions) HandleTraces ¶
func (*ExportOptions) HandleWithdrawals ¶
func (*ExportOptions) IsMax ¶
func (opts *ExportOptions) IsMax(cnt uint64) bool
func (*ExportOptions) String ¶
func (opts *ExportOptions) String() string
String implements the Stringer interface
func (*ExportOptions) Validate ¶
func (opts *ExportOptions) Validate() error
EXISTING_CODE Validate calls into the opts validateExport routine
type Reason ¶
type Reason struct { App *types.Appearance Address *base.Address Reason string }
func GetNeighbors ¶
func GetNeighbors(app *types.Appearance) ([]Reason, error)