LinkLabs (ElizaOS+Functions)
  • Chainlink Workshop: Use AI agent to mint an NFT gift
    • Use an AI agent to interact with Blockchains
  • 1. Create table in Supabase
  • 2. Deploy the GetGift.sol
  • 3 Register A CL Functions Subscription
  • 4. Prepare DON hosted secrets
  • 5. Setup and start Eliza agent
  • 6. Use twitter client
Powered by GitBook
On this page
  • This Gitbook URL
  • What will we do in this workshop?
  • What is an AI agent?
  • What is Eliza framework?
  • What is Chainlink Functions?
  • Why does our AI Agent need Chainlink Functions?
  • High-level Architecture
  • Exercise
  • Prerequisites & Setup
Export as PDF
  1. Chainlink Workshop: Use AI agent to mint an NFT gift

Use an AI agent to interact with Blockchains

How to use an AI agent to mint an NFT in a decentralized manner with Chainlink Functions

Next1. Create table in Supabase

Last updated 3 days ago

This Gitbook URL

What will we do in this workshop?

In this Workshop, we'll guide you through the rapid development of a project where users can effortlessly receive an NFT gift by simply reply the tweet under tweeting their request.

We will use the Eliza framework to build an AI Agent specifically designed to interact with users on Twitter. This agent will listen for natural language inputs from users' tweets and once a request tweet is detected, it will process this input using an LLM (Large Language Model) which acts as the "brain" behind the operation.

The AI Agent will then trigger an action on-chain - the minting of an NFT to the the address that is mentioned in the tweet.

This is where Chainlink Functions comes into play, serving as the crucial bridge between off-chain data (the user's tweet) and on-chain actions (minting and transferring an NFT).

Chainlink ensures that the on-chain transaction is secure and verifiable, providing a decentralized execution environment that is necessary for trust in blockchain operations.

By completing this workshop you will learn to:

  • Set up and configure an Eliza AI Agent to monitor Twitter for user inputs.

  • Use Chainlink Functions to extend the agent's powers to the blockchain, ensuring that the NFT minting and transfers are done securely and transparently.

By the end of this workshop, you'll have a demo AI and Web3 dApp where a simple tweet can lead to the creation and delivery of a personalized, immutable and verifiable NFT.

What is an AI agent?

An AI Agent is an AI entity designed to autonomously perform tasks that typically require human intelligence. These agents can learn from their environment, make decisions, and execute actions based on their design and data inputs.

In the broader context, AI Agents have been employed in numerous scenarios such as customer service bots, personal assistants like Siri or Alexa, and even in more complex systems for data analysis, automated trading, and content generation.

When it comes to blockchain applications, AI Agents can interact with smart contracts to execute transactions automatically. For instance, they can manage liquidity pools on decentralized exchanges, automate governance decisions in DAOs (Decentralized Autonomous Organizations), or even create and manage NFTs (Non-Fungible Tokens) based on user inputs.

This intersection of AI and blockchain opens up possibilities for more dynamic, responsive, and autonomous systems within the crypto space, where AI Agents can analyze market data to make trading decisions or manage digital assets based on real-time social media sentiment analysis.

What is Eliza framework?

The Eliza framework originated from the need for flexible AI personalities in various applications. Eliza allows developers to create AI Agents with distinct characters and behaviors.

Its architecture is built around a rich ecosystem of clients and plugins. Clients in Eliza serve as interfaces for agents to interact with platforms like Twitter, Discord, or Telegram, handling platform-specific communication protocols. Plugins extend the agent's functionality, enabling them to perform tasks like financial analysis, social media interaction, or even blockchain operations.

This modular approach makes Eliza highly adaptable, allowing developers to tailor agents for specific tasks without extensive coding. Being open-source, Eliza benefits from community contributions, ensuring continuous improvement and integration with emerging technologies.

What is Chainlink Functions?

Chainlink Functions can also be used for more advanced applications, such as automated market-making strategies in DeFi or providing secure randomness for blockchain games.

Why does our AI Agent need Chainlink Functions?

AI Agents, while powerful, operate within the constraints of their programming and the data they are trained on, often described as a "black box" due to the opaque nature of large language models (LLMs). In some cases, it is difficult to tell if actions are made by LLM or a human behind it.

When these agents need to interact with blockchain systems, particularly in scenarios involving financial transactions or asset management, there's a critical need for trust and verifiability. Chainlink Functions provide this by ensuring that any off-chain computation or data retrieval is executed in a decentralized and verifiable manner.

This means that even if an AI Agent decides to execute a transaction based on external data, the logic and data integrity can be independently verified by the blockchain network. This is crucial for maintaining security and trust in operations like asset transfers or smart contract executions where stakes are high, ensuring that the actions of AI Agents are not only efficient but also transparent and secure.

High-level Architecture

Exercise

Prerequisites & Setup

  • AVAX and LINK tokens on Avalanche Fuji

  • One LLM API key

  • One Supabase account

  • Avalanche Fuji RPC URL

  • Have the the following Environment Variable values :

    • AVALANCHE_FUJI_RPC_URL PRIVATE_KEY SUPABASE_API_KEY

is an open-source, multi-agent simulation framework that facilitates the creation, deployment, and management of AI Agents. ElizaOS was developed by the DAO created by , a leading VC that has had success in Web2 and Web3 markets. The DAO was called AI16Z but has recently been renamed to ElizaOS.

is a decentralized computing service that allows smart contracts to securely interact with off-chain data and computational resources. It serves as a bridge between blockchains and external APIs or cloud services, enabling smart contracts to perform tasks that are not natively supported by the blockchain itself, such as retrieving real-time data, performing complex computations, or interacting with external systems.

The infrastructure of Chainlink Functions (decentralized oracle network), ensuring that data and computations are tamper-proof and reliable. This service is particularly useful in scenarios where smart contracts need to access real-world data for decision-making, like weather data for insurance policies, or price feeds for financial contracts.

NodeJS v23+ ()

Install pnpm globally ()

You can request AVAX and LINK tokens from .

Get google Gemini API key .

Go the Supabase , sign up to create a free account. In the next section we will walk you through creating a Supabase "organization" and create projects under it.

Git clone

Create a or account. Get https endpoint for avalanche fuji testnet. These can be a bit more stable - but if you're in a hurry use the public Avalanche Fuji RPC Url:

ElizaOS
AI16Z
Chainlink Functions
leverages the Chainlink DON
https://nodejs.org/en/download
https://pnpm.io/installation
Chainlink Faucets
here
website
https://github.com/smartcontractkit/Eliza-Twitter-Chainlink-Functions
Infura
Alchemy
https://api.avax-test.network/ext/bc/C/rpc
Page cover image
Gitbook URL
High Level Architecture of This Workshop