On-Chain Integration
Your on-chain smart contract has to check for a valid Civic Pass during program execution and reject transactions from non-compliant users (users without an active Civic Pass).
For each blockchain supported by Civic Pass, we provide you with a library that is tailor-made to the programming model of the chain.
Integrating a Civic Pass check in your Solana on-chain program is very easy.
Import the solana_gateway
Rust crate from crates.io and call Gateway::verify_gateway_token_account_info
For your program to be able to call the integration library, the following parameters must be passed as inputs to your dApp's transaction:
userWallet
: The wallet account for the dApp user (e.g. the trader in a defi application). A Civic Pass must have been already issued to this wallet.gateway_token
: The address of the Civic Pass (token). This address can be accessed in the dApp through theuseGateway
hook on the Civic React Component once the user has passed Gatekeeper verification.gatekeeper_network
The gatekeeper network on which the Civic Pass has been issued. See here for test keys or contact us to discuss.
Error handling
If something goes wrong or the token is invalid the Gateway call will return a GatewayError
. The possible values can be seen in error.rs. For error cases, the dApp smart contract should reject the transaction.
Last updated