Ownership verification
Verify if a specific account owns tokens of a collection
Verifying ownership is one of the most important actions for providing utility to token holders. Connecting a main wallet with their most valuable and important assets in order to verify ownership is not a safe behavior. This is why we offer ownership verification through the connected burner wallet.
The off-chain verification is offered in our Voxlink JavaScript library and is able to process ERC721, ERC1155 as well as ERC20 contracts. For the usage, you need to import our Voxlink library in the head section of your web application:
<script src="https://dev.voxlink.io/voxlinklib.js" />
In your JavaScript code, you can use the Voxlink library to either retrieve the corresponding main wallet
var { success, mainWallet } = await Voxlink.getMainWalletFromBurnerWallet(walletAddress);
and check for yourself by calling the "balanceOf" function of your collection smart contract or you can directly use our all-inclusive methods:
let isOwner = await Voxlink.hasTokens(collectionAddress, walletAddress);
// alternatively
let amountOfTokens = await Voxlink.balanceOf(collectionAddress, walletAddress);
Please note that our library does not make use of a web3 library. If you need to use a web3 provider, you can configure our library to use it. Check out the API documentation for the call.
For the on-chain verification you can import the following Solidity code in order to identify a valid burner wallet. Please note that the Voxlink connection between a main and a burner wallet is automatically verified by bidirectional cryptographic signatures upon creation.
We highly recommend to perform tests on Goerli testnet before deployment.
/*
Add the interfaces before your contract begins
*/
interface Voxlink {
function getBurnerWalletsFromMainWallet(address mainWallet) external view returns (bool success, address[] memory burnerWallets);
function getMainWalletFromBurnerWallet(address burnerWallet) external view returns (bool success, address mainWallet);
function burnerWalletExists(address _burnerWallet) external view returns (bool);
}
contract myNFTProject is ERC721{
address constant VoxlinkContractAddress = 0x0000000000000000000000000000000000000000;
/*
This method checks if the account, or the connected burner wallet, owns tokens of this collection
*/
function verifyOwnership(address account) public view returns (bool hasTokens){
// get the burnerwallet, if there is one
(bool success, address mainWallet) = Voxlink(VoxlinkContractAddress).getMainWalletFromBurnerWallet(account);
// if successful, the mainWallet will be used for verification
if (success){
account = mainWallet;
}
// in this example we assume that this contract is ERC721 compatible and exposes a balanceOf function
return this.balanceOf(account)>0;
}
}
Last modified 6mo ago