<a href="https://www.youtube.com/watch?v=CMp9FUuK4Tw" rel="some text"></a>
## TL;DR -- How to use it?
Once you get connect with Bonsai, we cover the cost of all meta-transactions.
### 1. Go to https://bonsai-jade.vercel.app
### 2. Connect with Bonsai (Tinyauth) and WAIT for a few seconds to get redirected
⚠️⚠️⚠️ **WAIT for a few seconds to get redirected** ⚠️⚠️⚠️


### 3. Find the Develop tab and click on Chat AI

### 4. Ask questions or to generate transactions
1. Ask questions

2. Ask to submit transactions

3. Create other BOS widgets

### 5. BONUS: Save your chat on-chain or read your chat history
1. Chat History

2. Chat Preview

## Inspiration
The seeds for Bonsai sprouted from a profound appreciation for the latent capabilities of blockchain technology, coupled with the intricate artistry of a bonsai tree. Much like a bonsai, meticulously sculpted and cultivated within a pot, I aimed to encapsulate the intricate nature of blockchain within a simple, user-friendly interface. Thus, the concept of Bonsai came into being, an amalgamation of 'BOS + AI'.
BOS stands for Blockchain Operating System, which serves as the foundation for our applications, while AI symbolizes the integration of GPT-4 to automate and guide user interactions with the blockchain. Through Bonsai, I strived to streamline the introduction of new users to blockchain platforms, making it less complicated and more welcoming.
## What it does
Bonsai functions as a user's personal gateway into the blockchain ecosystem. It provides an interactive Chat Widget that guides users in navigating the BOS, answering their queries, and assisting in the initiation of blockchain interactions.
The platform comes with a built-in feature called Tinyauth, which enables the creation of Zero Balance accounts. With Tinyauth, users can securely store keys on their device and sign blockchain transactions without the need for an initial token balance. This feature simplifies the onboarding process, eliminating the barriers associated with account funding and key management.
To further enhance the user experience, Bonsai includes a relay system for meta transactions. This feature allows users to submit transactions on the blockchain without dealing with the underlying complexities, thus making their initial experiences with blockchain smooth and intuitive.
Incorporating the power of AI through the Vercel AI SDK and GPT Functions, Bonsai enables users to interact with the platform, create transactions, query data, and develop widgets simply by engaging in a conversation with the system.
In essence, Bonsai nurtures the growth of users in the blockchain ecosystem, making the process of planting their roots and starting their journey as simple and intuitive as possible.
## How we built it
- **Chat Component**: I've built the Chat component as a BOS widget.
- **BOS Gateway**: I've forked the near-discovery and created a Chat Widget on the Blockchain Operating System (BOS). This widget serves as a user-friendly interface, guiding users through the blockchain ecosystem.
- **Secure Authentication**: I introduced Bonsai Tinyauth, a minimalist implementation of FastAuth that securely stores keys on the user's device using WebAuthn. This enables users to create Zero Balance accounts and sign transactions without requiring an initial token balance.
- **Meta Transaction Relayer**: To make the transaction submission process simpler, we built a relayer as a NextJS serverless function. This relayer allows users to submit meta transactions, abstracting the complex transaction details from the users.
- **Artificial Intelligence Integration**: I've integrated the Vercel AI SDK along with GPT Functions into our platform. This integration enables Bonsai to leverage AI technology, facilitating the development of user-friendly GPT plugins.
- **GPT Plugin Development**: With the help of GPT plugins, users can perform various blockchain operations, such as creating transactions, querying data, and developing BOS widgets, through simple conversations with the system.
## Challenges we ran into
1. The development process of BOS widgets proved to be quite complex.
2. Transactions sometimes failed due to inconsistencies with gas computation.
3. We found it challenging to optimally utilize GPT 3.5 for this use case, as the newer version, GPT 4, would have provided better performance and functionality.
## Accomplishments that I'm proud of
1. Successful implementation of the meta transaction relayer.
2. Integration of AI to effectively query and submit on-chain data.
3. Capability to store and share chat conversations on-chain.
## What we learned
1. Gained a deeper understanding of how to operate at the gateway level of the BOS.
2. Learned the intricacies of building GPT functions.
3. Gained insights into the integration and efficient use of AI in blockchain applications.
## What's next for Bonsai
1. Refining the AI system based on on-chain conversation data.
2. Implementing on-chain storage for plugin data.
3. Developing rules and conditions at the relayer level for enhanced security and efficiency.
4. Further improvements to the TinyAuth system for better user experience.
## Deliverables
1. Repo: https://github.com/microchipgnu/bonsai
2. Chat Widget: https://test.near.org/discom.testnet/widget/ComponentDetailsPage?src=faa96031-0d64-4442-8676-2bbadaa634a4.test-relayer-1.testnet/widget/chat&tab=source