Accessing IPFS

IPFS is a distributed peer to peer system. There is no central server! Typically, each machine (peer) runs a daemon that communicates with other peers.

The IpfsClientarrow-up-right provides a simple way for your program to access the daemon via the IPFS HTTP APIarrow-up-right protocol. The client should be used as a shared object in your program, much like HttpClientarrow-up-right. It is thread safe (re-entrant) and conserves sockets and TCP connections when only one instance is used.

public class Program
{
  static readonly IpfsClient ipfs = new IpfsClient();
  public async Task Main(string[] args) 
  {
	// Get the Peer info of the daemon
	var peer = await ipfs.IdAsync();
  }
}

Core API

The Core APIarrow-up-right is a set of interfaces to IPFS features and is implemented by the client. The FileSystem and PubSub features are most often used.

const string filename = "QmXarR6rgkQ2fDSHjSY5nM2kuCXKYGViky5nohtwgF65Ec/about";
string text = await ipfs.FileSystem.ReadAllTextAsync(filename);

Features

Feature
Purpose

Data trading module for IPFS; requests blocks from and sends blocks to other peers

Manages the blocks

Manages the repository of blocks

Manages the configuration of the local peer

Manages the IPLD (linked data) Directed Acrylic Graph

Manages the Distributed Hash Table

DNS mapping to IPFS

Some miscellaneous methods

Manages the files/directories in IPFS

Manages the cryptographic keys

Manages the Interplanetary Name Space (IPNS)

Manages the IPFS Directed Acrylic Graph

Manage objects that are locally stored and permanent

Publish and subscribe to topic messages

Get statistics on IPFS components

Manages the swarm of peers

Last updated