public Integer getTransactionCount(final Hash blockHeaderHash) {
    return blockchain
        .getBlockBody(blockHeaderHash)
        .map(body -> body.getTransactions().size())
        .orElse(-1);
  }
Returns the number of transactions in the block with the given hash.

@param blockHeaderHash The hash of the block being queried.
@return The number of transactions contained in the referenced block.
ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/query/BlockchainQueries.java