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.
- AI Agents on the Blockchain
- Table of Contents
- Getting Started
- How to
- Resources
- License
- Acknowledgements
This repository contains two projects:
sdk: a project that demonstrates how to use the VeChain SDK to interact with the blockchainagent: 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
-
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.2curl -fsSL https://bun.com/install | bashRestart your terminal or source your user profile. Then check the version of bun:
bun --version
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.jsIf 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.
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
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.
Run the development server with hot reloading
elizaos devBy default the development server runs at http://localhost:3000
ℹ️ Alternatively
You can start the development server without hot reloading:
elizaos startWhen using
start, you need to rebuild after you make changes to the code:rm -rf dist 2>/dev/null || rimraf dist bun run build
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.jsYou can also find more information about the VeChain SDK in the VeChain SDK documentation.
You can run the VeChain SDK interactively in the node CLI:
cd sdk
npm install
nodeThen 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');- Thor client: https://github.com/vechain/thor
- VeChain API documentation: https://mainnet.vechain.org
- VeChain SDK documentation: https://docs.vechain.org/developer-resources/sdks-and-providers/sdk
- VeChain SDK examples: https://github.com/vechain/vechain-sdk-js/tree/master/examples
- VeChain Faucet (free VET & VTHO in testnet): https://faucet.vecha.in
- VeWorld Wallets for iOS, Android and Chrome: https://www.veworld.com
- VeBetter DAO: https://vebetter.com
- VeBetter Grants: https://vebetter.com/grants
- ElizaOS Documentation: https://docs.elizaos.ai
- ElizaOS Plugins: https://github.com/elizaos-plugins
- Workshop slides: https://github.com/vechain/ucd-workshop/blob/main/.github/presentation.pdf
This project is licensed under MIT License.
Special thanks to the following contributors ❤️
and the following projects and organizations: