The Starknet identity contract stands at the heart of the StarknetID's ecosystem. Though bearing similarities to the ERC721 contract, Starknet identity brings unique features that enhance data storage capabilities.
User Namespace: An indispensable namespace designated for users. Each identity NFT owner has sole access to this namespace. It serves as a storage option for a user's data like blockchain addresses where they would like to receive money.
Verifier Namespace: Each smart contract deployed on Starknet is automatically granted its distinct "verifier" namespace. This allows these smart contracts to manage and store data they've authenticated for your StarknetID.
The contract interface offers a detailed insight into the available interactions and data retrieval methods:
owner_of: Retrieve the owner of a given ID.
get_crosschecked_user_data: Access user-specific data.
get_crosschecked_verifier_data: Extract data authenticated by a verifier.
get_main_id: Fetch the primary ID associated with a user's address.
mint: Freely generate a new identity.
reset_main_id: Define or reset the primary ID.
set_verifier_data: Store data within either the user or verifier namespace.
For a thorough understanding of the functions and their parameters, please refer to the source code (opens in a new tab).
Imagine a scenario where a user wishes to set an NFT as their profile image. To ensure genuine ownership and prevent disputes, the following steps are taken:
- The user invokes the trusted profile pics smart contract, signaling their intent to set a specific NFT image as their profile picture.
- The profile pics smart contract, tasked with verifying NFT ownership, confirms that the user indeed owns the stated NFT.
- Once verified, the contract commits the NFT image data to the "profile_pic" section of the user's identity.
- This recorded data is nestled within the namespace of that particular verifying contract, serving as an authentication seal that attests to the genuineness of the stored data (in this instance, the NFT image).
For the convenience of developers and users, here are the contract addresses along with their respective links to the blockchain explorers: