始料未及的COVID-19、延期的考试、又可以瞎倒腾的喜悦

Hmmm,真的本来下定决心不要东摸西摸专心功课,但是确实发生了本次人类历史上的大事件(当然可能在以后的日子里这个也就是洒洒水水平)导致了考试的延期,我又再一次的东张西望起来。

hmmm,好吧为了庆祝又可以自由活动,特此献上抄来的小程序一篇。以下可以用在ledge nano x上面查阅ETH。ledger的椭圆曲线弧度做了修改,更加细化了。

 

# List accounts from the Ledger Nano X
# Works in OS/X and Linux. May work in Windows with Cygwin.
#
# How to use:
# 1. Save into a file, e.g., ~/bin/getNanoAccounts
# 2. Set the executable bit - `chmod 700 ~/bin/getNanoAccounts`
# 3. Run the script - `~/bin/getNanoAccounts`
#
# (c) BokkyPooBah - Aug 13 2017. The MIT Licence.
# ------------------------------------------------------------------------------

geth attach << EOF | grep "RESULT: " | sed "s/RESULT: //"

function padLeft(s, n) {
  var result = s.toString();
  while (result.length < n) {
    result = " " + result;
  }
  return result;
}

function listNanoAccounts(from, to) {
  if (from == null) {
    from = 0;
  }
  if (to == null) {
    to = 9;
  }
  var nanoUrl=personal.listWallets[personal.listWallets.length-1].url;
  var nanoPathPrefix="m/44'/60'/0'/0/";
  var total = new BigNumber(0);
  console.log("RESULT:   # Account                                                        Ethers");
  console.log("RESULT: --- ------------------------------------------ --------------------------");
  for (var i = from; i <= to; i++) {
    var account = personal.deriveAccount(nanoUrl, nanoPathPrefix + i, true).address;
    var balance = eth.getBalance(account);
    total = total.add(balance);
    console.log("RESULT: " + padLeft(i, 3) + " " + account + " " + padLeft(balance.toFixed(18), 26));
  }
  console.log("RESULT: --- ------------------------------------------ --------------------------");
  console.log("RESULT:     Total                                      " + padLeft(total, 26));
  console.log("RESULT: --- ------------------------------------------ --------------------------");
}

listNanoAccounts()

EOF

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

取啥都被占用

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值