Chain data

The following data structures describe the output of various TrueBlocks blockchain queries. These data structures basically mimic the data available directly from the RPC.

Each data structure is created by one or more tools which are detailed below.

Block

chifra blocks returns top level data specified block. You can also include an array for the blocks’ transactions.

The following commands produce and manage Blocks:

Blocks consist of the following fields:

FieldDescriptionType
gasLimitthe system-wide maximum amount of gas permitted in this blockgas
hashthe hash of the current blockhash
blockNumberthe number of the blockblknum
parentHashhash of previous blockhash
minerAddress of block’s winning mineraddress
difficultythe computational difficulty at this blockuint64
timestampthe Unix timestamp of the objecttimestamp
transactionsa possibly empty array of transactions or transaction hashesTransaction[]
baseFeePerGasthe base fee for this blockwei
finalizedflag indicating the system considers this data finalbool
unclesCntthe number of uncles in this blockuint64

Transaction

Transactions represent eth transfers to and from other addresses.

Most of the fields that TrueBlocks returns are standard to all eth transaction. However, one field is very interesting: articulatedTx provides a human readable output of the input field.

This is a very powerful way to understand the story behind a smart contract.

The following commands produce and manage Transactions:

Transactions consist of the following fields:

FieldDescriptionType
hashThe hash of the transactionhash
blockHashThe hash of the block containing this transactionhash
blockNumberthe number of the blockblknum
transactionIndexthe zero-indexed position of the transaction in the blockblknum
noncesequence number of the transactions sent by the senderuint64
timestampthe Unix timestamp of the objecttimestamp
fromaddress from which the transaction was sentaddress
toaddress to which the transaction was sentaddress
valuethe amount of wei sent with this transactionswei
gasthe maximum number of gas allowed for this transactiongas
gasPricethe number of wei per unit of gas the sender is willing to spendgas
inputbyte data either containing a message or funcational data for a smart contracts. See the –articulatebytes
receiptReceipt
statementsarray of reconciliationsReconciliation[]
articulatedTxFunction
compressedTxtruncated, more readable version of the articulationstring
hasTokentrue if the transaction is token related, false otherwiseuint8
finalizedflag indicating the system considers this data finalbool
extraDatastring
isErrortrue if the transaction ended in error, false otherwiseuint8
datedatetime

Transfer

The transfer data model is produced by the reconciliation process of chifra export. It represents, for all intents and purposes, the asset value transfer produced by nearly all value transfers on any blockchain. While the details of various token transfers are varied, the underlying mechanism is through token transfers. In our accounting, we focus on the token transfers and label each such transfer on the input data or event topic data. In this way, our accounting remains relatively easy (we only reconcile tokens and ETH), but we cover every conceivable token asset transfer of any type.

The following commands produce and manage Transfers:

Transfers consist of the following fields:

FieldDescriptionType
blockNumberthe number of the blockblknum
transactionIndexthe zero-indexed position of the transaction in the blockblknum
logIndexthe zero-indexed position of the log in the transactionblknum
transactionHashthe hash of the transaction that triggered this reconciliationhash
timestampthe Unix timestamp of the objecttimestamp
datea calculated field – the date of this transactiondatetime
senderthe initiator of the transfer (the sender)address
recipientthe receiver of the transfer (the recipient)address
assetAddr0xeeee…eeee for ETH reconcilations, the token address otherwiseaddress
assetSymboleither ETH, WEI or the symbol of the asset being reconciled as queried from the chainstring
decimalsEquivalent to the queried value of decimals from an ERC20 contract or, if ETH or WEI then 18uint64
amountthe amount of the transfer in the units of the assetuint256
spotPriceThe on-chain price in USD (or if a token in ETH, or zero) at the time of the transactiondouble
priceSourceThe on-chain source from which the spot price was takenstring
encodingThe four-byte encoding of the transaction’s function callstring

Receipt

Receipts record the amount of gas used for a transaction among other things. If the transaction succeeded, a receipt might also have logs.

If the to address of a transaction is 0x0, the input data is considered to be the source code (byte code) of a smart contract. In this case, if the creation of the contract succeeds, the contractAddress field of the receipt carries the address of the newly created contract.

The following commands produce and manage Receipts:

Receipts consist of the following fields:

FieldDescriptionType
blockNumberblknum
transactionIndexblknum
transactionHashhash
blockHashhash
status1 on transaction suceess, null if tx preceeds Byzantium, 0 otherwiseuint32
gasUsedthe amount of gas actually used by the transactiongas
contractAddressthe address of the newly created contract, if anyaddress
isErrorbool
logsa possibly empty array of logsLog[]

Log

Logs appear in a possibly empty array in the transaction’s receipt. They are only created if the underlying transaction suceeded. In the case where the transaction failed, no logs will appear in the receipt. Logs are only ever generated during transactions whose to address is a smart contract.

The following commands produce and manage Logs:

Logs consist of the following fields:

FieldDescriptionType
blockNumberthe number of the blockblknum
transactionIndexthe zero-indexed position of the transaction in the blockblknum
logIndexthe zero-indexed position of this log relative to the blockblknum
transactionHashthe hash of the transctionhash
timestampthe timestamp of the block this log appears intimestamp
addressthe smart contract that emitted this logaddress
topicsThe first topic hashes event signature of the log, up to 3 additional index parameters may appeartopic[]
dataany remaining un-indexed parameters to the eventbytes
articulatedLoga human-readable version of the topic and data fieldsFunction
compressedLoga truncated, more readable version of the articulationstring

Trace

The deepest layer of the Ethereum data is the trace. Every transaction has at least one trace which is itself a record of the transaction. If the to address of the transaction is a smart contract, other traces may appear, if, for example, that smart contract calls other smart contracts.

Traces may be arbitrarily deep (up to the gasLimit) and ultimately represent a tree of function calls. Some transactions have 100s of traces. The format of the trace is similar to the transaction itself have a trace action (which contains from, to, value like the transaction) and the trace result (containing gasUsed like the receipt).

The following commands produce and manage Traces:

Traces consist of the following fields:

FieldDescriptionType
blockHashThe hash of the block containing this tracehash
blockNumberthe number of the blockblknum
timestampthe timestamp of the blocktimestamp
transactionHashthe transaction’s hash containing this tracehash
transactionIndexthe zero-indexed position of the transaction in the blockblknum
traceAddressa particular trace’s address in the trace treestring[]
subtracesthe number of children traces that the trace hashuint64
typethe type of the tracestring
actionthe trace action for this traceTraceAction
resultthe trace result of this traceTraceResult
articulatedTracehuman readable version of the trace action input dataFunction
compressedTracea compressed string version of the articulated tracestring

Notes

When produced using the --raw option to chifra traces, this data model actually produces transactionPosition instead of transactionIndex. When produced without the --raw option, the model uses transactionIndex to be consistent with other data models such as the transaction.

Traces and TraceActions, when produced during a self-destruct, export different fields when rendered in JSON. In CSV and TXT output, these fields change thier meaning while retaining the header of the original fields. The following table describes these differences:

Fields that change during self-destruct transaction:

FieldWhen rendered in JSONWhen rendered in csv/txt
Action.FromAction.Address
Action::ToAction.RefundAddress
Action::ValueAction.Balance
Action.RefundAddress
Action.Balance

TraceAction

Other than the first trace which is the trace of the transaction itself, traces represent calls into smart contracts. Because of this, trace actions closely resemble the fields of the transaction.

The following commands produce and manage TraceActions:

TraceActions consist of the following fields:

FieldDescriptionType
fromaddress from which the trace was sentaddress
toaddress to which the trace was sentaddress
gasthe maximum number of gas allowed for this tracegas
inputan encoded version of the function callbytes
callTypethe type of callstring
refundAddressif the call type is self-destruct, the address to which the refund is sentaddress

TraceResult

As mentioned above, other than the first trace, traces represent calls into other smart contracts. Because of this, the trace results closely resembles the fields of the receipt.

The following commands produce and manage TraceResults:

TraceResults consist of the following fields:

FieldDescriptionType
newContractAddress of new contract, if anyaddress
codeif this trace is creating a new smart contract, the byte code of that contractbytes
gasUsedthe amount of gas used by this tracegas
outputthe result of the call of this tracebytes

BlockCount

chifra blocks --count returns the number of various types of data in a block. For example, transactionCnt is the number of transactions in the block, and so on.

The following commands produce and manage BlockCounts:

BlockCounts consist of the following fields:

FieldDescriptionType
blockNumberthe block’s block numberblknum
timestampthe timestamp of the blocktimestamp
transactionsCntthe number transactions in the blockuint64
unclesCntthe number of uncles in the blockuint64
logsCntthe number of logs in the blockuint64
tracesCntthe number of traces in the blockuint64
appsCntthe number of address appearances in the blockuint64
uniqsCntthe number of address appearances in the block per transactionuint64

NamedBlock

Left to its own devices, the blockchain would try to convince us that only hashes and bytes are important, but being human beings we know that this is not true. TrueBlocks articulates various types of data with chifra names detailing the names for addresses, -articulate describing the Functions and Events of a transaction, and chifra when describing dated blocks. Dated blocks assign a human-readable date to blocks given block numbers or timestamps and visa versa.

The following commands produce and manage NamedBlocks:

NamedBlocks consist of the following fields:

FieldDescriptionType
blockNumberthe number of the blockblknum
timestampthe Unix timestamp of the blocktimestamp
dateHuman readable version of timestampdatetime
namean optional name for the blockstring

TraceCount

chifra trace --count returns the number of traces the given transaction.

The following commands produce and manage TraceCounts:

TraceCounts consist of the following fields:

FieldDescriptionType
blockNumberthe block numberblknum
transactionIndexthe transaction indexblknum
transactionHashthe transaction’s hashhash
timestampthe timestamp of the blocktimestamp
tracesCntthe number of traces in the transactionuint64

Base types

This documentation mentions the following basic data types.

TypeDescriptionNotes
addressan ‘0x’-prefixed 20-byte hex stringlowercase
blknuman alias for a uint64
booleither true, false, 1, or 0
bytesan arbitrarily long string of bytes
datetimea JSON formatted dateas a string
doublea double precision float64 bits
gasan unsigned big numberas a string
hashan ‘0x’-prefixed 32-byte hex stringlowercase
stringa normal character string
timestampa 64-bit unsigned integerUnix timestamp
uint256a 256-bit unsigned integer
uint32a 32-bit unsigned integer
uint64a 64-bit unsigned integer
uint8an alias for the boolean type
weian unsigned big numberas a string

Edit this page on GitHub