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

276
Vistas
Web3.js: Invalid Sender

I'm trying to make a program to bulk transfer all nft's from one wallet to another. However, I can't seem to make the signing process work. I'm trying to use a piece of code from this tutorial on how to do this, but it is giving me an error saying:

Error: Returned error: invalid sender
    at Object.ErrorResponse (C:\Users\x\Desktop)
    at C:\Users\x\Desktop\nft-transfer\node_modules\web3-core-requestmanager\lib\index.js:300:36
    at XMLHttpRequest.request.onreadystatechange (C:\Users\Gibbo\Desktop\nft-transfer\node_modules\web3-providers-http\lib\index.js:98:13)

Code:

async function transfer(token, tokenId) {
    const contract = new web3.eth.Contract(abi, token);
    const nonce = await web3.eth.getTransactionCount(publicKey);
    try {
        const tx = {
            from: publicKey,
            to: token,
            gas: web3.utils.toHex(gasPrice),
            value: 0,
            chainId: 4,
            nonce: nonce,
            chain: "rinkeby",
            baseChain: "rinkeby",
            hardfork: "berlin",
            data: contract.methods
                .transferFrom(publicKey, toAddress, tokenId)
                .encodeABI(),
        };

        const signedTx = await web3.eth.accounts.signTransaction(tx, privateKey);

        const hash = await sendTx(signedTx);
        return hash;

    } catch (e) {
        console.log(e)
    }
}

const sendTx = (signedTx) =>
  new Promise((resolve, reject) => {
    web3.eth.sendSignedTransaction(signedTx.rawTransaction, (err, hash) => {
      if (!err) {
        console.log('The hash of your transaction is: ', hash);
        return resolve(hash);
      }

      console.log(
        'Something went wrong when submitting your transaction:',
        err,
      );
      return reject(err);
    });
  });

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