Full article guide on Etherscan API docs.
-
Clone this repository using
git clone https://github.com/0xV4L3NT1N3/interacting-smart-contracts.git -
In a terminal, run
npm installto install the required dependencies -
In
script.js, replace thenode URLandprivate keyvariables with your own.
You can create a free Infura/Alchemy account for node access, and generate a private key from Metamask
Remember, private keys and node API keys are sensitive information, do not commit them to version control. Better yet use an environment variable.
- Run this code using the command
node script.js