NFT Marketplace Tutorial

image

This repository is related to the [upcoming] tutorial. It contains the boilerplates code for a functioning Ethereum NFT marketplace.

Prerequisites

  • Metamask

Installation

Install the node packages:

yarn install

Compile the Smart Contracts:

npx hardhat compile

You have two ways to interact with the NFT Marketplace:

  • Locally using Hardhat
  • Deploying the contracts on Polygon Mumbai-testnet

Deploying the NFTMarketplace locally

Open your terminal and run:

npx hardhat node

This will start a local Ethereum blockchain node, log 19 wallets and their private keys.

Now in a new terminal window run:

npx hardhat run ./scripts/deploy.js --network localhost

This will deploy the contracts on the local ethereum node and print out their addresses (see: change contracts address section)

Deploying the NFTMarketplace on Polygon Mumbai

As is, the contracts contained in the repository, are already deployed on Polygon Mumbai-testnet.

If you want to work with brand new contracts, though, you'll need to:

  1. Navigate to hardhat.config.js file in the root folder and substitute the private key, with your wallet's private key.

image

  1. Get some test MATIC from an online faucet such as this one

Once you'll have both, run the following code in your terminal:

npx hardhat run ./scripts/deploy.js --network mumbai

This will log the address of the newly deployed contracts.

Refer to the next section to learn how to change the contracts adress the front-end will interact with.

Change The NFT Marketplace Contracts Adresses

Navigate to /pages/utils/options.js and substitute the contracts addresses with new ones.

image

Disclaimer

All the work contained in this repository is provided ​“AS IS”. Developer makes no other warranties, express or implied, and hereby disclaims all implied warranties, including any warranty of merchantability and warranty of fitness for a particular purpose. The code should not be used in a production environment.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT