0

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

0

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

0

Well it seems, that your account/address (ie. account/address used in Metamask) have no sufficient amount (exactly what error message is telling you). You firstly tried to send 2 Eth, which you don't have - well you have it, but to send anything or call any smartcontract you have to pay transaction fees for that. So something more than 2 Eth. That's what "gas * price + value" part of exception message means. In second answer with Wei you are sending 1 Wei (the smallest amount of ethereum possible - see https://etherconverter.online/ or http://ethdocs.org/en/latest/ether.html).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.