How to run the frontend:
- Node.js > 12
- Yarn Classic, aka Yarn v1, you can install it using this guide. If you are using macOS a simple
brew install yarn
should work.
On a terminal, install all the dependencies:
cd contract
yarn install
yarn compile
On a terminal
cd contract
yarn exec hardhat node
This command launch an HTTP and WebSocket JSON-RPC server @ http://127.0.0.1:8545/
, you can use it as Web3 Provider on Remix.
On another terminal, deploy it
cd contract
yarn deploy
- An Alchemy account with a valid project on a Testnet (I suggest Mumbai Polygon testnet).
- An account with some funds on the chain selected before, if you choose Mumbai you can obtain them on the official faucet
- The choosen testnet available as Network in MetaMask, you can add Mumbai Testnet from here. (You can find a longer guide here)
- Rename
contract/.env.example
incontract/.env
and put in it theAPI_URL
that can be found in the Alchemy Dashboard. - Export your MetaMask private key and put it in the
PRIVATE_KEY
field in the.env
file - Uncomment the
mumbai
part incontract/hardhat.config.js
- Run
yarn deploy:testnet
On terminal:
cd frontend
yarn install
yarn start
You can now visit http://localhost:3000/
cd frontend
docker build -t blockchain-frontend .
docker run -p 8000:80 blockchain-frontend:latest
You can now visit http://localhost:8000/
- Launch a local node, as described here
- Deploy the contract on a local node, as described before
- Connect MetaMask to
http://127.0.0.1:8545/
- Import an Account on Metamask from the private key printed on terminal in step
1
, as described here - Open
contract\artifacts\contracts\NFTSwap.sol\NFTSwap.json
and paste the content intofrontend\src\contracts\contract-abi.json
. - Edit
frontend\src\utils\blockchain.js
withCONTRACT_ADDRESS
obtained in point2