paint-brush
Bridging AI and Blockchain: Developing a Plugin for ChatGPTby@alex.slesarenko
968 reads
968 reads

Bridging AI and Blockchain: Developing a Plugin for ChatGPT

by Alex SlesarenkoJune 8th, 2023
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

ChatGPT Plugins are a new feature introduced by OpenAI to extend ChatGPT's capabilities by interacting with third-party applications. With plugins, ChatG PT can fetch real-time data such as blockchain node stats, block information, transactions, address balances etc. By integrating AI technology into the Ergo ecosystem, we can establish a seamless interface between blockchain data and users.
featured image - Bridging AI and Blockchain: Developing a Plugin for ChatGPT
Alex Slesarenko HackerNoon profile picture

In the era of AI, machine learning models like OpenAI's ChatGPT have endless applications. ChatGPT provides human-like responses to queries and can be extended with plugins.


This article outlines my journey developing a ChatGPT plugin that provides real-time blockchain data from the Ergo Node API. The goal is to equip ChatGPT with the ability to answer user queries related to data on the Ergo blockchain.


The Ergo Node API offers many possibilities for ChatGPT plugins, making it an appealing technology to experiment with. By integrating AI technology into the Ergo ecosystem, we can establish a seamless interface between the blockchain data and users.


This article discusses an experimental integration of ChatGPT and Ergo, with the aim of enhancing the Ergo ecosystem and providing a more interactive experience for users. Follow along to learn about my experiences and findings.

ChatGPT Plugins: A Brief Overview

Before we dive into the process of developing the plugin, it's crucial to understand what ChatGPT plugins are and their potential.

What are ChatGPT Plugins?

ChatGPT Plugins are a new feature introduced by OpenAI to extend ChatGPT's capabilities by interacting with third-party applications. These plugins enable ChatGPT to interface with APIs defined by developers (such as Ergo Node API), which enhances the model's abilities to perform a broad variety of tasks. With plugins, ChatGPT can fetch real-time data such as blockchain node stats, block information, transactions, address balances etc.


Developers interested in creating plugins need to expose one or more API endpoints, along with a standardized manifest file and an OpenAPI specification. This design allows ChatGPT to understand the functionality of the plugin and make appropriate API calls. For example, if a user asks about sync status of a node or the balance of an address, the model could call Ergo Node plugin API to generate a response.


Developers can register their plugins in the ChatGPT UI. For users to utilize a plugin, they must manually activate it in the ChatGPT UI.

Why ChatGPT Plugins?

ChatGPT plugins that can access blockchain data could bring significant value to blockchain users for several reasons:

  1. Real-time Blockchain Information: Blockchain users often need to track real-time information such as the status of transactions, balances of wallets, or the latest blocks mined. A ChatGPT plugin connected to blockchain APIs can retrieve this information and present it in an understandable manner.
  2. Simplified Blockchain Interactions: Interacting with blockchain data often involves complex commands and a technical understanding of blockchain concepts. A ChatGPT plugin could act as an intelligent intermediary, simplifying these interactions by enabling users to request information or perform actions using natural language.
  3. Education and Guidance: A ChatGPT plugin could serve as a learning tool, providing explanations of complex blockchain concepts and guiding users in their blockchain interactions.


By integrating blockchain data into conversational AI, ChatGPT plugins could make the blockchain more accessible to a broader user base.

From Blockchain to AI: Example Requests and Responses

In this section, we will explore how the ChatGPT plugin interacts with Ergo's blockchain through the Ergo Node API. We will examine some example requests and responses. The requests are made to a local node (localhost) using only public endpoints, so authentication is not required.


The plugin is named "Ergo Node Plugin (no auth)". Note that the plugin accesses real-time blockchain data at the time of writing this article, and most of it may change over time.


We start with some questions about ergo node, for example we can ask about version of software.

Nodes, can be configured to do mining.

Operation of Ergo blockchain can be tuned by miners changing key parameters. We can ask the plugin to retrieve their current values.

In case we don’t know the meaning of some parameter, we can just ask in the chat.

The plugin uses endpoints from OpenAPI specification configured in the plugin manifest. We can refer to a particular endpoint in the request.

And we can also ask to clarify the source of the data in the response.

At any time we can ask to perform a fresh request.

We can ask questions about any parameter from the /info response.

The plugin understands the context and can use any described API endpoint to service the request. And we can also ask it to show the output in a table.


This request uses special /peers/connected endpoint.


Next, because the plugin knows the specification of the endpoints, besides making requests it can also write a code to make those requests.

If we give it an address we can ask for a balance information

As we can see, it can also show available tokens (aka assets). What’s more, we can even ask it to show assets information.

Last but not least, we can always inquire about the Ergo Node endpoints that the plugin has access to. These endpoints provide the operations that the plugin can use to answer questions.

Getting Started with Ergo Node Plugin

The Ergo Node Plugin (at the time of this writing) is not available at OpenAI’s Plugin Store. In order to use it you need to run Ergo Node locally and then register the plugin in the ChatGPT UI.


Follow the following steps:

  • Clone Ergo Node source code with the version supporting Ergo Node Plugin (currently in a separate branch).
git clone [email protected]:ergoplatform/ergo.git ergo
cd ergo
git checkout -b ai-plugin
sbt assembly


This command will produce a new jar file in the target/scala-2.12/ directory.

  • Setup and run Ergo node using the assembled jar file following the instructions. Make sure node API is available at http://localhost:9053 (if you’ve configured a different port, use it here as well)
  • Register your plugin in the ChatGPT UI starting from the step 2 of the instruction.
  • Try examples above

Under the Hood: Implementation Details

Developing a ChatGPT plugin that effectively communicates with a blockchain API is no small task. Here, we'll delve into the details of the developed proof-of-concept prototype.

Understanding the Ergo Node API

The Ergo Node API is a powerful tool that allows developers to interact with the Ergo blockchain. The API is built on top of the Ergo node, which is a full node implementation of the Ergo protocol.


One of the key characteristics of the Ergo Node API is its flexibility. It provides a wide range of functionality, from basic blockchain queries to more complex operations like creating and signing transactions. This makes it a valuable tool for developers who want to build applications on top of the Ergo platform.


Another important characteristic of the Ergo Node API is its security. The API is designed to be used by trusted applications, which means that it requires authentication and authorization to access sensitive data. This helps to prevent unauthorized access to the blockchain and ensures that only trusted applications can interact with it.


However, the current version of the Ergo Node Plugin only supports endpoints that do not require authentication, moreover only public (”no auth”) get endpoints has been exposed to the plugin.

Developing the Plugin

The development process and step-by-step guide is describe in OpenAI developer documentation. Here is what has been done in Ergo Node to implement interaction with ChatGPT UI (see details in the corresponding PR):

  • A simplified OpenAPI (openapi-ai.yaml file) added with a small subset of API endpoint specifications (see the next section for discussion of why a separate specification is necessary)

  • plugin manifest configuration is added to .well-known/ai-plugin.json

  • special Routes implemented which are requested by ChatGPT UI:

    • [http://localhost:9053](http://localhost:9053)/.well-known/ai-plugin.json - to get manifest
    • [http://localhost:9053](http://localhost:9053)/openapi.yaml - to get specification of API endpoints
  • Additional Routes implemented for new get endpoints which was added in openapi-ai.yaml

  • Additional response headers configured for ErgoHttpService (CorsHandler used by Ergo node)

    With these changes Ergo Node is able to interact with ChatGPT UI and provide it with the actual blockchain data.

Overcoming Challenges: Navigating the Complexities of API Endpoint Design

When working with API endpoints, it's essential to realize that not all of them are equally suited for integration with ChatGPT plugins. In this section, I will share key insights and strategies that guided my endpoint design process.


My initial plan was to expose the entirety of the Ergo Node API to ChatGPT. However, this strategy proved unfeasible due to the context memory limitations of the GPT-4 language model I was using. Simply put, the Ergo Node API was too extensive, leading to an overflow of the context memory.


Consequently, in line with recommendations provided by OpenAI, I significantly streamlined the number of endpoints made available to the plugin. This step ensured that the context memory was used efficiently, thereby preventing an overload.


In addition to minimizing the number of endpoints, it was critical to refine their descriptions, adhering closely to OpenAI's best practices. This endeavor ensured that the AI model could effectively interpret and utilize the endpoint data. As such, the majority of descriptions were revised to be more specific, clear, and unambiguous.


Interestingly, I found that endpoint descriptions optimized for AI also tended to be more comprehensible to human users and vice versa. A vague description proves as challenging for AI to understand as it does for a human, hindering the effective use of the endpoint.


Lastly, I encountered challenges with some post endpoints, which were ineffective in retrieving the necessary data from the Ergo Node. Fortunately, this issue was resolved by incorporating the corresponding get endpoints, which ensured the smooth and effective retrieval of data.

Looking Into the Future of AI and Blockchain

With this blend of Ergo's blockchain and OpenAI's ChatGPT, we find ourselves at the precipice of a new opportunities in the realm of blockchain UX. The potential for future developments in this space is vast, and the scope for evolution and advancement is truly thrilling.

Expanding Conversational Scope

The current Ergo Node Plugin for ChatGPT enables users to pose queries about blockchain data and receive informative, AI-generated responses. As this technology evolves, we anticipate expanding the conversational scope of the plugin. This could mean developing the capacity for ChatGPT to understand and respond to more complex and nuanced queries, thereby making interactions even more sophisticated and human-like.

Real-Time Transaction Facilitation

A future direction could be the integration of transactional capabilities into the plugin, thus allowing users to perform real-time transactions directly through ChatGPT. This means users could instruct the AI to carry out blockchain transactions, adding an unprecedented level of convenience and ease of use.

Enhanced Security Measures

As we move forward, enhancing the security aspects of the plugin will be a priority. This could involve advanced authentication methods for user interactions, as well as sophisticated mechanisms to ensure the integrity and confidentiality of data.

Broader API Integration

The success of the Ergo Node plugin could pave the way for similar integrations with other blockchain APIs. This would open up a world of opportunities for AI-enhanced interaction with various blockchains, thereby enriching the overall blockchain ecosystem.

ChatGPT Plugins for Ergo Ecosystem DApps

With the increasing prominence of decentralized applications (DApps) in the Ergo ecosystem, there's a fascinating opportunity to develop specialized ChatGPT plugins for individual DApps. This could provide users with an intuitive, conversational interface for interacting with these applications, simplifying user experience and facilitating deeper engagement.

In conclusion

The development of the Ergo Node Plugin for ChatGPT is an interesting and promising step forward in the Ergo ecosystem technology space. As we continue to explore and innovate, we look forward to unlocking the full potential the AI and blockchain technologies hold for the future. The journey has just begun, and the prospects are limitless.