Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

233
Visualizações
Insufficient gas funds for web3js transaction

I am doing an ERC20 transfer (contract name is quad_ek) on ropsten testnet using web3js and my metamask address (called first account and it's also signinfo). I have about 10Eth in my metamask address on testnet

I specified a gas limit of 460000

        const balance_first_account = await quad_ek.methods.balanceOf(first_account).call()
        console.log("token balance first account", balance_first_account.toString())
        console.log("eth in first account", await web3.eth.getBalance(first_account))
    
        const gas = new BigNumber('4600000')
        const gasData = await axios.get("https://api.etherscan.io/api?module=gastracker&action=gasoracle")
        const gasPriceFast = gasData.data.result.FastGasPrice
        const gasPrice = web3.utils.toWei(gas.times(gasPriceFast).toFixed(), 'gwei')
        console.log("gasPrice in wei from etherscan oracle", gasPrice)
        console.log(gasPrice)
     

        const txParams = {
            from: signInfo.address,
            nonce: '0x' + nonce.toString(16),
            gasPrice: gasPrice,
            gasLimit: '0x' + gas.toString(16),
            to: '0x70cf6330b93e465204d0aAc8976Fa2Fef47F6082',
            data: quad_ek.methods.transfer(seventh_account, web3.utils.toWei("14500000")).encodeABI(),
            value: gasPrice,
            chainId: 0x03
        }

        console.log('signinfo address', signInfo.address)

        
        const tx = await signInfo.signTransaction(txParams)
        const txHash = await web3.eth.sendSignedTransaction(tx.rawTransaction)
        
        const balance_first_account_after_tx = await quad_ek.methods.balanceOf(first_account).call()
        console.log("balance first account after tx", balance_first_account_after_tx.toString())
        console.log(txHash)

Output I get:

first_account 0x72707D86053cb767A710957a6b9D8b56Dd7Fd835
eth in first account 9897892440000000000
seventh_account 0xfeBb6F8A30a68226D791B7d0dC6d557709d837a0
nonce 10
token name Quadency Token
token symbol QUAD
totalSupply 400000000000000000000000000
token balance first account 308000000000000000000000000
eth in first account 9897892440000000000
gasPrice in wei from etherscan oracle 78200000000000000
78200000000000000
signinfo address 0x72707D86053cb767A710957a6b9D8b56Dd7Fd835
{ code: -32000, message: 'insufficient funds for gas * price + value' }

Do I need to change my transaction parameters?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda