Backend APIs

1. POST /api/generate

  • Description: Takes a text/image prompt and generates unique AI artwork.

  • Request Body:

    {
      "prompt": "A futuristic city painted in Van Gogh style",
      "style": "van_gogh",
      "resolution": "1024x1024"
    }
  • Process:

    • Calls AI Art Engine (Stable Diffusion + ArtsiAI fine-tuning).

    • Stores temporary generated file in IPFS (unminted state).

  • Response:

    {
      "preview_url": "ipfs://Qm1234.../art.png",
      "session_id": "xyz789"
    }

2. POST /api/mint

  • Description: Mint an AI-generated artwork as an ERC-721 NFT.

  • Request Body:

    {
      "session_id": "xyz789",
      "title": "Futuristic Van Gogh City",
      "creator_address": "0x123..."
    }
  • Process:

    • Uploads metadata JSON to IPFS.

    • Calls NFT Smart Contract (ERC-721) to mint.

  • Response:

    {
      "transaction_hash": "0xabc...",
      "token_id": 42,
      "nft_url": "ipfs://Qm9876.../metadata.json"
    }

3. GET /api/nfts

  • Description: Browse NFTs (Trending, New, Curated).

  • Parameters:

    • filter=trending|new|curated

    • limit=20

  • Response:

    [
      {
        "token_id": 42,
        "title": "Futuristic Van Gogh City",
        "creator": "0x123...",
        "price": "0.5 ETH",
        "thumbnail": "ipfs://Qm1234/art.png"
      }
    ]

4. POST /api/list

  • Description: List an NFT for fixed price or auction.

  • Request Body:

    {
      "token_id": 42,
      "listing_type": "auction",
      "reserve_price": "0.5 ETH",
      "duration": "72h"
    }
  • Process:

    • Calls Marketplace Smart Contract.

  • Response:

    {
      "transaction_hash": "0xdef...",
      "market_id": "market_001"
    }

5. POST /api/buy

  • Description: Buy or bid for an NFT.

  • Request Body:

    {
      "market_id": "market_001",
      "buyer_address": "0x456...",
      "offer": "0.6 ETH"
    }
  • Process:

    • Executes purchase on Marketplace Smart Contract.

  • Response:

    {
      "transaction_hash": "0xghi...",
      "status": "success"
    }

6. POST /api/fractionalize

  • Description: Convert NFT into fractional ERC-20 tokens.

  • Request Body:

    {
      "token_id": 42,
      "shares": 1000,
      "symbol": "ART42",
      "name": "Fractional Art #42"
    }
  • Process:

    • Deploys Fractional NFT Smart Contract.

  • Response:

    {
      "transaction_hash": "0xjkl...",
      "fractional_contract": "0x789...",
      "total_shares": 1000
    }

7. POST /api/proposal

  • Description: Submit governance proposals for ArtsiAI DAO.

  • Request Body:

    {
      "creator": "0x123...",
      "title": "Add AR/VR NFT support",
      "description": "Proposal to integrate AR rendering for NFTs.",
      "voting_period": "7d"
    }
  • Process:

    • Stores proposal on-chain in DAO Governance Contract.

  • Response:

    {
      "proposal_id": "dao_101",
      "transaction_hash": "0xmno..."
    }

🔹 System Diagram (API Flow + Smart Contracts + Storage)

                ┌───────────────────────────────┐
                │          Frontend App         │
                │ (Web, Mobile, WalletConnect)  │
                └──────────────┬────────────────┘
                               │ REST/GraphQL APIs

                ┌───────────────────────────────┐
                │          Backend API          │
                │  (Node.js / Python + AI Core) │
                ├───────────┬─────────┬─────────┤
                │           │         │         │
     ┌──────────▼───┐   ┌───▼─────┐   ┌─▼──────────────┐
     │ AI Art Engine│   │ IPFS    │   │ Blockchain RPC │
     │ (StableDiff.)│   │ Storage │   │ (Ethereum/ETH) │
     └──────────────┘   └─────────┘   └───────┬────────┘

                    ┌─────────────────────────┴──────────────────────────┐
                    │                    Smart Contracts                 │
                    │────────────────────────────────────────────────────│
                    │ 1. ERC-721 NFT Minting Contract                    │
                    │ 2. Marketplace Contract (buy/sell/auction)         │
                    │ 3. Fractionalization Contract (ERC-20 shares)      │
                    │ 4. DAO Governance Contract                         │
                    └────────────────────────────────────────────────────┘

Last updated