project screenshot 1
project screenshot 2
project screenshot 3

NPC 6551 library

A TypeScript open-source framework leveraging EIP 6551, OpenAI API, and Tribes messenger to bring an NFT to life (i.e. NPC). The NPC's characteristics stem from its ERC721 metadata and is able to chat and transact with other users or NPCs

NPC 6551 library

Created At

ETHGlobal Waterloo

Project Description

This project revolves around creating a Non-Fungible Token (NFT) - an autonomous, interactive character that we like to call a Network Playable Character (NPC). The main feature of this project is that it brings NFTs to life by allowing them to interact and transact with other users or NPCs autonomously. This brings the NFTs to life, giving them personality and other unique characteristics which serve as defining features.

Our NPC is defined based on the ERC721 metadata associated with the NFT. Each NFT has unique metadata that distinguishes it from other NFTs. We extracted this metadata to shape the personality profile of our NPC, giving each NPC a distinct identity.

In terms of interaction capability, our NPC can communicate via Tribes.xyz Messenger, a platform for decentralized and secure communications. This provides a means for the NPC to chat with, react to, and transact with other users or NFTs. This helps to create a more immersive and dynamic NFT experience.

Our NPC can also execute transactions with other wallets using Ethereum Improvement Proposal (EIP) 6551. This feature allows our NPC to autonomously tip other users or NPCs, thereby encouraging interaction and engagement within the community.

In terms of memory, we have implemented a unique mechanism to help the NPC remember past messages and interactions. We have used two different databases - SQLite and a vector database called ChromaDB. SQLite allows us to store and search messages by the NPC, providing an extensive record of past interactions. ChromaDB is used to store embeddings and retrieve semantically similar messages by the NPC.

To avoid getting rate-limited by the OpenAI API, which we use to bring our NPC to life, we used a local open-source model to generate these embeddings. This reduces the load on the API and ensures a seamless interaction experience.

The entire project is open-source and available for others to collaborate

How it's Made

Our project harnesses a combination of technologies to bring our NFT-based Network Playable Characters (NPCs) to life:

ERC 721: This is a well-established NFT standard that we employ to instantiate our NPCs. We build distinct personality traits derived from the ERC721 metadata.

EIP 6551: This Proposal allows us to equip each NPC with an Ethereum-based wallet, expanding their ability to interact within the Ethereum ecosystem.

Tribes.xyz: We utilize Tribes' protocol to enable communication and transction between users and NPCs.

OpenAI: Our NPCs are endowed with LLM capabilities using GPT-3.5, made possible by OpenAI. This allows the NPCs to engage in meaningful dialogue and develop over time.

Sqlite3: We use this local database to store historical messages, enabling a form of 'memory' that allows our NPCs to search and recall previous interactions.

ChromaDB: Working in conjunction with Sqlite3, ChromaDB, a vector database, allows for semantic search. This dual-database architecture effectively gives our NPCs an 'infinite memory' capacity.

In terms of the programming languages used in the project, it's predominantly written in TypeScript with some Python to easily query and embed docs in ChromaDB.

background image mobile

Join the mailing list

Get the latest news and updates