Via NESBridge
Managed infrastructure for maximum cross-chain compatibility
Register your interest in NESBridge/Nesa CCI Limited Preview program here.
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 Chainlink and API3, 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 ExampleNESCCITest on BSC Testnet.
Interacting with NESBridge
Getting, Approving tcciNES
Head over to the Nesa Testnet Faucet 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.
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.
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 Discord: Join the Nesa Discord for community support and discussion.
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.
Last updated