public Optional<TransactionWithMetadata> transactionByBlockNumberAndIndex(
      final long blockNumber, final int txIndex) {
    checkArgument(txIndex >= 0);
    return blockchain
        .getBlockHeader(blockNumber)
        .map(header -> transactionByHeaderAndIndex(header, txIndex));
  }
Returns the transaction at the given index for the specified block.

@param blockNumber The number of the block being queried.
@param txIndex The index of the transaction to return.
@return The transaction at the specified location.
ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/query/BlockchainQueries.java