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

432
Vistas
How to send already minted NFT using alchemy

I have minted some NFTs on opensea. These are on Polygon Mumbai network. Now I want to transfer these to token to other addresses using alchemy web3. Here is the code I am using.

Note: This is supposed to run in nodejs restful API, so there is no wallet available that why I am manually signing the transaction.

async function main() {
  require('dotenv').config();
  const { API_URL,API_URL_TEST, PRIVATE_KEY } = process.env;
  const { createAlchemyWeb3 } = require("@alch/alchemy-web3");
  const web3 = createAlchemyWeb3(API_URL_TEST);
  const myAddress = '*************************'
  const nonce = await web3.eth.getTransactionCount(myAddress, 'latest');
  const transaction = { //I believe transaction object is not correct, and I dont know what to put here
      'asset': {
        'tokenId': '******************************',//NFT token id in opensea
      },
      'gas': 53000,
      'to': '***********************', //metamask address of the user which I want to send the NFT
      'quantity': 1,
      'nonce': nonce,

    }
 
  const signedTx = await web3.eth.accounts.signTransaction(transaction, PRIVATE_KEY);
  web3.eth.sendSignedTransaction(signedTx.rawTransaction, function(error, hash) {
  if (!error) {
    console.log("🎉 The hash of your transaction is: ", hash, "\n Check Alchemy's Mempool to view the status of your transaction!");
  } else {
    console.log("❗Something went wrong while submitting your transaction:", error)
  }
 });
}
main();
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Assumed that you have Metamask installed in your browser, and that the NFT smart contract follows ERC721 Standard

const { API_URL,API_URL_TEST, PRIVATE_KEY } = process.env;
const { createAlchemyWeb3 } = require("@alch/alchemy-web3");
const {abi} = YOUR_CONTRACT_ABI

const contract_address = CONTRACT ADDRESS
require('dotenv').config();


async function main() {
  const web3 = createAlchemyWeb3(API_URL_TEST);  
 web3.eth.getAccounts().then(accounts => {
    const account = account[0]
    const nameContract = web3.eth.Contract(abi, contract_address);
    nameContract.methods.transfer(account, ADDRESS_OF_WALLET_YOU_WANT_TO_SEND_TO, TOKEN_ID).send();
 })
.catch(e => console.log(e));
}
main();
over 4 years ago · Santiago Trujillo Denunciar
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