Skip to main content

How to Query KYC/KYB States on C-Chain

This document provides a guide on how to use Remix IDE to query the KYC/KYB States of an address on C-Chain. Follow the steps below to accomplish this.

Prerequisites

  • MetaMask installation and functionality

Add Camino Network to MetaMask

To query the KYC/KYB States of an address using the Remix IDE, we will use the MetaMask wallet.

We need to add a custom network to MetaMask. In this document, we will use the Columbus test network.

Please refer to the MetaMask & RPC Endpoints document to add a custom network.

Connecting MetaMask to the Remix IDE

Follow the steps below to connect MetaMask to the IDE:

  • Open the Remix IDE web page: https://remix.ethereum.org/
  • Click Deploy and run transaction on the right sidebar.
  • Select Inject Provider - MetaMask from the Environment dropdown menu.
Fig.5: Click "Deploy and run transactions" tab and select "Inject Provider" from "Environment"
  • Verify that the MetaMask is connected to the Remix IDE.
Fig.6: Verify network is connected

Downloading the CaminoAdmin.abi file

We can either compile the contract or use the precompiled ABI file. In this guide, we will use the ABI file.

You can download the ABI file from Chain4Travel's GitHub repository: chain4travel/caminoethvm - CaminoAdmin.abi

  • Rigth click on "Raw" and select "Save as..." to save it to your local computer.
Fig.7: Save "CaminoAdmin.abi" file to local computer

Uploading the ABI file to the Remix IDE

Follow these steps to upload the ABI file to the Remix IDE:

  • Switch to File Explorer on the right sidebar and click the upload button.
  • Select the file you downloaded from your local computer and upload it.
Fig.8: Switch to "File Explorer" and click "Load a local file into current workspace"
  • Select the CaminoAdmin.abi file.
Fig.9: Select the loaded ABI file

Getting the CaminoAdmin Contract Address

Camino Admin Address: 0x010000000000000000000000000000000000000a

You can also find the Camino contract addresses on Camino Smart Contracts page under Developer > References.

Fig.10: Get the CaminoAdmin contract address

Interacting with the Address

  • Paste the address into the At Address field and click on the button.
Fig.11: Paste the contract address into the "At Address" field and click "At Address"
  • Confirm the interaction
Fig.12: Confirm the dialog popup

Making the Query

Follow the steps below to make the query:

  • Click the arrow to open the contracts methods list.
Fig.13: Click the arrow to open the dropdown
  • Paste the address you want to query KYC/KYB States into the field and click getKycState button.
note

This is the C-Chain address of a wallet, that starts with 0x.

If you want to query the P-Chain address, please refer to the platform.getAddressStates() method in P-Chain API documentation.

Fig.14: Paste the address to query and click getKycState button

Result

  • The result of the query will be displayed below the getKycState button.

  • Common values are:

ValueStateDescription
0No VerificationGiven address has not undergone KYC verification
1KYC VerifiedGiven address has undergone KYC verification
256KYB VerifiedGiven address has undergone KYB verification
257KYC & KYB VerifiedGiven address has undergone KYC & KYB verification

KYC/KYB State Bits

KYC/KYB states are represented by bits in a uint256 variable. The table below illustrates the mapping of each bit to its corresponding information:

BitInformation
0KYC Verifed
1KYC Expired
8KYB Verified

Example Result for KYC Verified Address

Fig.15: Example result for KYC Verified address

Example Result for Non-Verified Address

Fig.15: Example result for Non-Verified address

Example Result for KYC & KYB Verified Address

Fig.16: Example result for KYC & KYB verified address
Conclusion

Smart contracts on the C-Chain can retrieve information from the CaminoAdmin contract to confirm whether an address they are interacting with has undergone KYC/KYB verification or not.

This functionality empowers developers to create use-cases where such information is necessary.