code: public static void jobTotalNumOfTransactions(JavaSparkContext sc, Configuration hadoopConf, String inputFile, String outputFile) {
      // read bitcoin data from HDFS
      JavaPairRDD<BytesWritable, BitcoinBlock> bitcoinBlocksRDD = sc.newAPIHadoopFile(inputFile, BitcoinBlockFileInputFormat.class, BytesWritable.class, BitcoinBlock.class,hadoopConf);
      // extract the no transactions / block (map)
      JavaPairRDD<String, Long> noOfTransactionPair = bitcoinBlocksRDD.mapToPair(new PairFunction<Tuple2<BytesWritable,BitcoinBlock>, String, Long>() {
  	@Override
  	public Tuple2<String, Long> call(Tuple2<BytesWritable,BitcoinBlock> tupleBlock) {
  		return mapNoOfTransaction(tupleBlock._2());
  	}
      });
     // combine the results from all blocks
     JavaPairRDD<String, Long> totalCount = noOfTransactionPair.reduceByKey(new Function2<Long, Long, Long>() {
  	@Override	
  	public Long call(Long a, Long b) { 
  		return reduceSumUpTransactions(a,b);
  	}
     });
      // write results to HDFS
      totalCount.repartition(1).saveAsTextFile(outputFile);
      }
docs: a job for counting the total number of transactions
  
  @param sc context
  @param hadoopConf Configuration for input format
  @param inputFile Input file
  @param output outputFile file