Skip to content

This repository was created for the "AI Agents on the Blockchain" workshop in UCD

Notifications You must be signed in to change notification settings

kgapos/ucd-workshop-completed

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI Agents on the Blockchain

This repository was created for the "AI Agents on the Blockchain" workshop in UCD.

Hi there! 👋

In this workshop we will learn how to interact with the VeChain blockchain using the VeChain SDK. Armed with this knowledge we will build an AI Agent on ElizaOS that understands blockchain related user prompts and interacts with the blockchain in real time.

By the end of the workshop you will have a working agent that answers prompts like what is my account balance? and what is the last transaction for account 0xabcd...? and you will know how to extend its capabilities to answer even more complex prompts.

Table of Contents

Getting Started

This repository contains two projects:

  • sdk: a project that demonstrates how to use the VeChain SDK to interact with the blockchain
  • agent: a project that demonstrates how to build an AI Agent on ElizaOS that understands blockchain related user prompts and interacts with the blockchain in real time

Prerequisites

  • A laptop with internet connection

  • OpenAI API key, a temporary key will be provided to workshop attendees

  • A code editor, such as VS Code or equivalent

  • NodeJS, this workshop was tested with v24.11.1

  • Bun, this workshop was tested with v1.3.2

    curl -fsSL https://bun.com/install | bash

    Restart your terminal or source your user profile. Then check the version of bun:

    bun --version

SDK setup

Open your favorite terminal and run the following commands:

# Navigate the the `sdk` directory
cd sdk
# Install the project dependencies, such as the VeChain SDK
npm install 
# Run the `readBlocks.js` example script
node examples/readBlocks.js

If you see the latest block data printed to the terminal at this point, you are ready to go!

Feel free to explore and run more example scripts.

Agent setup

1. Install the ElizaOS CLI and project dependencies

Open your favorite terminal and run the following commands:

# Navigate to the `agent` directory
cd agent
# Install the ElizaOS CLI
bun i -g @elizaos/cli
# Check the version of the ElizaOS CLI. This workshop was tested with `1.6.4`
elizaos --version
# Install the project dependencies
npm install

ℹ️ Optional

Install the twitter plugin for ElizaOS (requires Twitter API key)

elizaos plugins add twitter

2. Configure your OpenAI API key

Copy the agent/.env.example file to agent/.env and replace the OPENAI_API_KEY with your OpenAI API key.

ℹ️ A temporary key will be provided to workshop attendees.

3. Run the agent

Run the development server with hot reloading

elizaos dev

By default the development server runs at http://localhost:3000

ℹ️ Alternatively

You can start the development server without hot reloading:

elizaos start

When using start, you need to rebuild after you make changes to the code:

rm -rf dist 2>/dev/null || rimraf dist
bun run build

How to

Learn more about the VeChain SDK

The sdk/examples directory contains a variety of scripts that demonstrate how to use the VeChain SDK to interact with the blockchain. You can run these scripts with node like so:

cd sdk/examples
node readBlocks.js

You can also find more information about the VeChain SDK in the VeChain SDK documentation.

Run the VeChain SDK interactively

You can run the VeChain SDK interactively in the node CLI:

cd sdk
npm install
node

Then import the VeChain SDK:

const { ThorClient } = await import("@vechain/sdk-network");

Then run any javascript code you want, for example:

var thor = ThorClient.at('https://mainnet.vechain.org');
await thor.blocks.getBlockCompressed('best');

Resources

  1. Thor client: https://github.com/vechain/thor
  2. VeChain API documentation: https://mainnet.vechain.org
  3. VeChain SDK documentation: https://docs.vechain.org/developer-resources/sdks-and-providers/sdk
  4. VeChain SDK examples: https://github.com/vechain/vechain-sdk-js/tree/master/examples
  5. VeChain Faucet (free VET & VTHO in testnet): https://faucet.vecha.in
  6. VeWorld Wallets for iOS, Android and Chrome: https://www.veworld.com
  7. VeBetter DAO: https://vebetter.com
  8. VeBetter Grants: https://vebetter.com/grants
  9. ElizaOS Documentation: https://docs.elizaos.ai
  10. ElizaOS Plugins: https://github.com/elizaos-plugins
  11. Workshop slides: https://github.com/vechain/ucd-workshop/blob/main/.github/presentation.pdf

License

This project is licensed under MIT License.

Acknowledgements

Special thanks to the following contributors ❤️

and the following projects and organizations:

About

This repository was created for the "AI Agents on the Blockchain" workshop in UCD

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published