Query the ledger for transactions
The ledger data (Transaction, Receipt, Log, Transfers, Contract, etc) can be access from self.context.ledger
.
The code to query the number of transaction per block uses the aggregation function.
The returned count
is a LedgerModelOutput
object. We can get the result from count.data
.
We can first test drive the ledger query in Cmf console. Temporarily moving away from the editor to the console. Type credmark-dev run console
,
You could put the above with some tweak the where clause, we only query the current block number. In Cmf console, variable block_number
is auto-created to store the current block number, equal to self.context.block_number
.
q.HASH.count_distinct_()
is translated to f'COUNT(DISTINCT {q.HASH})'
in the back end. We have included some SQL functions to be applied to the field, press .
inside the console to know more of them. If you would like to add more, please talk to us.
The various object levels and their values are:
Last updated