Retrieval with IPFS | IPFS Docs (2024)

In this quickstart guide, you will learn the different approaches to retrieving CIDs from the IPFS network and how to pick the most appropriate method for your specific needs.

You will fetch the image that was pinned in the publishing with a pinning service quickstart guide which has the following CID: bafybeicn7i3soqdgr7dwnrwytgq4zxy7a5jpkizrvhm5mv6bgjd32wm3q4.

The CID you will retrieve is actually a folder containing a single image file. The reason for this that when files are added to IPFS, the filename is not stored by default. To retain the filename, it's a common practice to wrap the file in a directory. In such instances, you end up with two CIDs - one for the file and another for the directory containing the file.

# Contents

  • IPFS retrieval methods
  • Verified vs. trusted CID retrieval
  • Fetching the CID with Kubo
  • Fetching the CID with an IPFS Gateway
  • Summary and next steps

# IPFS retrieval methods

There are two primary ways to retrieve files and directories published to IPFS:

  • Use an IPFS node by installing one of the IPFS implementations, e.g. Kubo on your computer. This allows you to fetch and verify CIDs from other nodes in the IPFS network.
  • Use an IPFS Gateway, an HTTP interface with the IPFS network that allows you to fetch data from IPFS using HTTP. Pinning services typically offer an IPFS gateway as a way to easily retrieve your CIDs.

The node option allows you access to the full suite of IPFS protocols. The Gateway option serves as a bridge in situations where you might be constrained to using HTTP, such as in web apps where your app users may not be running an IPFS node.

IPFS Gateways, in their most basic form, are typically IPFS nodes that are hosted by someone else and expose an HTTP interface to fetch CIDs, as shown in the diagram below:

Retrieval with IPFS | IPFS Docs (1)

# Verified vs. trusted CID retrieval

Another thing to consider when deciding between the two approaches is verification. By default, an IPFS node hashes each block and ensures that, when the file is constructed from the blocks (into a Merkle DAG), it results in the CID you requested. However, with IPFS Gateways, verification is optional.

Non-verified retrieval is also commonly referred to as trusted retrieval because you're trusting the gateway to return the correct response without calculating the hash.

While verification is almost always recommended, in reality, there are situations where trusted retrieval is the pragmatic choice, such as when embedding images on a website.

# Fetching the CID with Kubo

To fetch the CID with Kubo, complete the steps below:

  1. Ensure that the Kubo daemon is installed and running:

    $ ipfs daemon
  2. To fetch the file, run the ipfs get [CID] command:

    $ ipfs get bafybeicn7i3soqdgr7dwnrwytgq4zxy7a5jpkizrvhm5mv6bgjd32wm3q4

    The output should look as follows:

    Saving file(s) to bafybeicn7i3soqdgr7dwnrwytgq4zxy7a5jpkizrvhm5mv6bgjd32wm3q4647.61 KiB / 647.61 KiB [========================================================================================================================] 100.00% 0s

    A new folder with the same name as the CID was created:

    $ ls bafybeicn7i3soqdgr7dwnrwytgq4zxy7a5jpkizrvhm5mv6bgjd32wm3q4/welcome-to-IPFS.jpg

Congratulations, you have successfully fetched the CID.

# Fetching the CID with an IPFS Gateway

To fetch the CID using an IPFS gateway is as simple as loading one of the following URLs:

# Summary and next steps

In this quickstart guide, you learned the different approaches to retrieving CIDs from the IPFS network and how to pick the most appropriate method for your specific needs.

You then fetched the image that was pinned in the publishing with a pinning service quickstart guide using an IPFS Kubo node and an IPFS Gateway.

Possible next steps include:

Retrieval with IPFS | IPFS Docs (2024)
Top Articles
Your Complete Guide to Buying US Stocks in Canada
Is migrating to Canada worth it? | Expat US Tax
Skigebiet Portillo - Skiurlaub - Skifahren - Testberichte
Artem The Gambler
Dragon Age Inquisition War Table Operations and Missions Guide
Katmoie
Top Scorers Transfermarkt
Collision Masters Fairbanks
Red Wing Care Guide | Fat Buddha Store
What's New on Hulu in October 2023
B67 Bus Time
Snowflake Activity Congruent Triangles Answers
Grand Park Baseball Tournaments
Playgirl Magazine Cover Template Free
ᐅ Bosch Aero Twin A 863 S Scheibenwischer
Games Like Mythic Manor
5 high school volleyball stars of the week: Sept. 17 edition
Bx11
Golden Abyss - Chapter 5 - Lunar_Angel
Yard Goats Score
MLB power rankings: Red-hot Chicago Cubs power into September, NL wild-card race
Wbiw Weather Watchers
Happy Life 365, Kelly Weekers | 9789021569444 | Boeken | bol
Titanic Soap2Day
Directions To Nearest T Mobile Store
At 25 Years, Understanding The Longevity Of Craigslist
JVID Rina sauce set1
Scott Surratt Salary
Downloahub
49S Results Coral
My Dog Ate A 5Mg Flexeril
APUSH Unit 6 Practice DBQ Prompt Answers & Feedback | AP US History Class Notes | Fiveable
Tra.mypatients Folio
Help with your flower delivery - Don's Florist & Gift Inc.
How to Play the G Chord on Guitar: A Comprehensive Guide - Breakthrough Guitar | Online Guitar Lessons
Rocketpult Infinite Fuel
Merge Dragons Totem Grid
Msnl Seeds
Viewfinder Mangabuddy
Weather Underground Bonita Springs
Gold Dipping Vat Terraria
Firestone Batteries Prices
Seminary.churchofjesuschrist.org
COVID-19/Coronavirus Assistance Programs | FindHelp.org
Courtney Roberson Rob Dyrdek
Anthem Bcbs Otc Catalog 2022
Brauche Hilfe bei AzBilliards - Billard-Aktuell.de
How To Get To Ultra Space Pixelmon
Craigslist Pet Phoenix
About us | DELTA Fiber
Strange World Showtimes Near Atlas Cinemas Great Lakes Stadium 16
La Fitness Oxford Valley Class Schedule
Latest Posts
Article information

Author: Jonah Leffler

Last Updated:

Views: 6081

Rating: 4.4 / 5 (65 voted)

Reviews: 80% of readers found this page helpful

Author information

Name: Jonah Leffler

Birthday: 1997-10-27

Address: 8987 Kieth Ports, Luettgenland, CT 54657-9808

Phone: +2611128251586

Job: Mining Supervisor

Hobby: Worldbuilding, Electronics, Amateur radio, Skiing, Cycling, Jogging, Taxidermy

Introduction: My name is Jonah Leffler, I am a determined, faithful, outstanding, inexpensive, cheerful, determined, smiling person who loves writing and wants to share my knowledge and understanding with you.