🖇️Integration Process

Overview

There are three methods to integrate Centic scoring model into your applications.

  • Using Centic pre-build UI

  • Using Centic SDK

  • Using Restful API

Before you begin

Before you can start using Centic service to calculate the score of a custom score model, you need to create an API key of the corresponding score model on the Centic console page.

  1. Go to the Centic Score Marketplace page HERE.

  2. Register and log in (you need to check your email to verify your account).

  3. After that, go to the market and select the score model you want.

  4. Click Add to your creation to add the score model to your creation Or you can contact us to create your own score model.

  5. After getting (creating) the score model, open the score model in your creation tab

  6. Here you can edit the score model general information, for CreditScore/TokenHealth model, you can edit the model scorecard Formula.

  7. Click Copy Score ID to get the score model ID.

  8. Go to the Integration tab.

  9. Click the eye icon to show the newly created API key.

  10. Append the API key created to the x-API key field in the header of every API request.

Integration Detail

The integration method to choose depends on the specific business logic of your app.

Using Centic Prebuilt UI

This method can be used to prove the wallet score of users without revealing their wallet address. This can be done by generating a ZkProof of the user score, the proof will be then verified by your app later. This way, your app can know the validity of the user's score without knowing about their wallet address.

Centic Prebuilt UI is only used to get the user's wallet score (for example Crypto credit score). The process flow can be described in the following picture:

1. Request services

To start the process your app will need to send an HTTP request to Centic server to get the temporary URL.

API endpoint: https://develop.centic.io/v1

HTTP request

GET /centic-services/createUrl

Parameter detail

Response

2. Redirect

After getting the temporary URL, redirect the user to that URL, the URL will lead to a Centic prebuilt UI to generate the score proof.

3. Getting the Proof

The sessionId returned in step 1 can be used to check the proof generation status and get the proof if the proof generation process is finished.

API endpoint: https://develop.centic.io/v1

HTTP request

GET /centic/services/getProofData

Parameter detail

Response

4. Verify the proof

  • After getting the proof, you can implement the verification process on your server or use the Centic verify service.

  • The user credit score then can be extracted from the first element of the publicSignals field in the proof.

const credit_score=JSON.parse(proof).publicSignals[0]

- Implement verifying proof on your app server. 1. Install snarkJs: more detail here 2. Get the verification key here 3. The verify function can be written as this example:

const { groth16 } = require("snarkjs")
const v_key = require("./verification_key.json")

async function verifyProof (proof) {
    let publicSignals = proof.publicSignals
    const result = await groth16.verify(v_key, publicSignals, proof.proof);
    return result
}

- Verify proof on Centic Server.

You can send and verify proof on Centic server using Api Call:

API endpoint: https://develop.centic.io/v1

HTTP request POST /bank/user/verify

Request body detail

Response

Using Centic SDK

This method allow you to calculate an entity score right on your app based on the score calculation model.

You can see the detailed instructions including full code to integrate through Centic SDK HERE

Using Restful API

This method is used to get any entity score (for example: Token health score, AAVE ecosystem wallet reputation).

API endpoint: https://develop.centic.io/v1

HTTP request

GET /centic-services/calculateCustomScore/{entity address}

Parameter detail

Response

Last updated