Web3 Functions enable you to connect the on and off-chain worlds:
- On-chain is the smart contract that you want to automate and control using your Web3 Function.
- Off-chain is your Web3 Function which can access any APIs you need and run your custom logic to determine if your smart contract should execute and what data to pass to it.
Linking the two is your Web3 Function Task - where you configure what triggers your Web3 Function to run and the target smart contract you want it to control.
You should already have the smart contract that you want to control so let's dive into how you create your Web3 Function.
git clone https://github.com/gelatodigital/web3-functions-hardhat-template.git
cp .env.example .env
PRIVATE_KEYis optional, and only needed if you wish to deploy contracts or create a task from the CLI instead of the UI
ALCHEMY_ID= // <= Your Alchemy key
PRIVATE_KEY= // <= Your Private key