Inspiration
YouTube Video NFTknz inspiration came from the opportunities that NFTs offer to social media creators to go beyond the kinds of monetization they are allowed by the existing platforms. Additionally, to try to address one of the biggest issues of NFTs, ownership, and copyright.
What it does
This first prototype focuses on tokenizing YouTube videos as NFTs. This way, the creators can explore the new monetization opportunities offered by NFTs beyond YouTube video embedding. To address ownership and copyright issues, video ownership is verified using a Chainlink oracle. The oracle consumes YouTube's API and checks if some predefined text has been added to the video description, proofing this way control of the corresponding YouTube account.
To further clarify the implications of NFT transfer, NFT metadata is based on semantic data serialized as JSON-LD that, in addition to the standard NFT attributes like title or image, it describes in a machine-actionable way the reuse terms being licensed to the NFT owner.
How we built it
Chainlink oracles (one for Rinkeby and another for Mumbai) have been deployed. The corresponding Chainlink nodes use the YTAdapter included in the GitHub repository to consume YouTube API and check that the requested text is included in the YouTube video description.
Before minting, a request is sent to the corresponding oracle to check if the video description retrieved through the API includes a link to the tokenId to be minted. Token identifiers are generated from the YouTube video identifier so all NFTs for the same videoId share the first 240 bits. The last 16 bits are reserved to identify the edition of the NFT.
If the oracle finds the expected tokenId in the video description, the current user controls the corresponding YouTube account, and ownership is asserted on-chain. The NFT is minted and ownership is recorded on the NFT smart contract. Minting further editions of the same YouTube video won't require verification through the oracle, it will be just checked that the minter is the registered owner.
The NFT metadata is stored on IPFS through NFT.storage. The metadata points to semantic data based on JSON-LD. It is serialized so it is also compatible with what NFT marketplaces like OpenSea expect. The standard NFT attributes like title, description, image... appear as plain JSON. The rest of the metadata uses semantic vocabularies like Schema.org and ontologies like the Copyright Ontology to capture the details about what is licensed to the NFT owner from a copyright perspective.
The smart contracts for the NFT and oracles have been deployed using Alchemy to the testnets Ethereum Rinkeby and Polygon Mumbai. Finally, for the frontend, Moralis has been used. A server has been configured for both testnets and consumed from the frontend so it is possible to switch between both testnets.
The frontend, based on Moralis React, lists YouTube Video NFTs and their transactions. After authenticating, a user can also look at her/his wallet showing the YTVideo NFTs owned or mint new NFTs for her/his videos. Finally, the frontend also allows exploring a particular NFT edition or all the editions for a given YouTube video.
Challenges we ran into
The first challenge was to create the smart contracts infrastructure required. For instance, generating token identifiers including a video-specific part and the last bits to represent the edition of the NFT. Then, connecting the minting process to the oracle, so minting the NFTs is just done when the oracle callback specifies that ownership has been verified.
Another challenge was to settle a development environment that facilitated local development and testing using a local network while simulating the presence of the Chainlink oracle, without requiring any code changes beyond the use of the MockOracle. This part might be useful for other developers and eventually become part of the Chainlink started kits. The tests include OracleRequest events listeners that automatically fulfill them based on the input parameters. Additionally, we have developed a task that runs the same listener so the presence of the oracle can be simulated while interacting with the local network.
Finally, the third main challenge was about the NFT metadata, which should combine semantic data to unambiguously specify the terms being licensed by the NFT while being compatible with existing NFT marketplaces like OpenSea.
Accomplishments that we're proud of
- YouTube Video NFTs with multiple editions for the same video identifier.
- Video ownership verification using a Chainlink oracle.
- Rich NFT metadata stating the terms being licensed to the owner using semantic metadata and ontologies.
- Semantic metadata representation using JSON-LD but compatible with existing NFT marketplaces, so NFTs can be traded there.
- Frontend that facilitates user experience, including verifying that the YouTube video exists, fetching its title, or monitoring oracle verification events so the users get feedback through the whole minting process.
What we learned
Though I had some previous experience with blockchain and fronted development, this was the first time using Hardhat or React. This has impacted a lot the development. Fortunately, it was possible to start from the Chainlink hardhat-starter-kit and the Moralis React templates. They have been customized to fit the needs of the project. During the process, a lot has been learned about Chainlink infrastructure or Moralis features. The task has been also extensively facilitated by the integration of other tools like NFT.storage to facilitate the interaction with IPFS or Alchemy to seamlessly integrate the different testing networks.
What's next for YouTube Video NFTknz
The experience with Polygon Mumbai has been really good and after seeing the very attractive minting costs of this network, we are seriously considering the deployment of the tool in Polygon Mainnet.
Additionally, we would like to explore ways to allow users to customize the terms licensed through each NFT they mint, configure the number of editions per video, or extend the features to other social networks like Facebook or Twitter.
Built With
- alchemyapi
- chainlink
- hardhat
- ipfs
- json-ld
- moralis
- nft.storage
- polygon
- react
- solidity
- youtube


Log in or sign up for Devpost to join the conversation.