This quickstart covers two things:
- Deploying an AI app to the Galadriel devnet
- Calling your deployed AI app and viewing the results
A Galadriel devnet account. We recommend creating a new EVM account for development purposes. Some devnet tokens on the account you are using. node and npm installed on your machine.
- devnet tokens Get yourself some devnet tokens from the faucet.
- Clone repository Clone the repo that contains Galadriel example contracts and the oracle implementation.
git clone https://github.com/bild96/smart-agent.git
cd smart-agent/contracts
- Setup environment Use the ||template.env|| file to create a ||.env|| file:
# Starting in repo root
cp template.env .env
Then, modify the ||.env|| file:
- Set ||PRIVATE_KEY_GALADRIEL|| to the private key of the account you want to use for deploying the contracts to Galadriel devnet.
- Set ||ORACLE_ADDRESS|| to the current devnet oracle address provided by Galadriel team: 0x4168668812C94a3167FCd41D12014c5498D74d7e.
- Install dependencies Install the dependencies using npm:
# In repo root -> /contracts
npm install
- Deploy contract to devnet The quickstart contract can be deployed with a simple script:
npm run deployQuickstart
The output of the script will show the deployed contract address. Store this and export it in terminal to call the contract later:
# Replace with your own contract address
export QUICKSTART_CONTRACT_ADDRESS=0x...
Prerequisites:
-
Youβve deployed the quickstart contract in the previous step, and stored the contract address. Execute the following command to run a script that calls the deployed contract:
npm run callQuickstart
The script will interactively ask for the input (DALL-E prompt: what image should be generated) and then call the contract with the input. The output, when ready, will be printed to the console. If this step fails, make sure you have set the ||QUICKSTART_CONTRACT_ADDRESS|| environment variable to the address of your deployed contract.
π Youβre done! Youβve successfully created and called your own on-chain AI app.
π§βπ» Bild96
ποΈ ETHGlobal HackFS Β© 2024