How to Deploy an ERC-721 Smart Contract to Avalanche and Mint an NFT with Ankr, Hardhat, and Ethers.js 🔺

This page summarizes the projects mentioned and recommended in the original post on dev.to

Our great sponsors
  • Amplication - open-source Node.js backend code generator
  • Appwrite - The open-source backend cloud platform
  • SurveyJS - A Non-Cloud Alternative to Google Forms that has it all.
  • Sonar - Write Clean JavaScript Code. Always.
  • InfluxDB - Collect and Analyze Billions of Data Points in Real Time
  • Mergify - Updating dependencies is time-consuming.
  • dotenv

    Loads environment variables from .env for nodejs projects.

    Set and keep our environment variables hidden by using [dotenv](https://www.npmjs.com/package/dotenv)↗️

  • ipfs

    Peer-to-peer hypermedia protocol

    // require the correct libraries require("dotenv").config(); require("@nomiclabs/hardhat-ethers"); // Our contract’s ABI (Application Binary Interface) is the interface enabling our js script to interact with our smart contract. Hardhat generates and stores the ABI version of our contract in the artifacts folder as a JSON file. const contract = require("../artifacts/contracts/AnkrAvalancheNFT.sol/AnkrAvalancheNFT.json"); const contractInterface = contract.abi; let provider = ethers.provider; const tokenURI = "https://ipfs.io/ipfs/bafybeib3skazl2dhjctsmiroc6ug5zketfooovt53ast5pxytcan2n3zba/avaxankr.json"; const privateKey = `0x${process.env.PRIVATE_KEY}`; const wallet = new ethers.Wallet(privateKey); wallet.provider = provider; const signer = wallet.connect(provider); // https://docs.ethers.io/v5/api/contract/contract const nft = new ethers.Contract( process.env.CONTRACT_ADDRESS, contractInterface, signer ); const main = () => { console.log("Waiting 5 blocks for confirmation..."); nft .mint(process.env.PUBLIC_KEY, tokenURI) .then((tx) => tx.wait(5)) .then((receipt) => console.log( `Your transaction is confirmed, its receipt is: ${receipt.transactionHash}` ) ) .catch((e) => console.log("something went wrong", e)); }; main();

  • Amplication

    Amplication: open-source Node.js backend code generator. An open-source platform that helps developers build backends without spending time on boilerplate & repetitive coding. Including production-ready GraphQL & REST APIs, DB schema, DTOs, filtering, pagination, RBAC, & more.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts