• Stars
    star
    153
  • Rank 243,368 (Top 5 %)
  • Language
    JavaScript
  • Created almost 3 years ago
  • Updated almost 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An NFT Marketplace built with NextJS, Hardhat and Solidity

🖼️ NFT Marketplace

https://img.shields.io/badge/made%20with-hardhat-yellow https://img.shields.io/badge/made%20with-nextjs-blue

This is a fullstack DApp NFT Marketplace built as a study project to learn more about blockchain and smart contract development.
Made with NodeJS, Hardhat, Solidity, ReactJS, NextJS and Vercel.

Demo

Demo

Checkout the live demo: https://nft-marketplace-markkop.vercel.app/


Market basic actions

You can create (mint) new tokens, uploading their image and metadata on IPFS using Pinata.
If you've created or bought an NFT, you may also sell it by setting a price and paying a listing fee.
When buying an NFT, the price will be transferred to the seller and the listing fee to the NFT Marketplace owner.
It's also possible to cancel a market item, transferring it back to the owner.


Lean NFTs Visualization

There are only two pages to view market's NFTs:

  • Market Page

Shows all NFTs that are available to be bought.
This page will show NFTs even if the user doesn't have the Metamask extension or isn't connected to the dapp.

NFTs available
NFTs available


  • My NFTs Page

Show all account's created, owned and on sale NFTs.
Here you keep track of NFT's you've created and check for how much they've been last sold and their current owner.
You can also list your current owned NFTs or cancel existing ones.
To view this page, you must have Metamask installed and have it connected to Polygon's Testnet network.

Created and owned NFTs
Created and owned NFTs


User Experience

If the Metamask extension is not detected on "My NFTs" page, a message with a download button will be prompted to the user.

Download metamask message and buttons Download metamask message and buttons


If the user has the extension, but is not connected, a message and a connect button will be shown.

Connect wallet message and button
Connect wallet message and button


If the Polygon's Testnet network is not detected, a message and an ADD/CHANGE network button will be available.

Add/Change Network message and button
Add/Change Network message and button


If the connected account is low on balance of Matic tokens, a message with a faucet link is provided.

A low on balance message with a faucet link
A low on balance message with a faucet link


When changing account or network, the page will refresh updating only the affected components.

Components update on account change
Components update on account change


When performing an action, a loading feedback is shown and the card updates to its new state automatically.

Buying an NFT and its feedbacks
Buying an NFT and its feedbacks

Easy Deployment

Frontend is automatically deployed using Vercel's Github integration, but contracts have to be manually deployed to keep a better control on them.
However, new deployed contract addresses can be updated on the frontend simply by running a script that modifies Vercel's project environment variables and triggers a new frontend deployment.

How to run

  • Copy .env.local.example to .env.local and fill it with environment variables
  • Run npm run node to start a local EVM blockchain testnet
  • Run npm run setup to deploy NFT and Marketplace contracts and perform some initial actions to the local blockchain
  • Run npm run dev to start frontend application
  • Make sure to use Localhost 8545 as the Metamask's network
  • Make sure to import local Account #0 and #1 into Metamask accounts.

How to deploy

  • Frontend is deployed automatically on main branch using Vercel's github integration
  • Set ACCOUNT_PRIVATE_KEY in .env.local and send it some Polygon's Testnet Matic tokens
  • Run npm run deploy:mumbai to deploy contracts to Polygon`s Testnet (Mumbai)
  • Optional: do the same for ACCOUNT2_PRIVATE_KEY env and run npm run setup-marketplace:mumbai to setup the marketplace with existing tokens and sales.
  • Run npm run env to update Vercel's environment variables with the new deployed contract addresses.*
  • Make sure to use Polygon Testnet Mumbai as Metamask's network

* You'll need to create the envs on Vercel first

Development Challenges

* They're usually caused by incorrect contract addresses and wrong default gas values

Wishlist

  • Refactor frontend code to accept other networks besides Mumbai
  • Lazyload for NFTs images and metadata
  • Add support for custom ERC20 tokens as payment (started on #2)

Troubleshooting

Mumbai marketplace setup command is breaking with a 'estimate gas failed' error

Try changing hardhat.config.js mumbai gas values.
I'm using the ones I've found here:
https://forum.moralis.io/t/deploy-to-polygon-matic-mumbai-fails/700

Nouce is too high

Reset your Metamask account transaction history.
Find out more on:
https://medium.com/@thelasthash/solved-nonce-too-high-error-with-metamask-and-hardhat-adc66f092cd

References

More Repositories

1

corvo-astral

A Discord Bot that serves as an Wakfu helper
TypeScript
28
star
2

yt-dlandcut

Download and cut an Youtube video by providing its url and the time range
JavaScript
26
star
3

habiticaScripts

A script suite with customizations for Habitica's website
JavaScript
11
star
4

guilds-openzeppelin-defender

A Web3 demo game that uses OpenZeppelin's Defender features
TypeScript
6
star
5

fullstacking

A full-stack challenge described step-by-step while learning
JavaScript
6
star
6

gather-town-websocket-examples

Examples on how to interact with Gather.town Web Socket API
TypeScript
5
star
7

unity-web3-spaceFPS

A demo game for testing Moralis Unity SDK Web3 integration
C#
3
star
8

nest

My personal microservices collection
JavaScript
3
star
9

essence-helper-jovo

A voice app that provides information about ZenithVR MMORPG
TypeScript
2
star
10

codeSnippets

Some code snippets that could be useful someday
JavaScript
2
star
11

click-limiter

Example project on how to use simple debounce e throttle functions in Javascript/VueJS
Vue
2
star
12

markkop-defi

A fullstack DeFi application made with Solidity, Hardhat and Nextjs
TypeScript
2
star
13

habiticaStatusReporter

A bot that shares the situation of a given Habitica character on Twitter
JavaScript
2
star
14

Multiple-Playlist-deleter

A simple app to delete multiple spotify playlists at once.
TypeScript
2
star
15

werewolf-moderator-helper

An web app to help moderators to keep track of Werewolf/Mafia party games
TypeScript
1
star
16

TicTicPouTry3

C#
1
star
17

web-ar-testing

A test project to check how WebAR with AR.JS and A-Frame works
JavaScript
1
star
18

discover-your-noise

Scrap EveryNoise.com to discover the most dominant genres from a Spotify playlist
JavaScript
1
star
19

retrocade-earnings-checker

A web app that checks how much you've earned so far while holding Retrocade tokens
JavaScript
1
star
20

ballot-with-time

The Solidity by Example ballot code, but with a time to vote implementation
Solidity
1
star
21

codecon-gather-frontend

TypeScript
1
star
22

essence-helper-alexa-skill

An Alexa Skill that provides information about ZenithVR MMORPG
TypeScript
1
star
23

FlaskReact

A To Do app made in React (JavaScript) and Flask (Python)
JavaScript
1
star
24

decentraland-scene-test

A testing scene for Decentraland that retrieves the user's pokemon name
TypeScript
1
star
25

cs-balancer

An algorithm to match Customers and Customer Success made in Node and Ruby
JavaScript
1
star
26

drift-bot

A Discord Bot that retrieves information about Zenith VR MMORPG
TypeScript
1
star
27

numbers-guide

An Alexa Skill that gets numerology information from dates, numbers and names
TypeScript
1
star
28

caesarCipher

A decipher script which gets a secret message from an api and posts it deciphered
JavaScript
1
star
29

freecodecamp-blockchain-smart-contract-course

The code I've used in the FreeCodeCamp's Blockchain and Smart Contract Development course
Solidity
1
star
30

essence-helper-google-action

A Google Action that provides information about the Zenith VR MMORPG
TypeScript
1
star
31

product-scrapper-notifier

A product scrapper that notifies when a product is available
TypeScript
1
star