Skip to content

Latest commit

 

History

History
397 lines (284 loc) · 15.3 KB

README.md

File metadata and controls

397 lines (284 loc) · 15.3 KB

Contributors Forks Stargazers Issues MIT License


Logo

MxAI

Simplifying blockchain interaction for everyone!
Explore the docs »

View Demo · Report Bug · Request Feature

Important Links:

Note - You must provide an Openai API key on the website, for the chatbot to operate successfully!

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgments

About The Project

Product Name Screen Shot

MxAI is a user-friendly chatbot designed to simplify and democratize blockchain technology. It reduces the steep learning curve for newcomers by providing an AI-driven interface that requires minimal technical expertise, while also streamlining repetitive and time-consuming processes for technical users. Our chatbot aims to make web3 accessible to everyone, contributing to the widespread adoption of blockchain technology.

Current features include:

  • Generate, compile, and deploy code for blockchain applications
  • Interact with ERC20 contracts
  • Perform operations such as sending tokens and viewing balances of accounts
  • Lookup Multiversx Documentation for guidance and information

(back to top)

Built With

MxAI Network Diagram

  • Next
  • TailwindCSS
  • Supabase
  • Openai
  • Nginx
  • Gunicorn
  • Flask
  • AWS
  • Langchain
  • Deeplake
  • MultiversX

We have used the following MultiversX sdks to build the project:

  • sdk-js
    • The wallet extension provider enables users to authenticate their MultiversX DeFi Wallet and authorize transactions.
    • Network providers to interact with the network and broadcast the transactions.
    • Utilized Code, SmartContract, and CodeMetadata classes to deploy smart contracts from hosted .wasm files.
    • ABI Registry to interact with smart contracts from hosted abi files.
  • sdk-py
    • Query details about accounts such as balance, nonce etc.
  • mx-sdk-rs
    • Use the library to compile the generated contracts
  • Multiversx Defi Wallet Extension

(back to top)

Getting Started

This is an example of how you may give instructions on setting up your project locally. To get a local copy up and running follow these simple example steps.

Prerequisites

This is an example of how to list things you need to use the software and how to install them.

  • npm
    npm install npm@latest -g
  • Python (For Backend)
  • Rust including cargo (For Backend)

Installation

Frontend

  • Set up Supabase:

    • Visit Supabase and sign up for an account if you don’t already have one.

    • After signing up and logging in, create a new project.

    • Once your project is created, navigate to the 'API' section. Here, you will find your API keys: supabaseUrl and anonKey.

    • Note down these keys. You'll be needing them in subsequent steps.

  • Clone the Repository:

    • Open your terminal or command prompt and execute the following commands:

      git clone https://github.com/CommanderAstern/encode-multiversX.git
    • This will clone the repository into a directory named "encode-multiversX".

  • Install Necessary NPM Packages:

    • Before installing the packages, ensure you have Node.js and NPM installed on your machine.

    • Now, navigate to the frontend directory:

      cd encode-multiversX/frontend
    • Install the required packages:

      npm install
  • Configure Environment Variables:

    • In the frontend directory, create an .env.local file.

    • Open .env.local in a text editor.

    • Add the following environment variables with the values that you obtained from the Supabase dashboard:

      NEXT_PUBLIC_SUPABASE_URL=your_supabase_url
      NEXT_PUBLIC_SUPABASE_ANON_KEY=your_anon_key

      Replace your_supabase_url and your_anon_key with the appropriate values.

    • Specify Your Backend's URL:

      Specify the URL where your backend is currently running.

      Open the .env.local file and add the following:

      NEXT_PUBLIC_BASE_URL=http://localhost:5000

      In the above example, the backend is assumed to be running locally on port 5000. Replace http://localhost:5000 with the actual URL where your backend is running.

    • Save and close the .env.local file.

  • Run the Application:

    If you're ready to see your project in action, you can start the development server:

    npm run dev

    Visit http://localhost:3000 in your browser to see the application running.

(back to top)

Backend

To install the backend, follow the steps below:

  1. Go to the backend directory
    cd backend
  2. Create an env file and add the following variables
    cp env.example .env
  3. Install the requirements
     pip install -r requirements.txt
  4. Install Rust Mx Library
    cargo install multiversx-sc-meta
  5. Run the backend using gunicon
    gunicorn app:app -w 3 --timeout 120    

Usage

  • Create an Account

    • Open your web browser and navigate to:
    http://mxai.live/signup
    
    • Follow the on-screen instructions to create an account.
  • Configure OpenAI API Key

    • After logging in, look for a user icon or profile picture on the top right corner of the web page.

    • Click on it. A modal (popup window) will appear.

    • Within this modal, you'll find an input field to add your OpenAI API key. Paste your OpenAI API key into the designated field.

    • Save to ensure your key is stored.

    API key input screenshot

  • Set Up MultiversX Wallet Extension

    Before proceeding, ensure you have the MultiversX Wallet browser extension:

    • If you haven't installed the MultiversX Wallet extension, download and install it from the respective browser's extension store.

    • Once installed, click on the MultiversX Wallet icon in your browser's toolbar.

    • Log in or set up your wallet account.

  • Start Typing!

    With everything set up, you're ready to interact with the application. Start typing in the designated area, and watch as the magic happens!

Sample Prompts:

  • I would like to send a transaction of 1000 to wallet_address
  • What is the balance of wallet_address?
  • Can you generate a contract that let's you add two numbers and also holds the number 8 which you can increment?
  • Can you tell me about the extension wallet provider in multiversX?
  • I'd like to interact with an ERC20 contract at address contract_address

Backend API Requests Examples

You can interact with the Backend API directly. You can use the following postman collection as a reference: Postman Collection

(back to top)

Roadmap

  • Code generation, compilation and deployment
  • Interact with contracts (ERC20 as of now)
  • Send and view balances of accounts
  • Lookup Multiversx Documentation
  • Enable editing of generated code
  • Improve code generation, expand training dataset
  • Swap tokens using Ashswap
  • Extend interaction to other contracts
    • ERC721
    • ERC1155
  • Allow Interaction of all contracts given ABI

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

Contact

Pratik Jallan - Linkedin - pratikjalan11@gmail.com

Malavika Harikumar - Linkedin - malavikaha02@gmail.com

Asim Jawahir - Linkedin - asimjawahir123@gmail.com

(back to top)