3

我正在尝试使用 Java API 在 Aion 中获取帐户余额。无论我做什么,我都无法从account变量中获取值。

account = "a06f02e986965ddd3398c4de87e3708072ad58d96e9c53e87c31c8c970b211e5";
BigInteger account_balance = api.getChain().getBalance(account).getObject();

System.out.format("%n%s balance is = %d nAmp (over %d AION)%n", 
    account, 
    account_balance, 
    account_balance.divide(BigInteger.TEN.pow(18)));

有人有什么想法吗?

4

2 回答 2

2

您还可以尝试使用 JSON 请求 进行RPC API调用:{"jsonrpc":"2.0","method":"eth_getBalance","params":["0x0","latest"],"id":32}

于 2019-02-21T19:49:11.893 回答
2

您需要将您的帐户地址包含在Address.wrap.

account = Address.wrap("a06f02e9...");
于 2018-10-16T15:32:51.430 回答