Skip to content

CheesecakeLabs/poketoken-article

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NFT

Project description

POC Project of a Pokemon marketplace using NFT.

With this project the client will be able to:

  1. Create random pokemons
  2. Setting prices for selling pokemons
  3. Buying pokemons that are open for sale.

You can read more about it on this blogpost: Creating a pokemon marketplace using NFT

Main Stack

  1. Solitidy (Smart contracts)
  2. Node.js (Backend)
  3. React (Frontend)
  4. OpenZeppelin (Solidity Reusable smart contracts)
  5. Hardhat (Ethereum development environment)
  6. Ethers (Ethereum blackchain interaction package)

This project also uses

  1. PokeAPI for generating random pokemons
  2. Pinata For IPFS management

Running locally

To run the project locally you'll need to

  1. Install the dependencies
  2. Compile the smart contracts and copy the contract to the folder that is served by the backend
  3. Start a network node and deploy the contract to it
  4. Create a Pinata account
  5. Fill the environment variables and Start the project's backend and frontend

Installing dependencies

  1. Install Node.js
  2. Install Yarn by running $ npm install -g yarn
  3. Install the rest of the dependencies by running $ make install-dependencies on the project root folder

Compiling and serving the smart contract

You can compile the smart contract and copy it for the backend / frontend usage with a single command

$ make compile-and-copy

Starting a node and deploying the contract

To start a network node you need to execute the command below on the terminal:

$ npx hardhat node

To deploy the smart contract to this node on another terminal window, execute:

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

Creating a Pinata account and creating API keys

Creating a Pinata account is free and very intuitive, after doing that you'll need to create API keys in this link

Filling environment variables and starting the front and the back

Rename the files: web/client/.env.example -> web/client/.env web/.env.example -> web/.env

Fill the Pinata API Keys data on web/.env

On the web folder execute the command below to start a backend and a frontend instances on your local environment

$ yarn dev

Deploying to another network

To deploy the contract to a live network you'll need:

  1. An account with assets
  2. An Alchemy Key (Optional)
  3. Create a network on hardhat.config.js with the account's private key
  4. Execute the deploy script pointing to the desired network e.g. npx hardhat run scripts/deploy.js --network rinkeby

This project's hardhat.config file has a Rinkeby Network pre configured, where you only need to set the ALCHEMY_API_URL and the WALLET_PRIVATE_KEY. You can read more about setting networks on https://hardhat.org/hardhat-network/

Testnet

This contract is currently deployed to the Rinkeby testnet.

Other scripts

  • Testing $ npx hardhat test

Demos

  • Create random pokemons

Creating pokemons demo

  • Setting prices for selling pokemons

Setting pokemons for sale demo

  • Buying pokemons that are open for sale.

Buying open for sale pokemons demo