Smart Contracts
Pingify smart contracts are abstracted out into their own domains and responsibilities, you have the following:
Pingify.sol - Core Pingify contract, holds mostly NFTs, NFT metadata and tokenURIs
PingifyMinter.sol - The sole minter for Pingify.sol, holds the minting functionality, performs checks on namspace ownership and deducts minting tokens.
PingifyMintingToken.sol - Minting token ERC-20 contract
PingifyNamespace.sol - Holds Pingify Namespace NFTs and tokenURIs for Namespace metadata
PingifyIdentity.sol - Manages Pingify usernames, avatars and badges (badges are claimed by completing blockchain quizzes in the Pingify App)
PingifyApp.sol - Holds additional app functionality, notification service keys, app versions
Utils.sol and NamespaceUtils.sol - Inherited libraries used for deriving Token Names from 256 integers and checking for namespaces.
Token Names
Token Names are derived from an NFTs unique 256bit integer IDs. The ID numbers are converted to base38 with the following index map “0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ._”. This adds context to an otherwise less useful integer.
NFT Metadata
Each Pingify NFT has Metadata that can be updated by its owner, it is heavily optimised to avoid using up storage slots and version controlled to allow for future updatability.
By compressing metadata into one hex it automatically fits many formats. The only thing that must stay persistent is the first 4 characters, these form the identifying metadata type and inform the application how to interpret the data the follows.
The current metadata type in use utilises the following structure as a hexadecimal:
Version number: Digits 1-4
Metadata version converted from integer to Hex. Must be padded with 0’s and can fit 65,535 combinations, plenty enough for future types.
IV Vector: Digits 5-36
IV (Initialization Vector) adds randomness to the following encrypted data, ensuring identical data encrypts differently each time.
Encrypted Data: Digits 37+
The remaining data makes up the encrypted values, these values are the Icon ID
+ Title
+ Description
+ Note
converted to hex as utf-8, separated using the \x1F
unit separator and encrypted.
The encryption uses a key derived from an owner signed message of the NFTs ID. Because each ID is unique, the encryption key never enables decryption of any other NFT metadata, and the owner can always decrypt their own metadata without any additional storage or dependancies (unless it changes ownership). A privacy preserving and practical solution.
This key is included in the NFTs sharable url to be used for decryption of the metadata.