Deploying Contracts
To deploy to your local hardhat environment, first start your local environment by running
and then in another terminal run
After every deployment, a copy of the deployment (contract address and abi) is copied to the hardhat_contracts.json file in the next-app/contracts folder
When you deploy to the hardhat network, Account #0 is the owner of the contract.
All 20 of the hardhat accounts created in your local hardhat environment are the same private and public keys for everyone. DO NOT send anything valueable to these accounts.
To deploy to another network, go to your hardhat.config.js file in the hardhat folder. Uncomment the network you'd like to deploy to.
Be sure to add your environment varables and only uncomment the node provider you'd like to use (ie. Alchemy or Infrua)
and run:
For example to deploy to the Mumbai testnet run:
Once you deploy to a network other than hardhat, go into your config.js file inside the next-app folder and change the NETWORK_ID and NETWORK_NAME to the network your Next App will interact with.
Now you will be able to test your deployed contract locally or when you deploy your Next App