Documentation Index
Fetch the complete documentation index at: https://core.anylayer.org/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Mint a new Identity SBT (Soulbound Token) to create a decentralized identity with a human-readable ZKS ID.
Prerequisites
- Wallet Connection: Connected Web3 wallet
- ZKS ID Available: Desired ZKS ID must be available
- Gas Fees: Sufficient ETH for transaction fees
- No Existing Identity: User must not already have an identity
Minting Process
1. Check Availability
// Check if ZKS ID is available
const isAvailable = await identityContract.isZKSIdAvailable('alice.zks');
console.log('ZKS ID available:', isAvailable);
2. Mint Identity
// Mint new identity
const tx = await identityContract.mintIdentity(
'alice.zks', // ZKS ID
'Alice Smith', // display name
'https://alice.example.com/avatar.jpg', // avatar URL
{ value: mintingFee } // minting fee in wei
);
await tx.wait();
console.log('Identity minted!', tx.hash);
3. Verify Minting
// Check if identity was minted
const identity = await identityContract.getIdentity(userAddress);
console.log('Identity:', identity);
// Check ZKS ID resolution
const resolvedAddress = await identityContract.resolveZKSId('alice.zks');
console.log('Resolved address:', resolvedAddress);
Minting Parameters
Required Parameters
- zksId: Human-readable identifier (e.g.,
alice.zks)
- displayName: User’s display name
- avatarUrl: URL to user’s avatar image
Optional Parameters
- bio: User biography/description
- website: Personal website URL
- socialLinks: Array of social media links
Minting Fees
Fee Structure
| Network | Fee (ETH) | Fee (USD) |
|---|
| Ethereum | 0.01 ETH | ~$20 |
| Polygon | 0.001 ETH | ~$2 |
| Arbitrum | 0.001 ETH | ~$2 |
| Base | 0.001 ETH | ~$2 |
Fee Calculation
// Get current minting fee
const mintingFee = await identityContract.mintingFee();
console.log('Minting fee:', ethers.utils.formatEther(mintingFee), 'ETH');
// Calculate total cost including gas
const gasEstimate = await identityContract.estimateGas.mintIdentity(
'alice.zks',
'Alice Smith',
'https://alice.example.com/avatar.jpg',
{ value: mintingFee }
);
const gasPrice = await provider.getGasPrice();
const totalCost = mintingFee.add(gasEstimate.mul(gasPrice));
console.log('Total cost:', ethers.utils.formatEther(totalCost), 'ETH');
Error Handling
Common Errors
| Error | Description | Solution |
|---|
ZKS_ID_TAKEN | ZKS ID already exists | Choose different ZKS ID |
IDENTITY_EXISTS | User already has identity | Cannot mint second identity |
INSUFFICIENT_FEE | Not enough ETH for fee | Add more ETH to wallet |
INVALID_ZKS_ID | ZKS ID format invalid | Use valid format (name.zks) |
Error Handling Example
try {
const tx = await identityContract.mintIdentity(
'alice.zks',
'Alice Smith',
'https://alice.example.com/avatar.jpg',
{ value: mintingFee }
);
await tx.wait();
console.log('Identity minted successfully!');
} catch (error) {
if (error.code === 'ZKS_ID_TAKEN') {
console.error('ZKS ID is already taken');
} else if (error.code === 'IDENTITY_EXISTS') {
console.error('User already has an identity');
} else {
console.error('Minting failed:', error.message);
}
}
Best Practices
- Check Availability First: Always verify ZKS ID is available
- Handle Errors Gracefully: Implement proper error handling
- Estimate Gas: Calculate total cost before minting
- Store Transaction Hash: Keep record of minting transaction
- Verify Success: Confirm identity was created successfully