Store an image on IPFS using Homebrew

HTTP depends on two single points of failure. First is the servers, and the second is the domain name system (DNS). IPFS is built on a peer-to-peer architecture. This means that if you're hosting a file and copy it to a friend, they suddenly become a host too.

This article will install and configure IPFS using the command-line interpreter and homebrew package manager. We'll also discuss IPFS hashes, bandwidth, connectivity, and security.

Step 1 - Getting Started

A. Install IPFS via Homebrew

brew install ipfs

B. Initialize a Repository

Create a new directory to store your project.

mkdir ~/Desktop/my_ipfs_proj

Create project.

ipfs init

C. Start Local Environment

Start

Start the daemon process to begin local development.

ipfs daemon &

Stop

ps ax | grep ipfs | head -n 1 | awk '{print $1}' | xargs kill

Daemon is listening for API traffic on port 5001.

As a convenience, a read-only gateway has been added to port 8080.

Step 2 - Basic IPFS Commands

Learning these basic commands will prove helpful over time.

Managing IPSF Profiles

Show Current IPFS Instance

ipfs id

Show IPFS Config

You store your local information within a config file.

ipfs config show

Edit IPFS Config

Add an environmental variable named $EDITOR and pick vim text editor.

export EDITOR=$(which vim)
ipfs config edit

Manage Connectivity Controls

Use SWARM to manage IPFS peer connections. This command will list your peers.

ipfs swarm peers

Modify the peers your local node learns about that are available on the wider network.

ipfs bootstrap list

Manage Peer Connections

See public data of a peer ID within your peer connections.

ipfs id <insert id starting with /p2p/********>

Manage Bandwidth

Review the bandwidth imposed on the system.

ipfs stats bw

Managing Objects

In IPFS, objects are currency. Hashes are the pointers to that currency. They connect users with the content they seek.

Get an Object from IPFS

ipfs get <object id>

Review the metadata of a file

file <object id>

IPFS Gateways

You publish and consume content through IPFS gateways. These are the two official gateways for now.

IPFS Storage