A repository with a simple official example that uses the alchemy SDK
Copy the .env_
file to .env
and fill in with your Alchemy account details for Goerli alongside with your ethereum private key.
# Alchemy API key
# API_KEY = ""
# Alchemy API full url
# API_URL = ""
# Ethereum account private key
# PRIVATE_KEY = ""
# Etherscan api key, used for publishing contracts
# ETHERSCAN_API_KEY = ""
# Contract address to interact with. Update after deployment
# CONTRACT_ADDRESS = ""
npm init
npm install --save-dev hardhat
npx hardhat
npm install dotenv --save
npm install --save-dev @nomiclabs/hardhat-ethers "ethers@^5.0.0"
# Runner script:
sh scripts/run_goerli_deployment.sh
# Compile
npx hardhat compile
# Deploy
npx hardhat run scripts/deploy.js --network goerli
# Etherscan publish
npm install --save-dev @nomiclabs/hardhat-etherscan
npx hardhat verify --network goerli DEPLOYED_CONTRACT_ADDRESS 'Hello World!'
# Run interact script
npx hardhat run scripts/interact.js