The PhygitalAsset smart contract is based on the LSP8Enumerable and allows the user to implement phygitals in a simple but efficient way.
- A Phygital Asset (= extended LSP8 contract) is comprised of a specified amount of phygitals (= LSP8 tokens), whose addresses are forming the merkle tree to verify their validity/existence during minting (similar to a whitelist)
- A Phygital (= LSP8 token) is represented by an asymmetric key-pair (e.g. stored in a NFC tag or QR code)
- The public key is called Phygital address
- The private key is used to sign the Phygital Owner (= owner's universal profile address) concatenated with a Nonce to verify the ownership, e.g. during minting and after transfers
- The Phygital Id results from the keccak256 hash of the abi-encoded phygital address (= LSP8 token id of type unique id)
- The verified ownership status indicates whether the currently assigned owner has verified the ownership of the phygital. This is only possible if he/she is in possession of the physical part of the phygital, since they need the private key of the phygital to sign their own universal profile address and the current nonce to prove real ownership. During minting, the status is set to true, but changes to false after each transfer. So that the new owner must verify the ownership to turn it back to true.
Raw interaction without the Backend
- Upload LSP4 metadata for collection to IPFS and create LSP2 JSONURL
- Upload LSP4 metadata and image directories which contain the data for the phygitals to IPFS and create the base uri
- Compile list of phygital addresses (= phygital collection)
- Upload the collection to IPFS and create a LSP2 JSONURL
- Calculate the merkle root for the collection
- Deploy PhygitalAsset contract instance with the prepared data
- Retrieve phygital address (e.g. from NFC tag or QR code)
- Sign your universal profile address concatenated with 0 (initial phygital nonce) with the private key of the phygital
- Determine merkle proof from the collection merkle tree
- Mint PhygitalAsset token with the prepared data
- Retrieve phygital address (e.g. from NFC tag or QR code)
- Sign your universal profile address concatenated with the current phygital nonce with the private key of the phygital
- Verify PhygitalAsset token ownership with the prepared data