Links

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, Avalanche, Goerli (demos only), Gnosis (soon), 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. Lists are currently maintained for KYC level, citizenship and residency.
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. Use cases requiring additional guarantees, such as KYC/AML, can also make use of the following lists.
listId
Meaning
basic
Passed KYC level basic
plus
Passed KYC level plus
fatf_grey
Resident of a country that's present in the FATF's list of jurisdictions under increased monitoring.
fatf_black
Resident of a country that's present in the FATF's list of high-risk jurisdictions.
client_custom_list
These are custom lists created for clients that have KYC compliance needs that don't fit the above lists.
Please get in touch with [email protected] for creating your own client_custom_list
Best practice: If you want to know if a user passed KYC level basic, then you should check both the basic and plus lists since a user that passed KYC level plus would have passed KYC level basic.

Smart contract code example

  1. 1.
    Import our FractalRegistry.sol contract and set its address.
  2. 2.
    Adapt the requiresRegistry modifier based on your KYC level and country requirements.
import {FractalRegistry} from "github.com/trustfractal/registry-deployer/blob/master/contracts/FractalRegistry.sol";
contract Main {
FractalRegistry registry = FractalRegistry(0x5FD6eB55D12E759a21C09eF703fe0CBa1DC9d88D);
function requiresRegistry(
address sender,
string[1] memory requiredLists,
string[2] memory blockedLists
) private view {
bytes32 fractalId = registry.getFractalId(sender);
require(fractalId != 0);
for (uint256 i = 0; i < requiredLists.length; i++) {
require(registry.isUserInList(fractalId, requiredLists[i]));
}
for (uint256 i = 0; i < blockedLists.length; i++) {
require(!registry.isUserInList(fractalId, blockedLists[i]));
}
}
function main(
/* your transaction arguments go here */
) external view {
requiresRegistry(msg.sender, ["plus"], ["fatf_grey", "fatf_black"]);
/* your transaction logic goes here */
}
}
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.