cosmos-sdk0.24.2版本shell测试脚本总结

same chain transfer

//自动创建账户,这块需要自动交互输入密码,嵌入expect解决
echo "Start create 1000 accounts..."
sleep 2
for i in `seq 0 999`
do
{
expect < account.txt

awk '{print $1}' ./account.txt > ./chain2name.txt

awk '{print $3}' ./account.txt > ./address.txt

echo "Preparation is complete"
sleep 2
echo "Start the same chain transfer"
sleep 1
//从上边生成的文档中提取信息
c=0
for line in `cat address.txt`
do
  account=$line
  accounts[$c]=$account
  ((c++))
done

d=0
for line in `cat chain2name.txt`
do
  node=$line
  nodes[$d]=$node
  ((d++))
done
//循环转账
for i in `seq 1 4`
do
{
  pos=`expr $i + 4`
  echo "Send tx to node$pos"
  gaiacli send --password 1234567890 --amount=12500000node1Token --from=${nodes[$i]} --to=${accounts[$pos]} --chain-id=chain-2 --async
}
done
sleep 10


你可能感兴趣的:(区块链,脚本)