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