This tutorial will help guide users through uploading and minting a video as an NFT
using Livepeer Video Services.
Click to expand
Livepeer
is a decentralized video transcoding platform.
Livepeer Video Services
makes adding video streaming features into your web3 apps easy. It can handle live streams or video files.
- 💚 Node. js installed on your computer 💻
node >=10.0.0
oryarn >=1.0.0
- [Yarn]
- 📹 Have a
.mp4
video file to mint 🌿 - 🦊 Metamask wallet 👛
- Have
Polygon/Mumbai Testnet
ANDMATIC
in your Metamask.
Get an API key
from Livepeer here
Click Create API Key
Enter the name for your API key
and then Click Create.
The page should look like this when you create the API key
:
Navigate to a folder 📁 where your video file 🎥 is located
- Example:
livepeer.mp4
Run the following command in your terminal or command prompt to install the Livepeer CLI
(Command Line Interface):
npm install -g @livepeer/video-nft
Run the following command in your terminal: video-nft.
-
Enter your
Livepeer API key.
-
Enter the name of the
.mp4
file you want to use -
Name you want to give to your NFT
-
Optionally customize the metadata for your
video NFT
by hittingY
orN.
Once your video has successfully uploaded, you will get an object with fields, including your IPFS hash containing your metadata:
{
"videoFileCid": "QmRNZBCDtuBcvmX1W8U3M9xuEqRYLv6P7mNw8m1v1b91Wt",
"nftMetadataCid": "QmYwabdPZDpcdQf2indzCSWhko8fPvKRAWXoFm5Ka1JB31",
"videoFileUrl": "ipfs://QmRNZBCDtuBcvmX1W8U3M9xuEqRYLv6P7mNw8m1v1b91Wt",
"videoFileGatewayUrl": "https://ipfs.livepeer.com/ipfs/QmRNZBCDtuBcvmX1W8U3M9xuEqRYLv6P7mNw8m1v1b91Wt",
"nftMetadataUrl": "ipfs://QmYwabdPZDpcdQf2indzCSWhko8fPvKRAWXoFm5Ka1JB31",
"nftMetadataGatewayUrl": "https://ipfs.livepeer.com/ipfs/QmYwabdPZDpcdQf2indzCSWhko8fPvKRAWXoFm5Ka1JB31"
}
The last line after the successful upload provides a URL like this:
https://livepeer.com/mint-nft?tokenUri=ipfs://QmYwabdPZDpcdQf2indzCSWhko8fPvKRAWXoFm5Ka1JB31
You can pass in your custom ERC721 contract
address or use the contract provided by Livepeer.
Click Connect to Metamask
button
Choose either Polygon Testnet
or Polygon Mainnet.
Only Polygon network is supported right now.
Prerequisite:
- Be sure to have your
Metamask
network configured to thePolygon Testnet
orPolygon Mainnet.
If you click on the button Polygon Testnet
or Polygon Mainnet,
it should configure your metamask to add and change your network.
- Be sure to have some Matic Token in your
Metamask
wallet
Polygon faucet can be found at https://matic.supply.
Make sure your Metamask
or web 3.0 wallet is connected to the Polygon blockchain.
If you need some Testnet Matic, go to this URL https://faucet.polygon.technology/.
- After navigating to the URL provided, you can leave the contract field blank and default to Livepeer's contract.
- Hit
"Mint NFT"
You'll have to confirm the transaction and pay for the gas in Metamask
.
You just minted your nft!
Click on the link Check it out on OpenSea
to view your video NFT.
You can view the video nft from this tutorial rignt here
To view the metadata for this NFT, copy the IPFS hash provided to you in the terminal after uploading your video.
You can take this hash and navigate to https://ipfs.io/ipfs/your-ipfs-hash-here
Example: https://ipfs.io/ipfs/QmYwabdPZDpcdQf2indzCSWhko8fPvKRAWXoFm5Ka1JB31
Lets build a video uploader that uses the sdk that you can upload your video using livepeer
- 💚 Node. js installed on your computer 💻
node >=10.0.0
oryarn >=1.0.0
Create a folder called video-nft-server
mkdir video-nft-server
Next run these commands:
cd video-nft-server
npm init
or
cd video-nft-server
yarn init
- Install the following npm packages to your package.json
npm install --save @livepeer/video-nft cors dotenv express multer
or
yarn add @livepeer/video-nft cors dotenv express multer
mkdir uploads