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: 2 months ago
JSON representation
A guide for coding and deploying a basic Polygon (MATIC) smart contract!
- Host: GitHub
- URL: https://github.com/alchemyplatform/polygon-smart-contract-tutorial
- Owner: alchemyplatform
- Created: 2022-04-04T20:56:57.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-04-11T05:35:07.000Z (almost 3 years ago)
- Last Synced: 2024-11-16T16:37:37.639Z (2 months ago)
- Topics: alchemy, ethersjs, hardhat, matic
- Language: JavaScript
- Homepage: https://docs.alchemy.com/alchemy/tutorials/how-to-code-and-deploy-a-polygon-smart-contract
- Size: 368 KB
- Stars: 13
- Watchers: 3
- Forks: 10
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-web3-tools-and-dapps - Polygon Smart Contract Tutorial - Get started quickly on creating Polygon smart contracts with Alchemy. This guide is perfect for Solidity beginners. (dApps directory / Smart Contract Templates)
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.