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