Skip to content

Commit

Permalink
How to set up an IPFS account
Browse files Browse the repository at this point in the history
  • Loading branch information
timothymcmackin committed Jan 17, 2025
1 parent 47e157c commit 9439383
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 2 deletions.
52 changes: 52 additions & 0 deletions docs/developing/ipfs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
title: Storing data and files with IPFS
authors: 'Tim McMackin'
last_update:
date: 17 January 2025
---

Because storage space on blockchains is expensive, developers don't put large files or large pieces of static data on Tezos.
Instead, they configure off-chain storage for the files or data and put a link to that data on Tezos itself.
There are different ways to store data in this way, but many blockchain developers use the InterPlanetary File System (IPFS) protocol because it is decentralized.

Some examples of files or data that developers often store on IPFS are:

- Smart contract metadata
- Token metadata
- Token media, such as thumbnails and preview images

One way to upload (or _pin_) data to IPFS is to use Pinata's IPFS provider.
Follow these steps to set up a Pinata account and use it to pin data to IPFS:

1. Create a free Pinata account at https://app.pinata.cloud/developers/api-keys.

1. Go to the API Keys tab and click **New Key**.

1. On the Create New API Key page, expand **API Endpoint Access > Pinning** and enable the `pinFileToIPFS` and `pinJSONToIPFS` permissions, as in this picture:

![Selecting the permissions for the Pinata key](/img/developing/pinata-key-permissions.png)

1. In the **Key Name** field, give the key a name, such as "My Key."

1. Click **Create Key**.

The API Key Info window shows the API key and secret, which you must copy immediately, because they are not shown again.

1. Copy the API Key and API Secret fields and save the values.

You can see the new API key on the API Keys tab:

![The new Pinata API key in the Pinata web app](/img/developing/created-pinata-key.png)

Now you can upload data to IPFS via Pinata in many different ways, including:

- Directly on the Pinata web site
- The SmartPy `sp.pin_on_ipfs` function; see [Uploading metadata](https://smartpy.io/manual/scenarios/metadata#uploading-metadata) in the SmartPy documentation
- The Pinata API and SDK; see https://docs.pinata.cloud

:::warning

Keep your Pinata API Secret private; do not expose it in a frontend web application.
If you want to pin data to IPFS in a web application, you may need to work with Pinata in a backend application to keep your Pinata information secret.

:::
2 changes: 1 addition & 1 deletion docs/tutorials/build-an-nft-marketplace.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ You will learn:
1. Optional: If you haven't worked with Tezos NFTs before, consider doing the tutorial [Create NFTs from a web application](/tutorials/create-nfts) first.

1. Set up an account with Pinata if you don't have one already and get an API key and API secret.
<!-- TODO link to info on setting up IPFS -->
For information about setting up a Pinata account, see [Storing data and files with IPFS](/developing/ipfs).

1. Make sure that you have installed these tools:

Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/build-an-nft-marketplace/part-1.md
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ The mint page uses a form that accepts information and an image and sends a tran
For the complete content of the mint page, see the completed part 1 app at https://github.com/marigold-dev/training-nft-1.

1. In the file `app/.env`, replace the default `VITE_PINATA_API_KEY` and `VITE_PINATA_API_SECRET` values with your Pinata API key and API secret.
<!-- TODO link to info on setting up IPFS -->
For information about setting up a Pinata account, see [Storing data and files with IPFS](/developing/ipfs).

Now the form has a working mint page.
In the next section, you use it to mint NFTs.
Expand Down
1 change: 1 addition & 0 deletions sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ const sidebars = {
'developing/testing',
'developing/testnets',
'developing/sandbox',
'developing/ipfs',
{
type: 'category',
label: 'The Octez client',
Expand Down
Binary file added static/img/developing/created-pinata-key.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/developing/pinata-key-permissions.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9439383

Please sign in to comment.