Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RPCError: got code -32000 with msg "insufficient funds for transfer" #153

Open
Sahil-Kundaliya opened this issue Aug 12, 2024 · 1 comment

Comments

@Sahil-Kundaliya
Copy link

i have "total_balance_formatted": "0.000528902815064832",

here is code

double amount = 0.000128902815064832;
BigInt bigIntValue = BigInt.from(amount * pow(10, 18));
EtherAmount ethAmount =
EtherAmount.fromBigInt(EtherUnit.wei, bigIntValue);
var apiUrl =
"https://eth-sepolia.g.alchemy.com/v2/XXXmy_APi_KeyXXX";

      var httpClient = http.Client();
  var ethClient = Web3Client(apiUrl, httpClient);

  EthPrivateKey credentials = EthPrivateKey.fromHex('0x$XXXMy_private_KeyXXX');
  
  EtherAmount etherAmount = await ethClient.getBalance(credentials.address);
  EtherAmount gasPrice = await ethClient.getGasPrice();

  log('SSS amount is -= $etherAmount');
  print('Balance in Wei: ${etherAmount.getInWei}');
  print('Balance in Ether: ${etherAmount.getValueInUnit(EtherUnit.ether)}');
  {

this is out put why is 0.0 ??
flutter: Balance in Wei: 0
flutter: Balance in Ether: 0.0
}
await ethClient.sendTransaction(
credentials,
Transaction(
to: EthereumAddress.fromHex(XXX_receiver_XXX),
gasPrice: gasPrice,
value: txValue,
),
chainId: 11155111,
);

  {

error is => RPCError: got code -32000 with msg "insufficient funds for transfer".
}

but I have amount in wallet but it's showing 0.0 and get this error

@kevtechi
Copy link

Check here if the address of your private key has a balance: https://sepolia.etherscan.io/

With chain id 11155111, that should be sepolia.

On Sepolia, you can just get ETH from a faucet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants