[Ethereum] Android webj3 “insufficient funds for gas * price + value” exception

androidjavaweb3j

I'm trying to send ether in my Android app between 2 addresses which were opened using Metamask.io
There is a balance of 2 ethers in "from" account.
Here the code

        Web3j web3 = Web3jFactory.build(new HttpService("https://rinkeby.infura.io/MY ACCOUNT"));


        Credentials credentials = Credentials.create(privateKeyRopsten);

        TransactionReceipt transactionReceipt = Transfer.sendFunds(
                web3, credentials, <TO ADDRESS>,
                BigDecimal.valueOf(1.0), Convert.Unit.ETHER).send();

When I run it I get

java.lang.RuntimeException: Error processing transaction request:
insufficient funds for gas * price + value

Best Answer

It seems it was a problem with amount of ETHER.
When I changed Convert.Unit.ETHER to Convert.Unit.WEI it solved the problem

Related Topic