Sight AI
  • πŸ‘‹Overview
    • πŸ₯FHE
    • 🍍The Problem
  • πŸ‡Sight Oracle
    • πŸ’‘Concepts
      • πŸ‰Architecture
      • πŸ“”Contract
      • 🟠Decentralized Oracle Node Network
      • πŸ“ FHE Compute Execution Virtual Machine
      • πŸ“ƒRequestBuilder
    • ⏩Supported Networks
  • Sight Contracts
    • Getting Started
    • Understanding Request Model
  • SIGHT.JS
    • Getting Started
    • Make an encrypt value - CLI
    • Make an encrypt value - Frontend
  • ℹ️Tutorial
    • Environment Setup
      • Prerequisite
      • Setup Local Development Environment
      • Fund Local Wallet
    • πŸ‘·Create Your First dAPP using Hardhat
    • πŸ› οΈCreate Your First dAPP using Foundry
    • 🎲Create a Crypto Pusher Game
      • Contract
      • Interface
    • πŸ“„Remix FHE Demo Local Deployment Tutorial- Preparation
    • πŸ“„Remix FHE Demo Local Deployment Tutorial- Deploying Contracts Using Remix
    • πŸ“„Remix FHE Demo Local Deployment Tutorial- Contracts Explanation&Interaction
  • πŸ”ŽResearch
    • βœ…Verifiable FHE
    • 🌟SPARC
    • πŸ“…Research Updates
  • πŸ“Innovative Use Cases and dApps
    • πŸ₯₯FHE On-Chain Game
    • A Fairer Prediction Markets with Sight Oracle
  • 🍻Roadmap
  • 🎨Community
    • Website
    • Twitter
    • Telegram
    • Github
  • Sight Incentive Plan - Season 1
  • Sight Incentive Plan - Season 2
Powered by GitBook
On this page
  1. Tutorial

Remix FHE Demo Local Deployment Tutorial- Contracts Explanation&Interaction

PreviousRemix FHE Demo Local Deployment Tutorial- Deploying Contracts Using RemixNextResearch

Last updated 6 months ago

Explanation of Key Components

1. CombinedContract.sol Overview:

β€’ This file contains utility contracts, libraries, and a core Oracle contract that facilitates request handling, encryption, and decryption operations using CapsulatedValue.

β€’ Ownable Contracts: Ownable and Ownable2Step contracts provide ownership control, ensuring that only the owner can execute certain functions.

β€’ Types and Operations: The Types and Opcode libraries define custom types and supported operations for fully homomorphic encryption (FHE) computations.

2. Example.sol Overview:

β€’ Oracle Interaction: The Example contract interacts with the Oracle contract to perform secure computations. It uses the RequestBuilder library to create and send requests to the Oracle.

β€’ Events: Various events, such as RequestSent, TargetUpdated, and DebugLog, are emitted to provide transparency in operations.

β€’ Functions:

β€’ createRandomTarget(): Generates a random target value using the Oracle.

β€’ randomTargetCallback(): Handles the Oracle’s response and updates the target value.

β€’ makeComputation(uint64 amount): Performs a computation on the target and an input amount, then sends a request to the Oracle.

β€’ computationCallback(): Processes the result of the computation and updates the target.

Interacting with the Contracts

1. Generate a Random Target:

β€’ After deploying Example.sol, use the createRandomTarget() function. This will generate a random target value using the Oracle.

β€’ Check the Remix console for emitted events and debug logs.

2. Perform a Computation:

β€’ Call makeComputation(uint64 amount) with a specific amount to add to the target.

β€’ The Oracle will process the computation, and the result will be available in the computationCallback().

3. View Target Value:

β€’ Use the getTarget() function to view the current target value.

ℹ️
πŸ“„