LogoLogo
  • Nesa Docs
    • Introduction to Nesa
    • Overview of the Nesa System
      • AI Models: Repository, Standardization, Uniformity
      • Users: Why Do We Need Private Inference?
      • Node Runners: Doing Inference and Earning $NES
    • Organization of the Documentation
  • Technical Designs
    • Decentralized Inference
      • Overview
      • Model Partitioning and Deep Network Sharding
      • Dynamic Sharding of Arbitrary Neural Networks
      • Cache Optimization to Enhance Efficiency
      • BSNS with Parameter-efficient Fine-tuning via Adapters
      • Enhanced MTPP Slicing of Topological Order
      • Swarm Topology
      • Additional: Free-Riding Prevention
    • Security and Privacy
      • Overview
      • Hardware Side: Trusted Execution Environments (TEEs)
      • Software/algorithm Side: Model Verification
        • Zero-knowledge Machine Learning (ZKML)
        • Consensus-based Distribution Verification (CDV)
      • Software/algorithm Side: Data Encryption
        • Visioning: Homomorphic Encryption
        • Implementation: Split Learning (HE)
      • Additional Info
        • Additional Info: Trusted Execution Environments (TEEs)
        • Additional Info: Software-based Approaches
    • Overview of $NES
      • $NES Utility
    • The First Application on Nesa: DNA X
    • Definitions
    • Additional Information
      • Dynamic Model Versioning and Fork Management
      • Nesa's Utility Suite
      • The AI Kernel Market
      • Privacy Technology
        • Trusted Execution Environment (TEE)
        • Secure Multi-Party Computation (MPC)
        • Verifiable Random Function (VRF)
        • Zero-Knowledge Proof (ZKP)
      • The Integration of Evolutionary AI to Evolve the Nesa Ecosystem
      • Interoperability and Nesa Future Plans
  • Using Nesa
    • Getting Started
      • Wallet Setup
      • Testnet Nesa Faucet
    • Via Web
      • Your Nesa Account
      • Selecting an AI Kernel
      • Submitting a Query
    • Via SDK
    • Via IBC
    • Via NESBridge
      • On Sei
  • Run a Nesa Node
    • Prerequisites
    • Installation
    • Troubleshooting
    • FAQ
  • Links
    • nesa.ai
    • Nesa Discord
    • Nesa Twitter
    • Nesa dApp: dnax.ai
    • Nesa dApp: DNA X Docs
    • Terms of Service
    • Privacy Policy
Powered by GitBook
On this page
  • Overview
  • Compatibility
  • Technical Description
  • Interacting with NESBridge
  • Getting, Approving tcciNES
  • Submitting an Inference Request
  • Handling Inference Results
  • Additional Resources
  1. Using Nesa

Via NESBridge

Managed infrastructure for maximum cross-chain compatibility

PreviousVia IBCNextOn Sei

Last updated 11 months ago

Register your interest in NESBridge/Nesa CCI Limited Preview program .

Overview

This documentation provides developers with guidance on how to interact with Nesa Chain using NESBridge/Nesa Cross-chain Interactions (CCI) protocol, designed for reliable and secure data exchange between blockchains.


Compatibility

Compatibility with various blockchain protocols and ecosystems is paramount in advancing NESBridge goals. That said, deployment is based on a per-blockchain basis, with priority afforded to EVM-compatible blockchains. See the interest registration form above to submit your blockchain for consideration.


Technical Description

NESBridge is a managed message relayer between third-party blockchains and Nesa Chain, much like those provided by and , that facilitates AI inference requests originating on third-party blockchains.

Developers interested in executing on-chain inference requests initiate them by calling the chain-specific Nesa CCI relayer contract.

Through a combination of collection, routing, and execution infrastructure, results are posted back to the location specified by the initial request.

For an example contract that performs these requests, visit on BSC Testnet.


Interacting with NESBridge

[Testnet] Payments for NESBridge inference requests are made in tcciNES, specific to each third-party blockchain.

Getting, Approving tcciNES

In paying with tcciNES, the relayer contract needs an allowance of equal or greater amount to the lockAmount defined in your NESInferenceRequest's options from wallet.

IERC20(tcciNESContractAddress).approve(cciRelayerAddress, amount);

Submitting an Inference Request

To initiate an inference request, submit a NESInferenceRequest to the INESCCIRelayer instance deployed on your desired blockchain.

Set the wallet property to the address of the wallet holding tcciNES token for payment. Unused tcciNES will be sent to this wallet.

Set the resultHandler property to the address of the contract that will process the result.

See relevant definitions below:

interface INESCCIRelayer {
    function submit(
        NESInferenceRequest memory request
    ) external returns (uint requestId);
}
struct NESInferenceRequest {
    address wallet;
    string model;
    string content;
    string context;
    NESInferenceRequestQueryHyperParams hyperParams;
    NESInferenceRequestOptions options;
    INESInferenceResultHandler resultHandler;
}

struct NESInferenceRequestQueryHyperParams {
    uint frequencyPenalty;
    uint presencePenalty;
    uint temperature;
    uint topP;
}

struct NESInferenceRequestOptions {
    uint lockAmount;
}

interface INESInferenceResultHandler {
    function nes_handleInferenceResult(
        uint requestId,
        NESInferenceRequest memory request,
        NESInferenceResult memory result
    ) external;
}

Handling Inference Results

In order to handle the results of an inference request, implement the INESInferenceResultHandler interface referenced above.

The NESInferenceResult struct defines the structure of an inference result:

struct NESInferenceResult {
    NESInferenceResultStatus status;
    uint cost;
    string result;
    uint errorCode;
    string errorMessage;
}

Following the processing of your inference request, a NESInferenceResult is posted to the resultHandler listed in your original NESInferenceRequest.


Additional Resources

  • Nesa Documentation: Explore additional documentation to deepen your understanding of Nesa and its features.


This guide provides an overview of how to interact with NESBridge on third-party blockchains. If you have further questions, feel free to reach out on the Nesa Discord for assistance.

Head over to the page and select your third-party blockchain to receive tcciNES. These tokens are blockchain-specific and are charged to accounts submitting inference requests at a 1:1 ratio to NES.

Nesa Discord: Join the for community support and discussion.

here
Chainlink
API3
ExampleNESCCITest
Nesa Testnet Faucet
Nesa Discord