Getting started

Overview

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.

1) Clone the Web3 Function Hardhat Template

git clone https://github.com/gelatodigital/web3-functions-hardhat-template.git
cd web3-functions-hardhat-template

or use the template on Github's UI.

2) Install dependencies

yarn install

3) Copy the example .env file

cp .env.example .env

4) Fill in your Alchemy & private key for local testing

Note: PRIVATE_KEY is 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

Last updated

#272: W3F context including gelato args

Change request updated