Skip to main content

Verifying Wallets

Before you can interact with a user's blockchain items or associate their in-app identity with their blockchain address, you need a reliable way to confirm they own the wallet they provide. The Enjin Platform's wallet verification process provides a secure method to achieve this.

By verifying a user's wallet, you gain certainty that the public wallet address shared genuinely belongs to them. This verified link is essential for securely accessing their blockchain inventory, delivering items, or granting ownership-based perks within your application.

The verification process typically involves:

  1. Your application requests a unique verification code and QR code from the Enjin API.
  2. The user scans the QR code with their Enjin Wallet App.
  3. The Enjin Wallet App confirms ownership and securely provides the wallet address to the Enjin Platform.
  4. Your application retrieves the verified address from the Platform.

Once verified, you can confidently associate this blockchain address with the user's account in your system, enabling seamless blockchain interactions.

tip

If you need to send requests to user wallets, use WalletConnect instead.

What you'll need:

Verify Wallet with the Enjin API

Step 1. Initiate an Account Request

To initiate the account request process, run the following query:

Query:

query RequestAccount{
RequestAccount{
qrCode #Returns a QR code for your user to scan
verificationId #Save this for next step
}
}

Response:

{
"data": {
"RequestAccount": {
"qrCode": "https://platform.canary.enjin.io/qr?s=512&f=png&d=https://platform.canary.enjin.io/proof/MHg3OGFmYWIxYWQxMjk0YzFlZWY4MjdlNmFjNTM1MmJiOTVmNmFmNWJhNmUyNjk5ZGRkOTI3YjAwNmQ3ZDk0MzZjO2Vwc3I6QTIwMTBBSzlM",
"verificationId": "0x78afab1ad1294c1eef827e6ac5352bb95f6af5ba6e2699ddd927b006d7d9436c"
}
}
}

This will return a link to a QR Code for you to display to your user, and a unique verification id to track the request. In your application, you'll display this QR code to your user and instruct them to scan it with their Enjin Wallet App

.

Step 2: Verify Account

To confirm that the user scanned the QR code and approved the request, you can retrieve the account using two methods.

Option A: GetWallet

Using GetWallet and passing the verificationId from step 1, you will be able to get any information related to his wallet if the verification process succeeded.

Query:

query GetVerifiedWallet{
GetWallet(verificationId: "0x78afab1ad1294c1eef827e6ac5352bb95f6af5ba6e2699ddd927b006d7d9436c"){ #Set the verificationId from the RequestAccount response
account{
address
}
balances{
free
}
}
}

Response: If user has verified

{
"data": {
"GetWallet": {
"account": {
"address": "cxLU94nRz1en6gHnXnYPyTdtcZZ9dqBasexvexjArj4V1Qr8f" //The address of the verified account
},
"balances": {
"free": "86010842630734264894" // The amount of free ENJ in the verified account - ~86.0108 ENJ
}
}
}
}
Balances Format

API balances fields are formatted as u128 number type.
to get decimal value, divide the value by 10^18.

Response: If user has not verified

{
"data": {
"GetWallet": null
}
}

Option B: GetAccountVerified

This query can be used to fetch the status of the verification, while you are showing the QR code to the player, for example, when the query returns "verified": true you could hide the QR code and proceed with your onboarding workflow.

Query:

query GetAccountVerified{
GetAccountVerified(verificationId: "0x78afab1ad1294c1eef827e6ac5352bb95f6af5ba6e2699ddd927b006d7d9436c"){ #Set the verificationId from the RequestAccount response
verified
account{
publicKey
address
}
}
}

Response: If user has verified

{
"data": {
"GetAccountVerified": {
"verified": true,
"account": {
"publicKey": "0x5a6aae294416f3e875d9a8975658905002cfd3e5e64105d76296c4b0adbfd77e", //The public key of the verified account
"address": "cxLU94nRz1en6gHnXnYPyTdtcZZ9dqBasexvexjArj4V1Qr8f" //The address of the verified account
}
}
}
}

Response: If user has not verified

{
"data": {
"GetAccountVerified": {
"verified": false,
"address": null
}
}
}

Verify Flow Diagram

Explore More Arguments

For a comprehensive view of all available arguments for queries and mutations, please refer to our API Reference. This resource will guide you on how to use the GraphiQL Playground to explore the full structure and functionality of our API.