Identity NFT

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

  1. 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.

  2. 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:

  1. The user invokes the trusted profile pics smart contract, signaling their intent to set a specific NFT image as their profile picture.
  2. The profile pics smart contract, tasked with verifying NFT ownership, confirms that the user indeed owns the stated NFT.
  3. Once verified, the contract commits the NFT image data to the "profile_pic" section of the user's identity.
  4. 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: