Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

https://github.com/alchemyplatform/polygon-smart-contract-tutorial

A guide for coding and deploying a basic Polygon (MATIC) smart contract!
https://github.com/alchemyplatform/polygon-smart-contract-tutorial

alchemy ethersjs hardhat matic

Last synced: 4 months ago
JSON representation

A guide for coding and deploying a basic Polygon (MATIC) smart contract!

Lists

README

        

# How to Code, Deploy, and Interact with a Polygon (MATIC) Smart Contract

Follow the full written tutorial [here](https://docs.alchemy.com/alchemy/tutorials/how-to-code-and-deploy-a-polygon-smart-contract).

Follow the full video tutorial here.

## Quickstart

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