IPFS Primer
ipfs.ioIPFS Docs
  • Introduction
  • Tutorial: Install and Initialize IPFS
    • Lesson: Download and Install IPFS
    • Lesson: Initialize your IPFS Repository
  • Tutorial: Files on IPFS
    • Lesson: Add Content to IPFS and Retrieve It
    • Lesson: Wrap Filenames and Directory Info around Content
    • Lesson: Pinning - Tell IPFS to Keep a File
  • Tutorial: Going Online - Joining the Distributed Web
    • Lesson: Connect your node to the IPFS network
    • Lesson: Find Peers on the Network
    • Lesson: Retrieve content from a Peer
  • Tutorial: Interacting with the Classical (HTTP) Web
    • Lesson: Use an HTTP browser to retrieve files from local IPFS gateway
    • Lesson: Get content through the public ipfs.io gateway
    • Lesson: Access IPFS content through any IPFS gateway
  • Tutorial: The Myriad ways to Access and Distribute IPFS Content
    • The Power of Content-addressing
    • Retrieving content from a peer
    • Review these lessons from the Tutorial on Interacting with the Classical (HTTP) Web
      • Review: Using an HTTP browser to retrieve files from local IPFS gateway
      • Review: Using the public IPFS gateways at ipfs.io
      • Review: Access IPFS content through any IPFS gateway
    • Lesson: Access IPFS content through Tor gateways (experimental)
    • Lesson: Run IPFS over Tor transport (experimental)
    • Lesson: Access IPFS content through a browser extension
    • Lesson: Sneakernets - moving the data on USB Drives and other Hardware
  • Tutorial: Making Changes on the Permanent Web
    • Lesson: Create a Simple Webpage and Add It to IPFS
    • Lesson: View Your Webpage with IPFS and Publish to IPNS
    • Lesson: Modify Your Webpage and Republish to IPNS
    • Lesson: Generate and Use a New IPNS Name Keypair
  • Tutorial: Merkle Trees and the IPFS DAG
    • Lesson: Turn a File into a Tree of Hashes
    • Lesson: The Cryptographic Hash
    • Lesson: Build a Tree of Data in IPFS Using Cryptographic Hashes to Link the Pieces (a Merkle DAG)
    • Lesson: Explore the types of software that use hash trees to track data (to come)
  • Tutorial: Dynamic Content on IPFS
    • Disclaimer: Dynamic content on IPFS is a Work in Progress (to come)
    • Lesson: Add data to the DAG (locally) (to come)
    • Lesson: Tell peers about your Changes (to come)
    • Lesson: Use hashes to get someone's changes from IPFS (to come)
    • Lesson: Use a pub/sub strategy to pass around messages about changes (to come)
    • Lesson: Resolve conflicts with a merge strategy (CRDTs) (to come)
  • Privacy and Access Controls on the Distributed Web (to come)
    • Reader Privacy & Writer Privacy (to come)
    • Private Networks (to come)
    • Encrypting Content (to come)
    • More dynamic encryption: capabilities-based encryption (to come)
    • Comparing with the classic HTTP web (feudal security, etc) (to come)
  • Keeping Data Alive: Durable Data on the Permanent Web (to come)
    • IPFS Cluster (to come)
    • Filecoin (to come)
  • Distributed Computation (to come)
Powered by GitBook
On this page
  • Prerequisites
  • Goals
  • Steps
  • Step 1: Start the IPFS daemon
  • Step 2: Examine your ipfs node id info
  • Step 3: Shutdown the daemon
  • Explanation
  • Next Lesson: Find Peers on the Network

Was this helpful?

Export as PDF
  1. Tutorial: Going Online - Joining the Distributed Web

Lesson: Connect your node to the IPFS network

PreviousTutorial: Going Online - Joining the Distributed WebNextLesson: Find Peers on the Network

Last updated 4 years ago

Was this helpful?

This lesson shows how to connect the IPFS node on your local computer to the IPFS network, or “the swarm”. Everything that you have done so far has been done locally. Now it gets a lot more interesting!

Prerequisites

To do the steps in this lesson you must:

  • Be familiar with using the command line

  • on your local machine

Goals

After doing this Lesson you will be able to

  • Start the IPFS daemon to connect your local node to the IPFS network

Steps

Step 1: Start the IPFS daemon

Start the IPFS daemon by running

$ ipfs daemon

You will see output from the daemon like the following:

Initializing daemon...
go-ipfs version: 0.5.0-dev-17e886e29
Repo version: 7
System version: amd64/linux
Golang version: go1.13.5
Swarm listening on /ip4/12.2.0.36/tcp/4001
Swarm listening on /ip4/127.0.0.1/tcp/4001
Swarm listening on /ip6/::1/tcp/4001
Swarm listening on /p2p-circuit
Swarm announcing /ip4/12.2.0.36/tcp/4001
Swarm announcing /ip4/127.0.0.1/tcp/4001
Swarm announcing /ip6/::1/tcp/4001
API server listening on /ip4/127.0.0.1/tcp/5001
WebUI: http://127.0.0.1:5001/webui
Gateway (readonly) server listening on /ip4/127.0.0.1/tcp/8080
Daemon is ready

Step 2: Examine your ipfs node id info

Let's look at the details of your connections made by the daemon with ipfs id. Open up another command line and run:

$ ipfs id
{
    "ID": "QmRX....xQTp",
    "PublicKey": "CAAS....AAE=",
    "Addresses": [
        "/ip4/127.0.0.1/tcp/4001/ipfs/QmRX....xQTp",
        "/ip4/12.2.0.36/tcp/4001/ipfs/QmRX....xQTp",
        "/ip6/::1/tcp/4001/ipfs/QmRX....xQTp",
        "/ip6/2802:285:8360:da70::9191/tcp/4001/ipfs/QmRX....xQTp",
        "/ip6/2802:285:8360:da70:5146:9a0a:e910:19c3/tcp/4001/ipfs/QmRX....xQTp",
        "/ip6/2802:285:8360:da70:ccb4:bd10:baa3:d022/tcp/4001/ipfs/QmRX....xQTp",
        "/ip4/83.24.208.218/tcp/26521/ipfs/QmRX....xQTp"
    ],
    "AgentVersion": "/go-ipfs/0.5.0-dev/17e886e29",
    "ProtocolVersion": "ipfs/0.1.0"
}

Note: The hashes above have been shortened for readability.

The "ID" field is your Peer ID, used to uniquely identify your node on the IPFS network. The "PublicKey" field goes along with your Peer ID, used under-the-hood by IPFS for public key cryptography. The "Addresses" shown are an array of IP addresses used for IPFS network traffic. Addresses using TCP port 4001 are known as "swarm addresses" that your local daemon will listen on for connections from other IPFS peers.

Step 3: Shutdown the daemon

You may shut down the daemon by typing Ctrl-C in the command line that you started with:

...
Daemon is ready
^C
Received interrupt signal, shutting down...
(Hit ctrl-c again to force-shutdown the daemon.)

Note: You may run the IPFS daemon as a background process using the command ipfs daemon &. If you want to stop the background process just type fg (foreground) to bring that process to the foreground and stop it with Ctrl-C.

$ ipfs daemon &
pid 8469
$ Initializing daemon...
go-ipfs version: 0.5.0-dev-17e886e29
Repo version: 7
System version: amd64/linux
Golang version: go1.13.5
Swarm listening on /ip4/10.0.0.35/tcp/4001
...
Gateway (readonly) server listening on /ip4/127.0.0.1/tcp/8080
Daemon is ready
fg
ipfs daemon
^C
Received interrupt signal, shutting down...
(Hit ctrl-c again to force-shutdown the daemon.)

Explanation

You run the IPFS daemon in order to have your local IPFS node become part of the IPFS network and listen to other IPFS peers.

Next Lesson: Find Peers on the Network

Notice that if you before running the daemon, the blocks will be advertised after a few seconds when the reprovider runs.

Proceed to the next lesson to learn how to

Install and Initialize IPFS
added files
Find Peers on the Network