Become a Model Provider

Setting up an MP service

Please refer to Go and Java code samples from respective links.



Each Model Provider must have a unique decentralized identifier (DID) to decrypt the data included in request messages. At present, it must be an ONT ID. You can get one by creating a wallet using ONTO app.

You can use one and the same DID to set up a DP and an MP.

Orange Provider SDK

An SDK in Go or Java is needed for signature and data encryption. Below instructions are illustrated in Go.


You need to include a wallet file in the local directory of your project for decryption and signature.

Design Models and Build Methods

Usually one model works with one dedicated dataset, so you need to design the model based on your dataset. Or, you can also choose to design and publish your model on the Orange platform and offer a bounty to attract a DP.

Models define the way data is used to determine the reputation for a user. You can create and customize models to define the operations that are performed on the data and the weightage that is assigned to data.

One MP can provide multiple models to Orange users. Every model must have an associated method. A method is an abstract definition or reference to a model that is useful when querying and fetching data.

Each method needs to have a name and a parameter (dataset) associated with it.

  • The name is used to refer to a particular method

  • The parameter schema defines the useful data that needs to be passed as input to calculate reputation scores using the model pertaining to the particular method

Create Interfaces for Model Access

MPs need to set up an externally accessible interface with specific endpoints that can be used to fetch models. These endpoints will be called when model requests are made to the Orange system. The endpoint design depends on the design of the associated dataset, so only RESTful API is supported.


Requests should be made with parameters of the following in JSON:

	"provider_did":"<dp did>",
	"data":<detail data>,
	"encrypted":"<encrypted hex string>"




Data acquired from DP for calculation using the model. Usually it's empty in the production environment due to security concerns, only used in a debug environment.


Hex string of data encrypted by DP using public key of MP's DID


The response should be a score in JSON representing the user's reputation:


Publish Interface

When your interface is ready to be accessed on the mainnet, you can publish it on the Orange platform for developers to discover and use it. You can do it in the Reputation Studio.

Step 1: Click on the "Connect Wallet" button on the top right to connect your wallet. You can find a detailed guide here.

Step 2: Click on the Menu button and select "Management". Choose "My Models".

Step 3: Click on the "Create Profile" button and fill out the form to create your profile as an MP.

Step 4: Click on the "Create Model" and fill out the information following the steps indicated on the page. Then you can either click "Save" to save the draft, or click "Publish" to submit your model for review and publication.

Handle API Requests

Decrypt Request Messages

Since the data in the request is encrypted, you need first to decrypt the data. You need the Orange Go SDK and a wallet to decrypt a request using your DID.

Import SDK

	orangeSDK ""
	orangeOnt ""

Initialize SDK

didsdk, err := orangeOnt.NewOrangeProviderOntSdk("./wallet.dat", "123456", "TESTNET")
if err != nil {

Parameters for initialization:

  • path of the wallet file

  • wallet password

  • network info: TESTNET or MAINNET


requestJson := &BalanceReq{}
if err := c.ShouldBindJSON(requestJson); err != nil {
	c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
encryptMsg, err := hex.DecodeString(requestJson.Encrypted)
if err != nil {
	fmt.Printf("DecodeString encryptMsg failed:%s\n", err.Error())
	c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
// Decrypt the message with SDK
decryptedbts, err := didsdk.DecryptData(encryptMsg)
if err != nil {
	fmt.Printf("DecryptMsg failed:%s\n", err.Error())
	c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})

Verify DP Signature

After decryption, you'll get the data and the DP's signature to the data. To verify the authenticity of data, you need to verify DP's signature:

//1. Convert json to bytes
msgbytes, err := json.Marshal(dataWithSig.Data)
if err != nil {
fmt.Printf("Marshal msgbytes failed:%s\n", err.Error())

	c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
//2. Deseriliaze signature
sigbytes, err := hex.DecodeString(dataWithSig.Sig)
if err != nil {
	fmt.Printf("DecodeString sigbytes failed:%s\n", err.Error())

	c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
//3. Verify signature with SDK
f, err := didsdk.VerifySig(requestJson.ProviderDID, msgbytes, sigbytes)
if err != nil || !f {
	fmt.Printf("VerifySig  failed:%s\n", err.Error())
	c.JSON(http.StatusBadRequest, gin.H{"error": fmt.Errorf("invalid signature")})

Generate Responses

Now you can use the data to calculate a reputation score and send it back to the Orange system.

Last updated