8000 GitHub - grandzero/icp-nft
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

grandzero/icp-nft

Repository files navigation

Overview

This project introduces a novel way to manage and share social links using the blockchain technology on the Internet Computer Protocol (ICP). By leveraging the unique properties of Non-Fungible Tokens (NFTs), we enable users to mint their own social links as NFTs, encapsulating digital identities into a single, secure, and immutable token.

At its core, the project provides a seamless integration of social networking and blockchain, allowing users to store their social media links (Twitter, Facebook, Instagram, Discord, and personal websites) directly on the blockchain as part of an NFT's metadata. This approach not only ensures the authenticity of the user's social links but also offers a new layer of interaction within the digital space.

Once an NFT is minted, the user's social links are securely stored on the blockchain and can be shared through a simple and innovative mechanism: a QR code. This QR code, generated by the canister, redirects anyone who scans it to a URL with the token ID appended. This URL, intended to be handled by a frontend (yet to be implemented), will facilitate the retrieval of the user's social links by querying the token ID. This process ensures that sharing social links is not only secure but also user-friendly and efficient.

The project is built with several key features in mind:

Immutability: Once minted, the NFT serves as a permanent record of the user's social links on the blockchain. Privacy and Control: Users have full control over their social links, with the ability to edit their NFT metadata to update links as necessary. Ease of Sharing: By using a QR code linked to their unique token ID, users can share their social presence effortlessly and instantly. No Transferability: To maintain the integrity of personal social links, NFTs in this collection are non-transferable. This initiative is more than just a technical implementation; it's a step towards integrating blockchain technology into everyday social interactions, providing a bridge between decentralized identity and social media presence. Whether for personal branding, professional networking, or simply sharing your digital footprint, this project paves the way for innovative interactions in the digital age.

For developers and users alike, this project is an opportunity to explore the convergence of NFTs and social media, offering a glimpse into the future of digital identity management on the blockchain. Join us in reimagining how we share our social links, one NFT at a time.

Written with chatGPT

Prerequisites

  • Install the IC SDK.
  • Download and install git.
  • wasm32-unknown-unknown targets; these can be installed with rustup target add wasm32-unknown-unknown.

Functions

Initialization and Upgrade

  • init(args: InitArgs): Initializes the canister with given arguments.
  • pre_upgrade(): Prepares and serializes the canister's state before an upgrade.
  • post_upgrade(): Restores the canister's state after an upgrade.

NFT Management

  • mint(to: Principal, metadata: MetadataDesc): Mints a new NFT. User need to provide social links like twitter, facebook, instagram, discord etc.
  • burn(token_id: u64): Burns (destroys) an NFT.

NFT Transfer, Approval and Access Control

NFT Transfer is not allowed. Every user can mint one nft and store their datas in metadata. Since SoNFT is a social linking nft, it doesn't make sense to transfer social links.

Query Functions

  • balance_of(user: Principal): Returns the number of NFTs owned by a user.
  • owner_of(token_id: u64): Returns the owner of a specific NFT.
  • name(): Returns the name of the NFT collection.
  • symbol(): Returns the symbol of the NFT collection.
  • total_supply(): Returns the total number of NFTs minted.
  • supported_interfaces(): Lists the supported interfaces (DIP721 standards).
  • get_metadata(token_id: u64): Retrieves metadata(Social links) for a specific NFT. Returns social links as serialized json.
  • get_metadata_for_user(): Retrieves metadata as qrcode (format for qrcode data will be like [BASE_URL]/nft/[TOKEN_ID]) for all NFTs owned by a user. One principal can mint only one nft

Customization Functions

  • set_name(name: Strin 665B g): Sets the name of the NFT collection.
  • set_symbol(sym: String): Sets the symbol of the NFT collection.
  • set_logo(logo: Option<LogoResult>): Sets the logo for the NFT collection.
  • set_base_url(url: String): Owner can set a base url for nft collection. This url will be used in qrcode. It can be a frontend canister or centralized frontend. Qrcodes will redirect user to [BASE_URL]/nft/[TOKEN_ID] and frontend need to call getMetadataDip721 function to get links.

User Customization Functions

  • change_nft_info: User can edit only her own nft metadata. New links will be stored in state and old links will be removed. Qrcode will remain same.

Demo

This Rust example comes with a demo script, demo.sh, which runs through an example workflow with minting and trading an NFT between a few users. This is primarily designed to be read rather than run so that you can use it to see how basic NFT operations are done. demo.sh deploys code, mints an nft, calls getMetadata721 to see current social links, then calls getMetadataForUserDip721 to get base64 encoded qr image, then calls change_nft_info and changes one of the social links and then calls getMetadata721 to see the change.

1 - Open Terminal

First, open the Terminal application on your Mac. You can find it in the Applications folder under Utilities, or you can search for it using Spotlight.

2- Make the Script Executable

Before running the script, you need to make sure it is executable. You can do this by running the following command:

chmod +x demo.sh

### 3- Run the Script Now, you can run the script by typing:

./demo.sh

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0