paint-brush
Safeguarding Your Videos with NFT Marketplace and Advanced Cryptography in Livepeerby@paulspread
296 reads

Safeguarding Your Videos with NFT Marketplace and Advanced Cryptography in Livepeer

by Paul SpreadMarch 3rd, 2023
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

New CEO of YouTube Neal Mohan has expressed his belief that NFTs could transform the way creators and fans interact. I am excited to share my own web3 solution that leverages the power of Livepeer. This solution aligns with the direction that YouTube is heading and represents a step towards realizing their vision. Through this technology, creators can potentially engage with their audiences in new and exciting ways.
featured image - Safeguarding Your Videos with NFT Marketplace and Advanced Cryptography in Livepeer
Paul Spread HackerNoon profile picture


Introduction

The world of video content is rapidly evolving. As we look ahead to what the future may hold, the new CEO of YouTube, Neal Mohan, has expressed his belief that NFTs could transform the way creators and fans interact. While I cannot predict when YouTube will make its decision, I am excited to share my own web3 solution that leverages the power of Livepeer, a decentralized video infrastructure network.

This solution aligns with the direction that YouTube is heading and represents a step towards realizing its vision. Through this technology, creators can potentially engage with their audiences in new and exciting ways, and I am eager to showcase its capabilities. Join me as we explore the possibilities of this cutting-edge platform and its potential to transform the world of online content.

The Problem

Video content creators have been experiencing problems every day protecting their work from being copied and used without the author's permission. These problems have resulted in difficulties in obtaining remuneration and proving the rights of the creator, and the problems only continue to increase.

Therefore, the need to protect the content of the creator is clear. Here are a few reasons why video content creators need it.

List of Reasons Creators Need to Safeguard Their Videos

Protecting video content helps prevent unauthorized use, profiting, or misrepresentation, maintaining control over the presentation, and safeguarding brand integrity.

It also helps generate revenue, meet legal requirements, prevent piracy, increase engagement, enhance competitive advantage, and preserve the creator's hard work for long-term success.

My Solution to the Problem

The initial data has the following requirements: In order for everyone to use it without restrictions, video content must be stored decentralized, and access to the video must be available only to those who currently own it. Possibility of selling video. Receipt of royalties on further resale.

The marketplace was made where you can create NFTs, upload videos to decentralized storage, create video content protection using cryptography, and sell further NFTs while transferring to the new owner not only the ownership of NFTs but also the ability to view videos also using cryptography.

To build the application, I used the following technology stack:

Mumbai Blockchain: Smart contracts on the Mumbai blockchain to implement the logic of the marketplace and NFT minting.

Livepeer: Livepeer API enables the seamless upload of video content, while IPFS provides a decentralized storage solution for NFT metadata.

Metamask: Transactions are approved using the Metamask wallet, which also manages content encryption and decryption.

Next and React: Next.js and React.js serve as the foundation for building an intuitive and responsive application interface.

I will use several diagrams to provide a clearer picture of how the marketplace works.

To create an NFT, you must first upload a video file to a decentralized storage system to get a link to the file. If the platform you're using doesn't offer this service, you'll need to use a specialized service instead. Once you've added some information about the NFT and the link, you can confirm the creation of the NFT by using your wallet.

Once the process is complete, you will own the NFT, and the video content will be linked to it through the link. However, it's worth noting that anyone can play the video by using the link, even if they don't own the NFT.

To protect content, we are using both symmetric and asymmetric cryptography.


This UML diagram demonstrates the process of creating a secure NFT with a protected video using symmetric and asymmetric encryption techniques. In the marketplace app, users can create NFTs by uploading video content on the NFT minting page. The app uses the Livepeer API to store this content, which returns a playbackId that can be used to view the video through the Livepeer Player.

To ensure the security of the playbackId, a symmetric SecretKey is generated, which is then used to encrypt the playbackId into a hash called EncodedPBID. The secret key is also encrypted using asymmetric encryption by calling the method to encrypt the Metamask into EncodedSecretKey, using the public key of the wallet. The EncodedPBID and other relevant data are stored in IPFS, and a URI is created for the NFT.

To mint the NFT, the EncodedSecretKey is passed as a parameter along with a call to the NFT minting method. The EncodedSecretKey can only be decrypted by the owner of the NFT using their private key from the Metamask wallet. When an NFT is resold, a new EncodedSecretKey will be written to a new address, which will only be available for decryption to the new owner.

Overall, this UML diagram describes a comprehensive and secure process for creating and minting NFTs with protected video content, ensuring the security of the playbackId and the privacy of the EncodedSecretKey.

The owner NFT can play encoded video.

This UML diagram shows the process of the owner of an NFT playing the encoded content. First, the user interface (UI) communicates with the NFT smart contract to obtain the data of the NFT, including the URI and EncodedSecretKey. The UI also queries IPFS for the metadata of the NFT, including the NFT info and EncodedPBID.

When the user wants to play the video, the UI calls the decrypt function in Metamask to decrypt the EncodedSecretKey using the user's wallet private key. The decrypted SecretKey is then used to decrypt the EncodedPBID to obtain the playbackId. Finally, the UI communicates with Livepeer to play the video in the Livepeer Player using the obtained playbackId.

The question is, how can the NFT with encrypted secrets be sold?

This UML diagram illustrates the process of a buyer placing a bid on an NFT listed for sale in a marketplace contract and the subsequent acceptance of the bid by the owner. The buyer fills in the required information for the bid, including the bid price, their wallet's public key, and a message to the seller. This information is then approved and passed on to the marketplace smart contract, which lists the new bid in the user interface.

Once the owner accepts the bid, the EncodedSecretKey is fetched from the NFT smart contract, and the owner's Metamask wallet decrypts it to obtain the SecretKey. The SecretKey is then encrypted using the buyer's public key to create a newEncodedSecretKey, which is approved by the owner and passed on to the marketplace smart contract for storage.

The marketplace smart contract deducts the applicable tax from the bid price and makes the remaining amount available for the seller to withdraw. Finally, the NFT smart contract saves the newEncodedSecretKey mapped with the buyer's wallet address, and the buyer can now view the NFT as their own.

Conclusion

The present NFT marketplace offers the capability to exclusively view content for the NFT proprietor, assuring video content creators that only NFT buyers are watching their videos. Additionally, the reselling of NFTs provides creators with royalties. However, encryption solely applies to the play ID, and the content itself remains unencrypted throughout Livepeer networks. This may not be suitable for extremely confidential videos that require encryption and storage on an IPFS or Livepeer network.

I have a solution and am currently developing a technical proposal to enhance the Livepeer player. This will enable it to play videos from a Base64 string, similar to a video player launched from an HTML tag.

<video src="sourceasbase64string"></video>

This solution is suitable for those seeking to keep their insider videos encrypted and sleep well. I will share further details about this in my next post.

Some resources with active links:

Livepeer
The marketplace

Video tutorial of the marketplace: