Introduction

Intelligent Oracle

A complete system for deploying and managing AI-powered oracles on the GenLayer blockchain. This system enables the creation and resolution of prediction markets using natural language processing and web data analysis.

Prerequisites

Before running this project, ensure you have:

  1. GenLayer Studio (opens in a new tab) installed and running locally
    • Docker 26+
    • Node.js 18+
    • Install with: npm install -g genlayer
    • Start with: genlayer init

Project Components

1. Intelligent Oracle Contracts

The system includes an Intelligent Oracle contract for prediction market resolution alongside a Registry contract for managing deployed oracles. The architecture supports flexible data sources, multiple outcomes, and rule-based resolution.

Learn more about the contracts →

2. Bridge & Chat API

The Bridge component handles oracle deployment to the GenLayer blockchain while providing seamless Chat API integration with OpenAI's GPT models.

Learn more about the bridge →

3. Configuration Wizard UI

The wizard provides an interactive chatbot interface for oracle configuration, offering step-by-step guidance through the setup process with real-time AI assistance.

Learn more about the wizard →

4. Explorer Interface

The explorer provides a simple dashboard for viewing deployed oracles, monitoring oracle status and outcomes, and viewing market details and resolution data.

Learn more about the explorer →

Getting Started

  1. Start GenLayer Studio:
genlayer up
  1. Run tests for the Inteligent Oracle contract:
# Activate your Python virtual environment first
pip install -r test/requirements.txt
pytest test/
  1. Deploy the contracts in the Studio UI

  2. Setup the Registry contract Environment Variables in the Explorer project .env file and start it

# .env
VITE_CONTRACT_ADDRESS=0xXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
# Start the explorer
npm run dev
  1. Setup the Environment Variables in the Bridge project .env file and start it
# .env
NUXT_OPENAI_API_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
NUXT_BRIDGE_PRIVATE_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
NUXT_SIMULATOR_ENDPOINT=http://localhost:8443/api
NUXT_IC_REGISTRY_ADDRESS=0xXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
# Start the bridge
npm run dev
  1. Setup the Environment Variables in the UI-Wizard project .env file and start it
# .env
NUXT_PUBLIC_CHAT_API_URL=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
NUXT_PUBLIC_BRIDGE_API_URL=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
NUXT_PUBLIC_EXPLORER_URL=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
# Start the wizard
npm run dev

Common Pitfalls

  • The environment variables are set at startup and they require the projects restart to update
  • Factory pattern implementation is limited due to current Studio constraints

TODO List

  • Implement appeals functionality (blocked by Studio development)
  • Implement prodction market resolution via Bridge
  • Implement factory pattern for Intelligent Oracle contract deployment

Architecture

├── contracts/         # Smart contracts implementation
├── bridge/           # Backend API & blockchain integration
├── ui-wizard/        # Configuration wizard frontend
├── explorer/         # Oracle monitoring interface
└── test/            # E2E and contract tests

Contributing

Contributions are welcome! Please check the individual component READMEs for specific development guidelines.

License

MIT (opens in a new tab)