0

I have two metamask accounts and what I want to do is send ether between those accounts. For the interaction between those accounts, use infura, I give the address of both accounts but in the end the transaction is not made.

BigInteger amount = BigInteger.valueOf(500000000000000000L);
    org.web3j.protocol.core.methods.request.Transaction transaction = new org.web3j.protocol.core.methods.request.Transaction(from, nonce, GAS_PRICE, GAS_LIMIT, to, 
            amount, null);
    EthSendTransaction txRequest = web3.ethSendTransaction(transaction).sendAsync().get();
    String txHash = txRequest.getTransactionHash();

    System.out.println("tx hash: " + txHash);

    System.out.println(String.format("amount: %d from: %s to %s", amount, from, to));

In the code I do not have any error, if someone can help me.

  • Are you testing in mainnet or a private blockchain? Do you have the transaction details of the fail? – Ismael Apr 13 at 4:59

Your Answer

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

Browse other questions tagged or ask your own question.