how to talk to your Blockchain ... in English
introductionThe rise of blockchain technology, especially in the area of cryptocurrency has changed the way we conduct transactions online. Having more people but also enterprises utilizing this technology, the need for an "easy" way to interact with blockchains has become extremely important. Blockchain explorers offer a useful solution providing a very small window into the inner workings of cryptocurrency and other related technology.
While blockchain explorers can be powerful tools for exploring and understanding the blockchain, they do require a certain level of technical expertise and may not always offer a user-friendly interface or comprehensive features. The average laymen have to deal with technical complexity, lack of user-friendly interface, limited features and very often with speed- and performance issues.
the "AI" hypeSo-called Artificial intelligence (AI) has become one of the biggest hype topics in computer technology over the last 2 years. Voice assistants, self-driving cars, super chatbots such as ChatGPT and much more. AIs are already being used in many areas of our daily life and business. Many new applications are set to follow in the next couple of years.
the ideaWouldn't it be cool, to have an interface which allows you to talk to an existing Blockchain in English or any other language. Why not try to combine a Blockchain with one of the existing AI - LLM's?
the proof is out thereIn one of our previous blog entry, we mentioned the Austrian Air Quality Chain, which is a monitoring solution providing and storing air- and weather information. Due to the fact, that AQC chain stores much more than simple hashes and numbers, it is a prefect candidate for such an experiment.
In order to avoid a super slow system by querying the chain online, we decided to use a downloaded snapshot instead. Even the Viennese AQC - data for the last couple of years provided millions of entries.
Technology wise, we choose the LangChain framework. LangChain is a very comprehensive framework for developing applications powered by language models such as ChatGPT. It offers modules for LLM models, prompts, indexes, chains and agents, making development pretty easy and straightforward. For the sake of convenience and since everyone is talking about it, we also choose ChatGPT as the LLM (Large language model). LangChain comes with a long list of document loaders, indexes and corresponding text splitters which basically allows you to work with any type of data, from simple files, over databases up to web content and even YouTube videos.
Texts and pieces of texts can afterwards create so-called embeddings, which are vector representations of this data. Those embeddings can afterwards persistent stored in many different databases such as Chroma.
LangChain is available on PyPi, so to it is supposedly easy to install with pip. As it turned out, you have to tweak and config a little bit and even patch a couple of modules in order to make it work properly.