How to integrate with the Cred Score Oracle (Arbitrum Goerli)

Cred Protocol
3 min readOct 26, 2022

📖 What will you learn today?

We believe that a fair, transparent credit score should be accessible to anyone, anywhere in the world. With this accessibility in-mind, we have put our Cred Score on-chain for you to begin integrating and building on top of.

By the end of this guide, you will have deployed the Cred Score Requester smart contract on-chain (testnet). This will allow you to call our oracle and provide a quantification of creditworthiness for any wallet — leveraging the machine learning models we have developed over the last year to power this score. Once integrated, the continual improvements we make to this score will automatically benefit your application without any further work required on your end. Lets get started.

(You will need testnet ETH/LINK for this guide — follow on 5-min tutorial here to get them before starting!)

💡 How does it work?

This guide uses code from our repo. The Requester smart contract in this repo can be deployed on-chain and create a requestCredScore request to our oracle to get your Cred score on-chain. This whole process is largely automatic and there are only a couple of steps explained in more detail in the rest of this guide.

For now, this guide is for deployment on Arbitrum Goerli. We are looking to deploy on Arbitrum One in the near future so make sure to follow our Twitter to stay updated.

How to use the Cred Protocol Chainlink Requester

Smart contract deployment

  1. Open up our repo in Remix here
  2. On the Compile tab, click the Compile button for Requester.sol. Remix automatically selects the compiler version and language from the pragma line unless you select a specific version manually.

Compile button on Remix IDE highlighted red

On the Deploy and Run tab, configure the following settings:

  1. Select “Injected Provider — Metamask” as your Environment. The Javascript VM environment cannot access our oracle node.
  2. Select the Requester contract from the Contract menu.

Injected Provider — Metamask highlighted red

3. Click Deploy (MetaMask prompts you to confirm the transaction)

4. If the transaction is successful, a new address displays in the Deployed Contracts section in Remix.

✋ Request your Cred score

In order to get the request fulfilled, you need to send some testnet LINK to your smart contract (See here for our 5-minute guide on getting testnet ETH/LINK). One request is 0.1 LINK. It works like a top-up phone, you can pay for your requests in advance.

If you try to request your Cred score and the smart contract does not have enough LINK, it will return a gasEstimation error. The address of the smart contract can be found in the Deployed Contracts section on Remix — you can copy it into your clipboard from there.

In Remix, call the requestCredScore function and sign the transaction in your MetaMask. Once you see a successful transaction message in Remix, the background process has started and the score will be on-chain soon.

📚 Read your Cred score

(Wait for around 30 seconds from the point when the requestCredScore function was successfully called — it takes some time to pass the information to the API, wait for the response and to put that response back on chain)

After waiting 30 seconds, click on ‘currentScore’ and your Cred score should be visible on-chain. If your Cred score is 0, there are several reasons that might be causing this:

  • your wallet has 0 transactions, or
  • your Cred score has not updated yet to the chain

Woo! You have now successfully deployed the Cred Score Requester smart contract on-chain and requested your Cred Score. Let us know if you have any questions or ideas for things you’d like to see in future.

For early access to our Cred Score API and upcoming launches, sign up to our waitlist here.

--

--

Cred Protocol

Cred Protocol is a decentralized credit score that quantifies on-chain lending risk at scale using open, fair and transparent blockchain data.