Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

235
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda