A minimal example of the architecture used to implement the Onchain Mibbo functionality.
This repo combines Solidity smart contract with a Python backend.
Users can describe themselves in natural language, and the system will automatically:
- Generate a unique character (name, description, traits) using a request to the СhatGPT.
- Create images based on the AI response.
- Upload metadata to IPFS.
- Store metadata on-chain using the smart contract.
- Allow the user to mint their NFT.
- Enable NFT upgrades (since two versions of metadata are pre-stored on-chain)
contracts/MibboFactory.sol— Solidity smart contract.main.py— main Python logic (user input → AI → images → IPFS → blockchain).ai_response.py— helper functions for working with AI.image.py— class of functions for generating and processing images.ipfs.py— helper functions for IPFS uploads.onchain/client.py— set of basic functions for interacting with the blockchain.onchain/admin.pyandonchain/ntf_interface.py— set of functions and classes for interacting with the specific smart contract(MibboFactory.sol)config/APIs.py— API keys and external integrations (OpenAI, Pinata).onchain/onchain_config.py— blockchain settings (RPC, contract address, keys).requirements.txt— Python dependencies.
- Python 3.9+
- Node.js + npm (for smart contract deployment with Hardhat/Foundry)
- Wallet with Base Sepolia ETH balance.
- Installed dependencies:
pip install -r requirements.txt
-
Deploy the contract
- Use Hardhat or Remix to deploy MibboFactory.sol
- Save the deployed address in
onchain/onchain_config.pyand also another data
-
Write down all the necessary data to get started.
onchain/onchain_config.py— admin private key and user private keyconfig/APIs.py— API keys(OpenAI, Pinata).
-
Run the App
python main.py -
Select an Action
Choose action: Upgrade⬆️ (u) or Find your Mibbo🌀 (f):
u— If you already have a Mibbo NFT and you want to upgrade it.f— To Find your Mibbo🌀✨(create and mint)
What does this code do?
It generates an NFT character based on a user’s self-description using AI, uploads metadata to IPFS, stores it on-chain, and allows minting/upgrading the NFT.
Is this the final version of the code that will be used in the App?
No, this is just a minimal example of the basic logic behind the creation of Onchain Mibbo.
You may ask👇
