Go-ethereum: Problem with BigInt(long l). Too short to create transaction with value more than 9.2ETH (Android)

Created on 19 Mar 2018  Â·  6Comments  Â·  Source: ethereum/go-ethereum

Hello everyone. Can somebody help with Ethereum Transaction? I am working on Android(java) and using org.ethereum:geth:1.8.2.
My problem with 'BigInt(long l)' . In java long max value = 9223372036854775807. So basically i can't send more than 9.2 eth. Is there another way to create transaction without these limits?

Transaction's constructor:
public Transaction(long var1, Address var3, BigInt var4, long var5, BigInt var7, byte[] var8){
}

android

Most helpful comment

How about this?

x = new BigInt(0)
x.SetString("99999999999999999999999", 10)

All 6 comments

Very good point! Thanks for the catch. Solution could be a BigInt(String). A workaround for you now: either use Kethereum or Web3j to construct the TX and then newTransactionFromRLP() to get it into geth

How about this?

x = new BigInt(0)
x.SetString("99999999999999999999999", 10)

Good point - quite hard to discover for somebody who has not designed the api though ..-)

@karalabe @ligi
Thank you all, it works ! I think the question can be closed.

It's not your fault. I tried to mimic the go big int library. It might be
unintuitive if you're not used to it. A second constructor would help and
should be added imho.

On Thu, Mar 22, 2018, 17:41 ligi notifications@github.com wrote:

Closed #16337 https://github.com/ethereum/go-ethereum/issues/16337.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/ethereum/go-ethereum/issues/16337#event-1535129879,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAH6GSMIf04tKQvGYNSuTwEb04il-IVkks5tg3GwgaJpZM4SvuJM
.

this works also

String wei = Convert.toWei(ammount, Convert.Unit.ETHER).toString();
BigInt tt = new BigInt(0);
tt.setString(wei,10);

Was this page helpful?
0 / 5 - 0 ratings