You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all, great work on this @sc0Vu! I know this is still bleeding edge at the moment but I encountered an issue that I hope you can help me out with. Below is a snippet from my proof of concept code to send transactions on the rinkeby testnet.
$web3 = newWeb3(newHttpProvider(newHttpRequestManager(env('INFURA_URL'), 5.0)));
$eth = $web3->eth;
$eth->getBalance(env('WALLET_ADDRESS'), function ($err, $balance) {
if ($err !== null) {
$this->error($err->getMessage());
}
$this->comment(sprintf('Current balance: %s ETH', wei_to_ether($balance)));
});
$eth->gasPrice(function ($err, $gasPrice) {
if ($err !== null) {
$this->error($err->getMessage());
}
$this->gasPrice = $gasPrice;
$this->comment(sprintf('Gas price: %s gwei', wei_to_gwei($gasPrice->toString())));
});
$eth->estimateGas(['from' => env('WALLET_ADDRESS')], function ($err, $gas) {
if ($err !== null) {
$this->error($err->getMessage());
}
$this->gasEstimate = $gas;
$this->comment(sprintf('Gas limit: %s units', $gas->toString()));
});
$eth->getTransactionCount(env('WALLET_ADDRESS'), 'pending', function ($err, $nonce) use ($eth) {
if ($err !== null) {
$this->error($err->getMessage());
}
$this->comment(sprintf('Nonce: %s', $nonce));
for ($i = 0; $i < count($this->recipients); $i++) {
$this->info(
sprintf(
'Sending %s ETH to %s',
$this->recipients[$i]['amount'],
$this->recipients[$i]['address']
)
);
// @todo: should use TransactionFormatter to do all hex conversion (when it works)$txParams = [
'from' => env('WALLET_ADDRESS'),
'to' => $this->recipients[$i]['address'],
'value' => sprintf(decimal_to_hex(ether_to_wei($this->recipients[$i]['amount']))),
'nonce' => sprintf(decimal_to_hex($nonce->toString() + $i)),
'gasLimit' => decimal_to_hex($this->gasEstimate->toString()),
'gasPrice' => decimal_to_hex($this->gasPrice->toString()),
'chainId' => 4,
];
$transaction = newTransaction($txParams);
$signedTransaction = $transaction->sign(env('WALLET_PRIVATE_KEY'));
// Send the transaction$eth->sendRawTransaction(sprintf('0x%s', $signedTransaction), function ($err, $tx) {
if ($err !== null) {
$this->error($err->getMessage());
}
$this->comment(sprintf('TX: %s', $tx));
});
}
});
Everything works flawlessly until sending the transaction, it comes back with the following error insufficient funds for gas * price + value. I'm sure that I have sufficient funds, as I have a very similar proof of concept using web3js that works fine. Below are the transaction parameters right before signing for both versions:
Hi @kielabokkie ,
Thanks for report this, I had test sendRawTransaction lots of times with ethereum-tx js library and ethereum-tx php library, tested with infura json rpc service.
Both got insufficient funds error, I still try to find what happend here.
I think it's tx library issue or api service issue, still try to find way to fix it.
@sc0Vu I got the "Insufficient funds" error today through the JS library when I passed the chain ID as a string instead of an integer. Not sure if it is related but thought I mention it 😉️
@kielabokkie I am frustrated... I am not able to call a function mutating status passing params... could you write an exmplae, because you're able to do this, please?
First of all, great work on this @sc0Vu! I know this is still bleeding edge at the moment but I encountered an issue that I hope you can help me out with. Below is a snippet from my proof of concept code to send transactions on the rinkeby testnet.
Everything works flawlessly until sending the transaction, it comes back with the following error
insufficient funds for gas * price + value
. I'm sure that I have sufficient funds, as I have a very similar proof of concept using web3js that works fine. Below are the transaction parameters right before signing for both versions:PHP
Javascript
As you can see the parameters are identical so I'm a bit lost as to why the transaction doesn't get through. Any thoughts?
The text was updated successfully, but these errors were encountered: