github.com/bigzoro/my_simplechain@v0.0.0-20240315012955-8ad0a2a29bb9/tools/deploy/transaction_stat.sh (about) 1 #!/bin/bash 2 3 command="./sipe" 4 5 ipcPath="data/sipe.ipc" 6 7 if [ ! -e ${command} ];then 8 echo "${command} file not exist" 9 exit 1 10 fi 11 12 if [ ! -e ${ipcPath} ];then 13 echo "${ipcPath} file not exist" 14 exit 1 15 fi 16 17 num=$(${command} attach $ipcPath --exec="eth.blockNumber") 18 19 echo "current block number is ${num}" 20 21 22 start=$((num - 1)) 23 24 end=$num 25 26 echo "end is $end" 27 28 if [ $# -ge 2 ];then 29 start=$1 30 end=$2 31 fi 32 33 sum=0 34 35 for ((i=$start; i <= $end; i++)) 36 do 37 txs=$(${command} attach $ipcPath --exec="eth.getBlock($i).transactions.length") 38 echo "block $i has $txs transactions" 39 sum=$((${sum} + ${txs})) 40 done 41 42 echo $sum