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

Error: Transaction ran out of gas. Please provide more gas: #2441

Closed
tnkannan opened this issue Mar 2, 2019 · 3 comments · Fixed by #2511
Closed

Error: Transaction ran out of gas. Please provide more gas: #2441

tnkannan opened this issue Mar 2, 2019 · 3 comments · Fixed by #2511
Labels
Bug Addressing a bug

Comments

@tnkannan
Copy link

tnkannan commented Mar 2, 2019

Hello,

We have provided enough gas for the transaction, but we got the error "Transaction ran out of gas. Please provide more gas:". The transaction has been successful and can not get the receipt.

Recently, we have updated the geth version to v1.8.23

I have used, web3.eth.sendTransaction method.
//
// using the event emitter
web3.eth.sendTransaction({
from: '0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe',
to: '0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe',
value: '1000000000000000'
})
.on('transactionHash', function(hash){
...
})
.on('receipt', function(receipt){
...
})
.on('confirmation', function(confirmationNumber, receipt){ ... })
.on('error', console.error); // If a out of gas error, the second parameter is the receipt.
//

@nivida nivida added the support label Mar 2, 2019
@nivida
Copy link
Contributor

nivida commented Mar 2, 2019

I've tested your example code with geth v1.8.23 and the latest version of web3.js and it worked. Could you please provide further details and update your issue to be aligned with the issue template we provide here?

@kvhnuke
Copy link

kvhnuke commented Mar 7, 2019

I believe this is related to the issue I am getting, currently it is not correct the way TransactionReceiptValidator work,
https://github.com/ethereum/web3.js/blob/b88ab8235ed583f8b944a438e0676ef9d7c523cc/packages/web3-core-method/src/validators/TransactionReceiptValidator.js#L37-L73

Following is the culprit

isValidGasUsage(receipt, method) { 
         return !receipt.outOfGas && method.utils.hexToNumber(method.parameters[0].gas) !== receipt.gasUsed; 
     } 

for example if you send a transaction that uses the exact amount of provided gas, it will throw an error. Meaning all regular transactions that uses 21000 gas will throw an error. Instead you should check the status first if the status is 0x1 then that tx is successful. If it is not you can check whether gas and used gas are equal

kvhnuke added a commit to MyEtherWallet/MyEtherWallet that referenced this issue Mar 7, 2019
@nivida
Copy link
Contributor

nivida commented Mar 14, 2019

I've updated the transaction receipt validation during the improvements of the transaction based methods. PR

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

Successfully merging a pull request may close this issue.

3 participants