Assess Reputation for Your dApp Users

An SDK to integrate Orange to your dApp

You can invoke the models of your choice available via Orange by sending invocation requests from your dApp to the system using the Orange Server SDK.

The general sequence in which you would call the methods to send an invocation request by specifying an model and a dataset is:

  1. Call GetAlgorithmProviders and GetDataProviders to go through the available model and data providers.

  2. Choose an MP and DP, and call GetAlgorithmMethods and GetDataMethods to fetch the method details on available models and datasets.

  3. Choose an MP method and a DP method ensuring the schemas match, then call RequestOrangeScore to send an invocation request along with authorized and signed wallet information.

  4. Call GetUserTask to fetch the invocation results, or the status of a task.

The results can be exported in the form of Verifiable Credentials. Refer to the verifiable credential docs here for more details on how that can be implemented.

SDK intro

The Orange server uses GraphQL for its interface design. You can use the methods defined below to perform actions such as fetching MP and DP schema details and sending calculation requests using a model-data pair for specific wallets and DIDs.

To use the SDK you need a DID for your dApp. You can get one by creating a wallet using ONTO app.

Initialization

Add this dependency in the go.mod file in your project.

github.com/orange-protocol/orange-sdk-go latest

Schema definition

The major schemas defined for the interface are described below.

Interface methods

1. Fetch details for all available MPs

Returns the details of all the currently registered model providers.

Method: GetAlgorithmProviders

Parameters: none

Returns: []*AlgorithmProvider

2. Fetch available methods for an MP

Returns all the currently available models and the associated schemas as defined by an MP.

Method: GetAlgorithmMethods

Parameters

  • apdid- The DID of specified MP

Returns: []*ProviderMethod

3. Fetch details for all available DPs

Returns the details of all the currently registered data providers.

Method: GetDataProviders

Parameters: none

Returns: []*DataProvider

4. Fetch available data methods for a DP

Returns all the currently available datasets and the associated schemas as defined by a DP.

Method: GetDataMethods

Parameters

  • dpdid- The DID of specified DP

Returns: []*ProviderMethod

5. Send a request to run the model with selected data

Sends a request to generate the score or report for the specified wallet addresses using the specified model and dataset, or MP and DP method respectively. Returns a taskId.

Calculation requests are handled asynchronously. You can use the returned task ID to fetch the generated result. Please note that certain types of data or volume may take some time to fetch, and so the calculation may take up to an hour in certain extreme cases after a request is sent successfully.

Method: RequestOrangeScore

Parameters

  • *RequestOrangeScoreReq- defined below

Returns: int64

6. Fetch result/status for a task

Method: GetUserTask

Parameters

  • key- API key

  • taskId - task ID

Returns: *UserTasks

Sample invocation

Refer to the sample code below that invokes the GetAlgorithmProviders method.

Last updated

Was this helpful?