Skip to content

Instantly share code, notes, and snippets.

@kidinamoto01
Last active December 28, 2018 08:24
Show Gist options
  • Save kidinamoto01/5423d892b7028d2c28481edad67877eb to your computer and use it in GitHub Desktop.
Save kidinamoto01/5423d892b7028d2c28481edad67877eb to your computer and use it in GitHub Desktop.
verifier.bash
#!/bin/bash
echo What\'s the gentx directory?
read dir
file="/Users/suyu/Downloads/test/output.txt"
log="$dir"/basecoind.log
if [ -f "$file" ]
then
echo "output file exists"
rm $file
fi
if [ -f "$log" ]
then
rm $log
fi
for filename in "$dir"/config/gentx/*.json; do
echo "$filename"
addr=$(cat $filename| jq .value.msg[0].value.delegator_address -r)
if [ $? -eq 0 ]; then
echo collect
else
echo FAIL
break
fi
echo "$addr"
rm basecoind.log
rm -rf /Users/suyu/Downloads/test/tmp
iris init --home=/Users/suyu/Downloads/test/tmp --moniker=tmp --chain-id=fuxi-6000
mkdir -p /Users/suyu/Downloads/test/tmp/config/gentx
cp $filename /Users/suyu/Downloads/test/tmp/config/gentx
iris add-genesis-account "$addr" 1000iris --home=/Users/suyu/Downloads/test/tmp
if [ $? -eq 0 ]; then
echo collect
else
echo FAIL
continue
fi
output=$(iris collect-gentxs --home=/Users/suyu/Downloads/test/tmp)
if [ $? -eq 0 ]; then
echo collect
else
echo FAIL
continue
fi
iris start --home=/Users/suyu/Downloads/test/tmp > basecoind.log 2>&1 &
sleep 10
PID_SERVER=$!
if grep -q 'panic' basecoind.log
then
# Some Actions
echo "bad gentx" "$filename" >> output.txt
else
echo "good gentx" "$filename" >> output.txt
kill $PID_SERVER
fi
done
@kidinamoto01
Copy link
Author

echo /Users/suyu/go/src/github.com/irisnet/testnets/fuxi/fuxi-6000/config/gentx/elvindu.json| jq -e . >/dev/null 2>&1| echo ${PIPESTATUS[1]}
4

@kidinamoto01
Copy link
Author

#!/bin/bash

PASSWORD=12345678

NAME=kevinproposal

while true
do

echo 12345678| gaiacli tx dist withdraw-rewards --chain-id=game_of_stakes --from=$NAME --is-validator=true --fee=5photinos


sleep 10s

done

@kidinamoto01
Copy link
Author

#!/bin/bash

echo What's the gentx directory?

read dir

file="/Users/suyu/Downloads/test/output.txt"
log="$dir"/basecoind.log
if [ -f "$file" ]
then
echo "output file exists"
rm $file
fi

if [ -f "$log" ]
then
rm $log
fi

for filename in "$dir"/config/gentx/*.json; do
echo "$filename"

addr=$(cat $filename|  jq .value.msg[0].value.delegator_address -r)

if [ $? -eq 0 ]; then
echo collect
else
echo FAIL
break
fi

echo "$addr"

rm basecoind.log 

rm -rf /Users/suyu/Downloads/test/tmp

iris init --home=/Users/suyu/Downloads/test/tmp --moniker=tmp --chain-id=fuxi-6000

mkdir -p /Users/suyu/Downloads/test/tmp/config/gentx

cp $filename /Users/suyu/Downloads/test/tmp/config/gentx

iris add-genesis-account "$addr" 1000iris --home=/Users/suyu/Downloads/test/tmp

if [ $? -eq 0 ]; then
echo collect
else
echo FAIL
continue
fi

output=$(iris collect-gentxs --home=/Users/suyu/Downloads/test/tmp)

if [ $? -eq 0 ]; then
echo collect
else
echo FAIL
continue
fi

iris start --home=/Users/suyu/Downloads/test/tmp > basecoind.log 2>&1 &
sleep 10

PID_SERVER=$!

if grep -q 'panic' basecoind.log 
then
   # Some Actions
   echo "bad gentx" "$filename" >> output.txt
else
   echo "good gentx" "$filename" >> output.txt

   kill $PID_SERVER
fi

done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment