Unlock Guides


How to Enable Members-Only File Access with Pinata and Unlock Membership NFTs

Here's how to store and manage exclusive content, and make that content accessible only to members. We’re going to take a look at how to do that using Unlock and Pinata.

UPDATE OCTOBER 2023: Pinata has announced it has discontinued its Submarine feature as of October 2023. This article will be revisited and updated when a reasonable workaround or replacement has been identified that enables similar functionality. Please direct any questions regarding this to Pinata.

UPDATE NOVEMBER 2023: As noted above, Pinata has discontinued its Submarine service. See 
How To Create Subscription Content with Unlock Protocol and Darkblock to learn how to implement similar functionality with Darkblock and Unlock Protocol.

The value of a membership is determined by the value provided to its members. Whether you’re a developer, an artist or an educator, you need a way to store and manage exclusive content, and make that content accessible only to the sub-set of your larger audience who can prove their membership status. One way is to offer unlockable content based on the holding of a membership NFT. We’re going to take a look at how to do that using Unlock and Pinata.

What is Pinata?

Pinata is a platform built on IPFS which can be used to upload, store and distribute rich media content, live videos, podcasts, music files, and more.

Pinata has a capability called “Submarining” which allows users to unlock access to members-only file access (also known as token-gating) with mechanisms including NFT ownership, retweets and geolocation. Submarining is a way to think of enabling exclusive access to files, video, podcast episodes, and the like.

Here’s how to set up members-only access to content. Let’s dig in.

Set up Unlock Protocol and get a Pinata account

For the purpose of this guide, you’ll want to deploy your Unlock Protocol membership smart contract (”Lock”) first. If you haven’t already created one, then see our guide “How to Create a Lock.”

Once your lock is created, you’ll be able to grab the contract address from the Unlock Dashboard. Click the copy icon to copy the lock’s smart contract address to your clipboard.

Next, if you don’t already have a Pinata account that enables Submarining, you’ll want to make sure you get signed up. To do this, click on the “Sign Up” button in the top right-hand corner of the Pinata home page. (If you already have a Pinata account, then click “Login” instead.)

Next, you’ll want to make sure you have the right level of subscription to Pinata. Click on the profile picture icon in the top right corner of the screen.

Choose “Billing” from the dropdown menu.

Select your paid plan based on your needs. “Picnic” level plans and above support Submarining.

Setting up members-only content with Pinata and Unlock Protocol

Now, we’re ready to get going. Head over to Submarine.me and log in using your Pinata account.

On the landing page, click the “Submarine New File” button.

When asked to “Choose how you’d like your submarined content to be unlocked,” choose “NFT Ownership.”

Make sure the network you choose on the dropdown menu under “Blockchain” and “Network” is the same one you deployed your “Lock” to. Paste the “Lock” address that you copied earlier into the “Contract Address” field.

Fill out the rest of the options. You can even get fancy with “Customize Unlock Screen” and upload your logo, brand colors, and a background image.

At the bottom, you get to choose what you’d like to Submarine. It can be a single file, or an entire folder.

When you’re done, click the “Upload and Continue” button.

Once it’s saved, you’ll see your submarined file in the list and you can click on the share button to embed it in your own webpage, share it in an email newsletter, link it from a blog post or however you want to allow your community to access their exclusive content.

The link that you share will direct people to your token-gated content’s unlock screen. When your audience clicks your link to access your Submarined file, they will be asked to connect their wallet.

Once the wallet is connected, they will be able to click “Unlock” to verify ownership of the NFT to access the content.

If the user does not have the required NFT, they won’t be able to go past the unlock screen.

If the user does have the required NFT, they will gain immediate access to the file or folder, hosted within Pinata’s private servers. Any file that you Submarine is stored securely with a CID (content identifier) that lets you know that file is the file you uploaded.

Individual images and files will be made immediately available in the browser. Videos and audio will stream with Pinata’s browser-based streaming, which allows for the video to be played immediately in high-definition.

For folders, if the folder has an index.html file in it (a website or web app), the website or app will automatically load. If it’s a folder of other content (like images, videos, or files), it renders a view like the one below.

If you decide later that you want to make a Submarined file public, you can easily set it as “public” from your Submarine.me dashboard.

For a complete demo of Submarine.me, check out this video from Justin Hunter, Pinata’s Head of Product.

If you’re looking for a deeper understanding of how to use the Submarining API from a more technical perspective, this blog post shows you how.

The creative power of members-only content with Pinata and Unlock Protocol

Once you’ve submarined a piece of content, the real fun begins. You can take the link to your unlock screen and share it anywhere you have an audience of membership NFT holders — your website, social media, Discord or an email newsletter.

As an artist, you can give your membership NFT holders a behind-the-scenes look to your creative process. As an educator, you can Submarine bonus tutorials. As a publisher, you can Submarine hidden chapters of your novel. The possibilities are endless.

If you’re already putting in effort to create and distribute content, adding members-only content using Pinata’s Submarining and Unlock Protocol is the next step to elevate your brand, and create an experience your audience will not soon forget.

Was this article helpful?

You need to have a “Lock” created already. See “How to Create a Lock”.

Table of Contents