class BlockchainRepository
(source)
Repository housing blockchain information.
This repository allows storing blocks, block headers and metadata about the blockchain, such as forks and head information.
BlockchainRepository(chainMetadata: KeyValueStore, blockBodyStore: KeyValueStore, blockHeaderStore: KeyValueStore, transactionReceiptsStore: KeyValueStore, blockchainIndex: BlockchainIndex)
Repository housing blockchain information. |
fun findBlockByHashOrNumber(blockNumberOrBlockHash: Bytes32): List<Hash>
Finds a block according to the bytes, which can be a block number or block hash. |
|
fun findBlocksByParentHash(parentHash: Hash): List<Hash>
Finds hashes of blocks which have a matching parent hash. |
|
suspend fun retrieveBlock(blockHash: Hash): Block? suspend fun retrieveBlock(blockHash: Bytes): Block?
Retrieves a block into the repository. |
|
suspend fun retrieveBlockBody(blockHash: Hash): BlockBody? suspend fun retrieveBlockBody(blockHash: Bytes): BlockBody?
Retrieves a block body into the repository. |
|
suspend fun retrieveBlockBodyBytes(blockHash: Hash): Bytes?
Retrieves a block into the repository as its serialized RLP bytes representation. suspend fun retrieveBlockBodyBytes(blockHash: Bytes): Bytes?
Retrieves a block body into the repository as its serialized RLP bytes representation. |
|
suspend fun retrieveBlockHeader(blockHash: Hash): BlockHeader? suspend fun retrieveBlockHeader(blockHash: Bytes): BlockHeader?
Retrieves a block header into the repository. |
|
suspend fun retrieveBlockHeaderBytes(blockHash: Hash): Bytes? suspend fun retrieveBlockHeaderBytes(blockHash: Bytes): Bytes?
Retrieves a block header into the repository as its serialized RLP bytes representation. |
|
suspend fun retrieveChainHead(): Block?
Retrieves the block identified as the chain head |
|
suspend fun retrieveChainHeadHeader(): BlockHeader?
Retrieves the block header identified as the chain head |
|
suspend fun retrieveGenesisBlock(): Block?
Retrieves the block identified as the genesis block |
|
suspend fun retrieveTransactionReceipt(blockHash: Hash, index: Int): TransactionReceipt? suspend fun retrieveTransactionReceipt(txHash: Hash): TransactionReceipt?
Retrieves a transaction receipt associated with a block and an index |
|
suspend fun retrieveTransactionReceipts(blockHash: Hash): List<TransactionReceipt?>
Retrieves all transaction receipts associated with a block. |
|
suspend fun storeBlock(block: Block): Unit
Stores a block into the repository. |
|
suspend fun storeBlockBody(blockHash: Hash, blockBody: BlockBody): Unit
Stores a block body into the repository. |
|
suspend fun storeBlockHeader(header: BlockHeader): Unit
Stores a block header in the repository. |
|
suspend fun storeTransactionReceipt(transactionReceipt: TransactionReceipt, txIndex: Int, txHash: Hash, blockHash: Hash): Unit
Stores a transaction receipt in the repository. |
|
suspend fun storeTransactionReceipts(vararg transactionReceipts: TransactionReceipt, txHash: Hash, blockHash: Hash): Unit
Store all the transaction receipts of a block in the repository. |
val GENESIS_BLOCK: Bytes |
suspend fun init(blockBodyStore: KeyValueStore, blockHeaderStore: KeyValueStore, chainMetadata: KeyValueStore, transactionReceiptsStore: KeyValueStore, blockchainIndex: BlockchainIndex, genesisBlock: Block): BlockchainRepository
Initializes a blockchain repository with metadata, placing it in key-value stores. |