Skip to content

Pif50/Progetto-Ethereum-Web3-di-Pier-Francesco-Tripodi

Repository files navigation

Progetto-Ethereum-Web3-di-Pier-Francesco-Tripodi

An NFT Contract will mint one of the four Houses of Hogwarts. This smart contract is develop whit web3.py on Goerli Testnet.

Notes for use:

  • For interact with the contract you will need some Ethers ($ETH) and some Link (LINK) to be able to pay the gas fees. You can get $ETH for free via a faucet. (Chainlink)

Framework e Tecnologie usate:

Installation

  1. Install Brownie, if you haven't already. Here is a simple way to install brownie.
pip install eth-brownie

Or, if that doesn't work, via pipx

pip install --user pipx
pipx ensurepath
# restart your terminal
pipx install eth-brownie
  1. Install ganache-cli
npm install -g ganache-cli
  1. Set your environment variables, if you want deploy to testnets

Set your WEB3_INFURA_PROJECT_ID, and PRIVATE_KEY environment variables.

You can get a WEB3_INFURA_PROJECT_ID by getting a free trial of Infura. At the moment, it does need to be infura with brownie. You can find your PRIVATE_KEY from your ethereum wallet like metamask.

You can add your environment variables to the .env file:

export WEB3_INFURA_PROJECT_ID=<PROJECT_ID>
export PRIVATE_KEY=<PRIVATE_KEY>

Then, make sure your brownie-config.yaml has:

dotenv: .env

How to deploy and iteract the Smart Contract from Back-end

brownie run scripts/deploy_and_create.py --network goerli
brownie run scripts/create_collectible.py --network goerli

Then:

brownie run scripts/create_metadata.py --network goerli
brownie run scripts/set_tokenuri.py --network goerli

If you want to interact with UI

Go to the folder called frontend and go to the file index.html and start the UI