0

When the sendTransaction is executed , it returns insufficient funds at Object.n [as throwError] (ethers.min.js:1) at ethers.min.js:1 at tryCallOne (core.js:37)

import { Wallet, providers, getDefaultProvider } from "ethers";

transactionData={ to: "0xdfa7E6962d65870F34388E12fF1380e66c1F8c47"
 value: 1000000000000
 gasLimit: 21000
 gasPrice: 8000000000
 data: ""}

let wallet = new Wallet(privateKey, getDefaultProvider('mainnet'));
 wallet.sendTransaction(transactionData);
2

Your account holds 0.000068371576646932 ether, which is 68371576646932 wei.

With:

 value: 1000000000000
 gasLimit: 21000
 gasPrice: 8000000000

You tell the node that you are willing to spend at most 21000 * 8000000000 + 1000000000000 wei.

But since 21000 * 8000000000 + 1000000000000 = 169000000000000 > 68371576646932, your transaction cannot be executed even if it would ultimately spend less than the amount that you've stated (which in this specific case it won't anyway, because you've set gas: 21000, which is the minimum possible for a transaction).

| improve this answer | |
  • thanks ! that was silly of me to not check total cost . – ishab acharya Mar 5 at 14:21

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.