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

498
Visualizações
Web3: insufficient funds for gas * price + value

I'm trying to transfer an erc-721 token between to different wallets. They're both connected to the ropsten network, and should have sufficient funds (0.08 and 0.1 eth) to make a transaction. However, I still get an error saying that

Something went wrong when submitting your transaction: Error: Returned error: insufficient funds for gas * price + value

I've looked at the other questions regarding this, but I didn't find much useful.

Code:

async function transfer(token, tokenId) {
    const contract = new web3.eth.Contract(abi, token);

      
    try {

        const tx = {
            from: publicKey,
            to: token,
            gas: 30000,
            value: 0,
            chain: "rinkeby",
            baseChain: "rinkeby",
            hardfork: "berlin",
            data: contract.methods
                .transferFrom(publicKey, toAddress, tokenId)
                .encodeABI(),
        };

        const signed = await web3.eth.accounts.signTransaction(tx, privateKey);
        const hash = await sendTx(signed);
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

try specify the gasPrice you want to use too,

like,

'gasPrice': web3.toWei('5','gwei')

your code:

async function transfer(token, tokenId) {
    const contract = new web3.eth.Contract(abi, token);

      
    try {

        const tx = {
            from: publicKey,
            to: token,
            gas: 30000,
            gasPrice: web3.toWei('5','gwei'),
            value: 0,
            chain: "rinkeby",
            baseChain: "rinkeby",
            hardfork: "berlin",
            data: contract.methods
                .transferFrom(publicKey, toAddress, tokenId)
                .encodeABI(),
        };

        const signed = await web3.eth.accounts.signTransaction(tx, privateKey);
        const hash = await sendTx(signed);

ofcourse you would need to adjust the gasPrice according to the network

about 4 years ago · Juan Pablo Isaza Relatório
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