tuweni / org.apache.tuweni.eth.repository / BlockchainIndex

BlockchainIndex

class BlockchainIndex : BlockchainIndexWriter, BlockchainIndexReader (source)

A Lucene-backed indexer capable of indexing blocks and block headers.

Constructors

<init>

A Lucene-backed indexer capable of indexing blocks and block headers.

BlockchainIndex(indexWriter: IndexWriter)

Functions

chainHeadTotalDifficulty

Retrieves the largest total difficulty value of the chain, if it has been computed.

fun chainHeadTotalDifficulty(): UInt256

findBy

Find exact matches for a field.

fun findBy(field: BlockHeaderFields, value: Bytes): List<Hash>
fun findBy(field: BlockHeaderFields, value: Long): List<Hash>
fun findBy(field: BlockHeaderFields, value: Gas): List<Hash>
fun findBy(field: BlockHeaderFields, value: UInt256): List<Hash>
fun findBy(field: BlockHeaderFields, value: Address): List<Hash>
fun findBy(field: BlockHeaderFields, value: Hash): List<Hash>
fun findBy(field: TransactionReceiptFields, value: Bytes): List<Hash>
fun findBy(field: TransactionReceiptFields, value: Int): List<Hash>
fun findBy(field: TransactionReceiptFields, value: Long): List<Hash>
fun findBy(field: TransactionReceiptFields, value: Gas): List<Hash>
fun findBy(field: TransactionReceiptFields, value: UInt256): List<Hash>
fun findBy(field: TransactionReceiptFields, value: Address): List<Hash>
fun findBy(field: TransactionReceiptFields, value: Hash): List<Hash>

findByBlockHashAndIndex

Find a transaction request by block hash and index.

fun findByBlockHashAndIndex(blockHash: Bytes, index: Int): Hash?

findByHashOrNumber

Finds hashes of blocks by hash or number.

fun findByHashOrNumber(hashOrNumber: Bytes): List<Hash>

findByLargest

Find the hash of the block header with the largest value of a specific block header field

fun findByLargest(field: BlockHeaderFields): Hash?
fun findByLargest(field: TransactionReceiptFields): Hash?

findInRange

Find a value in a range.

fun findInRange(field: BlockHeaderFields, minValue: UInt256, maxValue: UInt256): List<Hash>
fun findInRange(field: TransactionReceiptFields, minValue: UInt256, maxValue: UInt256): List<Hash>

findLargestTotalDifficulty

Find the hash of the block header with the largest total difficulty.

fun findLargestTotalDifficulty(): Hash?

index

Provides a function to index elements and committing them. If an exception is thrown in the function, the write is rolled back.

fun index(indexer: (BlockchainIndexWriter) -> Unit): Unit

indexBlockHeader

Indexes a block header.

fun indexBlockHeader(blockHeader: BlockHeader, indexTotalDifficulty: Boolean): Unit

indexTotalDifficulty

Indexes the total difficulty of a block header based on its position in the chain.

fun indexTotalDifficulty(blockHeader: BlockHeader): Unit

indexTransaction

Indexes a transaction.

fun indexTransaction(transaction: Transaction): Unit

indexTransactionReceipt

Indexes a transaction receipt.

fun indexTransactionReceipt(txReceipt: TransactionReceipt, txIndex: Int, txHash: Bytes, blockHash: Bytes): Unit

totalDifficulty

Retrieves the total difficulty of the block header, if it has been computed.

fun totalDifficulty(hash: Bytes): UInt256?