Follow the full written tutorial here.
Follow the full video tutorial here.
npm install
- Rename
.env-example
to.env
, and populate the variable values.- Grab
API_URL
from www.alchemy.com by setting up a Polygon Mumbai testnet app. - For
PRIVATE_KEY
, use your Ethereum wallet address's corresponding private key. - You can leave
CONTRACT_ADDRESS
blank until you deploy withnpx run scripts/sample-script.js
, then grab the address where you deployed your contract to. ALCHEMY_API_KEY
is very similar toAPI_URL
except you can remove the http or ws prefix.MATIC_URL
you can grab from www.alchemy.com but make sure your Alchemy app is a Polygon Mainnet app.
- Grab
- run
npx run scripts/sample-script.js --network mumbai
to deploy your contract to Mumbai testnet - run
npx run scripts/greet.js --network mumbai
to modify blockchain state by calling the Greet function on your smart contract. - Repeat those steps with
--network matic
to deploy and interact on Polygon (MATIC) mainnet chain.