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.
Camino Builder: KYC Examples
The Camino Builder repository provides a complete guide on implementing KYC verification in your contracts, with:
- Contract examples
- Interface for the Camino Admin contract
- Step-by-step deployment guide
- Testing scripts for both verified and unverified wallets
Check out the KYC implementation guide: Camino Builder KYC Section
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.
- Verify that the MetaMask is connected to the Remix IDE.
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.
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.
- Select the
CaminoAdmin.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
.
Interacting with the Address
- Paste the address into the At Address field and click on the button.
- Confirm the interaction
Making the Query
Follow the steps below to make the query:
- Click the arrow to open the contracts methods list.
- Paste the address you want to query KYC/KYB States into the field and click
getKycState
button.
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.
Result
-
The result of the query will be displayed below the
getKycState
button. -
Common values are:
Value | State | Description |
---|---|---|
0 | No Verification | Given address has not undergone KYC verification |
1 | KYC Verified | Given address has undergone KYC verification |
256 | KYB Verified | Given address has undergone KYB verification |
257 | KYC & KYB Verified | Given 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:
Bit | Information |
---|---|
0 | KYC Verifed |
1 | KYC Expired |
8 | KYB Verified |
Example Result for KYC Verified Address
Example Result for Non-Verified Address
Example Result for KYC & KYB Verified Address
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.