美文网首页
批量创建eth账户的shell脚本

批量创建eth账户的shell脚本

作者: 毛线丶 | 来源:发表于2019-11-26 14:43 被阅读0次
#!/bin/bash
# 用于批量制造 eth 账户

## Config #######
num=1000
eth_datadir=/data/eth
password='abcd@1234'

## Running #######
now=$(date +%s)
logfile=eth_keys_$now.log
txtfile=eth_account_$now.txt

if [ ! -d $eth_datadir ]; then
    mkdir -p $eth_datadir
fi

echo $password > /tmp/eth_pass

for i in $(seq 0 $num); do
    geth account new --lightkdf --datadir $eth_datadir --password /tmp/eth_pass >> $logfile 2>&1
    # --lightkdf 减少CPU和RAM消耗,更快,但降低kdf强度
    # --datadir  默认datadir在 /root/.ethereum/
    printf "Progress: [%d/%d]\r" $[i+1] $num
done

grep "Public address of the key:" $eth_datadir/$logfile | egrep -o '0x.*' | tr '[A-Z]' '[a-z]' >> $txtfile
rm -f /tmp/eth_pass


echo "Account has been generated, see: $txtfile"
echo "Keystore files has been generated, see: $eth_datadir/keystore/"

相关文章

网友评论

      本文标题:批量创建eth账户的shell脚本

      本文链接:https://www.haomeiwen.com/subject/qjgewctx.html