Get Started


you can install the identity SDK as a dependency with the command npm install @onchain-id/identity-sdk


Latest version

We are currently integrating a new proxy contract to reduce costs of identity deployments. This feature was added in version 1.4.0 of the Identity SDK. To deploy fully fledge ONCHAINIDs, please use the previous version 1.2.2.

you can then require the dependency in your application with

const { IdentitySDK } = require('@onchain-id/identity-sdk');

Or if you are using ES6

import { IdentitySDK } from '@onchain-id/identity-sdk'

Loading an Identity

The unique identifier of an Identity is its address. To load its data from the BlockChain, you need to instantiate a connection with a BlockChain provider.
In this documentation, the test network ropsten will be used. Replace this with homestead to target the main network; see the BlockChain Providers for more information regarding the different types of network.

const ethers = require('ethers');

const provider = ethers.getDefaultProvider('ropsten');

// instantiate an Identity from its address on a specific network.
const identity = await'0xadD92F8Ef0729E969c5a98Ea5740c9b644B362e3', { provider });

Use the inbuilt SDK methods to retrieve data

Once the identity is loaded from an address, you can call the methods from the Identity object. Here is a basic example of the method to retrieve all claims of an identity by type.

This example assumes you are using a version of NodeJs that supports async await

(async () => {
  const claims = await identity.getClaimsByType(1);
  // Will return the parsed claims of the identity.

What’s Next