-
Open project in terminal:
cd project/path
-
Use specified node version:
nvm use
- The
.nvmrc
file contains the used node version. - You can check the node's version in
package.json
file,"engines": { "node": "^14.20.0" }
.
- The
-
Intall packages:
npm install
-
Configure your environment variables
-
Create env file:
touch .env
-
Add your mnemonic phrase (12 words).
-
Add your provider URL.
- [Recommended] use 3rd party service like Infura -- after you create new account or login, go to endpoints tab, choose the network and protocol you want to connect, copy your personal URL, and add it to the env.
- [Another way] setup a local node in your machine to connect the network (this way is panic).
You have to get something like that:
MNEMONIC="cost spirit party essay insane festival front woman today desk pioneer wolf" PROVIDER_URL="https://goerli.infura.io/v3/a5aac9c4375547a8a7a34dc4dc41c279"
-
-
Test that everything is going well:
npm run test
-
Deploy the contract on connected network (open VPN to avoid country blocked error)
npm run deploy
-
Copy deployed contract address, and go to Remix Web IDE
-
Open DEPLOY & RUN TRANSACTIONS tab
-
Past it in the second sectin at OR section
-
Copy contract source code
Lottery.sol
, and past it in new contract file in File Explorer tab. -
Back to DEPLOY & RUN TRANSACTIONS tab, and click on At Address button to compile the contract and get its ABI.
-
Go to Deployed Contracts section, and test the App!
-
Don't forget to add Wei value on each payable transaction.
npm run lint
-
It will format the code by Prettier, and lint the code by Solhint.
-
Solhint linter's configuration placed in
package.json
>"solhint"
-
Prettier formatter's configuration placed in
package.json
>"prettier"