Getting Started

The core component of interacting with Sight Oracle is the `@sight-oracle/contracts` Solidity library.

Installation

Use following command to install:

npm install @sight-oracle/contracts

Usage

Types

Sight Oracle support following encrypted types:

  • ebool

  • euint64

  • eaddress

These types are stored as native uint256 in Solidity, they represent the index where to locate the encrypted values in backend decentralized oracle network (DON).

Requests

Sight Oracle support following request formats:

  • Request - The basic FHE operation request, it consists of an array of operations (see Operations below).

  • SaveCiphertextRequest - The request to submit an encrypted value into DON.

  • ReencryptRequest - The request to re-encrypt an encrypted value, this request is used to reveal an encrypted value to a target wallet address only

Operations

Sight Oracle Request support following operations over encrypted data:

  • getEbool(ebool): Load an ebool value into the execution context.

  • getEaddress(eaddress): Load an eaddress value into the execution context.

  • getEuint64(euint64): Load an euint64 value into the execution context.

  • rand(): Request a random euint64.

  • add(op, op): Add two euint64 values.

  • add(op, uint64): Add an euint64 with a uint64.

  • sub(op, op): Subtract one euint64 from another euint64.

  • sub(op, uint64): Subtract a uint64 from an euint64.

  • sub(uint64, op): Subtract an euint64 from a uint64.

  • mul(op, op): Multiply two euint64 values.

  • mul(op, uint64): Multiply an euint64 with a uint64.

  • div(op, op): Divide one euint64 by another euint64.

  • div(op, uint64): Divide an euint64 by a uint64.

  • div(uint64, op): Divide a uint64 by an euint64.

  • rem(op, op): Compute the remainder of two euint64 values.

  • rem(op, uint64): Compute the remainder of an euint64 divided by a uint64.

  • rem(uint64, op): Compute the remainder of a uint64 divided by an euint64.

  • shl(op, uint64): Shift an euint64 to the left by a uint64.

  • shr(op, uint64): Shift an euint64 to the right by a uint64.

  • rotl(op, uint64): Rotate an euint64 to the left by a uint64.

  • rotr(op, uint64): Rotate an euint64 to the right by a uint64.

  • select(op, op, op): Select one of two euint64 values based on an ebool condition.

  • decryptEbool(op): Decrypt an ebool value.

  • decryptEuint64(op): Decrypt an euint64 value.

  • decryptEaddress(op): Decrypt an eaddress value.

  • decryptEboolAsync(op): Decrypt an ebool asynchronously.

  • decryptEuint64Async(op): Decrypt an euint64 asynchronously.

  • decryptEaddressAsync(op): Decrypt an eaddress asynchronously.

Last updated