Guide 5: Preparing a Data Stream containing a password to protect a URL
This guide walks you through how to use Data Streams configured to expose an otherwise publicly available URL that is protected through a password that you can expose through a Data NFT.
Let's begin...
Step 1: Create the file that you want to set as your initial Data Stream
Here is a full sample file for you to inspect the JSON file you have to create:
In the data format above, here's what everything means :
The general JSON file skeleton structure seen above needs to be maintained.
category
represents the type of data that should be expected from your linkname
represents the name you want to give to your projectcreator
should be your name in order to be able to take credits for your workcreated_on
andlast_modified_on
should respect the above shown date format. The first one should be the date when you initially created the data stream and the other one should be updated whenever you update your data streamhost
should be the URL where your data resides that is protected by a passwordtoken_query_param
is an optional field that hints to other developers that they should include your password after the query param that this key has as value.token
should represent the password that you want the users having the Data NFT to use
By creating the JSON file like this you are preparing it to be fetched by people that want to view data inside of your Data NFT and use it (even programatically if needed)
Step 2: Hosting the file on Zedge Storage
You can host your file wherever you want that suits the Data Stream URL rules, but hosting it on Zedge Storage is one of the easiest ways
First login using your MultiversX wallet
Click on "My Data Bunker" in the header of the app
Click on "Create New Data Asset"
Choose "Dynamic Data Storage" and click "Next"
Choose "Uplaod my files" and click "Next"
Choose "Decentralized / Web3 Storage" and click "Next"
Choose "IPNS + IPFS" and click "Next"
Make sure the "Nested Stream" option is checked and upload your JSON
Choose a name and a creator for the given dataset
Click "Upload Data" and wait for the files to be uploaded
Copy "Your Asset's IPNS location" to your clipboard and use that as a URL to mint your Data NFT link any other normal link. As a note on this step, you can also open the link to your asset via the link provided inside Zedge Storage. You can see that the app created a manifest file which sends users to your actual file. This is important in the interaction with the Data Marshal, which powers the privacy of Data NFTs
Use the IPNS location (e.g. ipns://k51qzi... ) you copied to your clipboard to mint a Data NFT. When inputing that as a Data Stream in the Data Dex make sure to also add this at the end of the URL:
?dmf-nestedstream=1
Your IPNS should look like this at the end:
ipns://hash?dmf-nestedstream=1
Just mint it! If you use this, anyone owning the NFT will be able to use the Nested Stream View Data feature in order to access your game.
That's all! Using the above method will help you mint a Data NFT with an updatable, file that contains the password to your password-protected URL. You can always go to Zedge Storage to upload a new file under the IPNS hash you have created. IPNS is just like IPFS, but muttable (a bit more complicated than that, but that's for another tutorial/guide)
Last updated