Starknet Identity
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.
🔗 View the source code on GitHub (opens in a new tab)
Key Features
-
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.
Contract Interface Overview
The contract interface offers a detailed insight into the available interactions and data retrieval methods:
owner_from_id
: Retrieve the owner of a given ID.get_user_data
&get_crosschecked_user_data
: Access user-specific data.get_verifier_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.set_main_id
&reset_main_id
: Define or reset the primary ID.set_user_data
&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).
Use Case: NFT Profile Pictures
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).
Deployed Contracts
For the convenience of developers and users, here are the contract addresses along with their respective links to the blockchain explorers:
-
Mainnet:
- Address:
0x05dbdedc203e92749e2e746e2d40a768d966bd243df04a6b712e222bc040a9af
- View on StarkScan (opens in a new tab)
- View on Voyager (opens in a new tab)
- Address:
-
Goerli Testnet:
- Address:
0x783a9097b26eae0586373b2ce0ed3529ddc44069d1e0fbc4f66d42b69d6850d
- View on Testnet StarkScan (opens in a new tab)
- View on Goerli Voyager (opens in a new tab)
- Address:
-
Sepolia Testnet:
- Address:
0x718d9172f6e36183abeeff1a0db76a1851cef4ed9b9c13896da79ef4bfcb4d0
- View on Spolia StarkScan (opens in a new tab)
- View on Sepolia Voyager (opens in a new tab)
- Address: