Untitled

 avatar
unknown
batchfile
2 years ago
728 B
8
Indexable
#!/bin/bash
NUM_PROCESSES=3
./bitcoin --p2p 127.0.0.1:6000 --api 127.0.0.1:7000 1> /dev/null &
./bitcoin --p2p 127.0.0.1:6001 --api 127.0.0.1:7001 -c 127.0.0.1:6000 1> /dev/null &
./bitcoin --p2p 127.0.0.1:6002 --api 127.0.0.1:7002 -c 127.0.0.1:6001 1> /dev/null &

for ((i=0 ; i < $NUM_PROCESSES ; i++)); do
    curl "http://127.0.0.1:700$i/miner/start?lambda=0" 1> /dev/null
    echo "process $i started to mine at $(date +"%H:%M:%S")"
    curl "http://127.0.0.1:700$i/tx-generator/start?theta=100" 1> /dev/null
    sleep 1
done

sleep 10
> longest_chain.txt
for ((j=0 ; j < $NUM_PROCESSES ; j++)); do
    echo $(curl http://127.0.0.1:700$j/blockchain/longest-chain | jq) >> longest_chain.txt
    echo
done

trap "kill 0" EXIT
Editor is loading...