Fractal DID registry

Authorize transactions by looking up their sender on Fractal's DID Registry.

Both Credentials API and DID Registry enable you to verify the credentials associated with a wallet address in your smart contract (on-chain) or in your dApp.

The DID Registry is a smart contract Fractal has deployed which contains two public methods your dApp and smart contract can call to verify a credential. Registries are deployed on Karura, Binance, Avalanche, Goerli (demos only), Gnosis, Aurora (soon) and Polygon. Registries will be deployed on other chains on a demand basis.

In order to verify a credential, you call getFractalId() to get a fractalId associated with a wallet address. Every fractalId in the DID Registry corresponds to a unique human. You call isUserInList() to determine whether a fractalId exists in one of the Registry's maintained lists. Only client-specific lists are currently maintained.

The advantages of the DID Registry are:

  • No need to access or manage personal data. You only need the user's connected wallet address to interact with the Registry.

  • No need to change the user flow. Once a user has connected their wallet, your dApp can call the Registry in the background in order to verify their credentials. The user does not need to do anything more.

  • Same interface. The interface used by your dApp and your smart contract is the same.

Interface

A unique human has a unique Fractal ID, each with 1+ addresses and present in 0+ lists.

address [*]---[1] fractalId [*]---[*] listId

Getting the Fractal ID for an address

bytes32 fractalId = getFractalId(address walletAddress);

Looking for a Fractal ID in a list

bool presence = isUserInList(bytes32 fractaId, string listId);

Available lists

Every fractalId in the DID Registry corresponds to a unique human. Aditionally, you can also make use of the following lists.

Please get in touch with engineering@fractal.id for creating your own client_custom_list

Smart contract code example

  1. Import our FractalRegistry.sol contract and set its address.

  2. Adapt the requiresRegistry modifier based on your KYC level and country requirements.

The example above adds approximately 25k gas to the transaction cost. Gas usage increases with the number of lookups.

dApp code example

We have created this simple demo dApp to show how a javascript app might interact with our Registry. You can find the code (written in Typescript and React) for this demo in this repo.

The interface to the Registry in the demo can be found in miniBackoffice.ts. The specific two functions are fetchFractalId and fetchKycState.

const fetchFractalId = (
  signer: providers.JsonRpcSigner,
  account: string
): Promise<string> => fractalRegistry.connect(signer).getFractalId(account);

const fetchKycStatus = (
  signer: providers.JsonRpcSigner,
  fractalId: string
): Promise<boolean> =>
  fractalRegistry.connect(signer).isUserInList(fractalId, KYCList);

Developer demo

If you want to understand more deeply how our registries work, check out our developer demo. Or, you can review the registry smart contract along with a simple environment to deploy it here.

Last updated