0xCODE
Published in

0xCODE

IPFS Decentralized and Distributed File Storage

Using IPFS For Distributed File Storage Systems

The difference between a centralized and decentralized file storage.

Decentralized File Storage

How IPFS stores files across nodes.

Storage Addressing Schemes

Installing IPFS

  1. IPFS Desktop Host and share files directly from a computer (laptop or desktop PC). An IPFS companion app can be installed to allow access to a local node using a web browser. This is the type of installation for a peer type file sharing.
  2. IPFS ClusterFor hosting and sharing files at scale, the cluster enables orchestrating and coordinating pinsets across a swarm of IPFS nodes. This allows a massive large scale file storage system to be built through distributed nodes.
ipfs init
> initializing ipfs node at /Users/<username>/.go-ipfs
> generating 2048-bit RSA keypair...done
> peer identity: Qmcpo2iLBikrdf1d6QU6vXuNb6P7hwrbNPW9kLAH8eG67z
> to get started, enter:
>
ipfs daemon
> Initializing daemon...
> API server listening on /ip4/127.0.0.1/tcp/5001
> Gateway server listening on /ip4/127.0.0.1/tcp/8080
ipfs swarm peers
> /ip4/104.131.131.82/tcp/4001/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ
> /ip4/104.236.151.122/tcp/4001/p2p/QmSoLju6m7xTh3DuokvT3886QRYqxAzb1kShaanJgW36yx
> /ip4/134.121.64.93/tcp/1035/p2p/QmWHyrPWQnsz1wxHR219ooJDYTvxJPyZuDUPSDpdsAovN5
> /ip4/178.62.8.190/tcp/4002/p2p/QmdXzZ25cyzSF99csCQmmPZ1NTbWTe8qtKFaZKpZQPdTFB
ipfs cat /ipfs/QmW2WQi7j6c7UgJTarActp7tDNikE4B2qXtFCfLPdsgaTQ/cat.jpg > cat.jpgopen cat.jpg

Javascript With IPFS

const IPFS = require('ipfs-mini' 1.1.5 );
const ipfs = new IPFS({host: 'ipfs.infura.io', port: 5001, protocol: 'https'});
const data = "Writing a test message on the network";
ipfs.add(data, (err, hash) => {
if(err){
return console.log(err);
}
console.log('
https://ipfs.infura.io/ipfs/'+hash);
})
If there are no errors, a hash value of the data should be returned.

The Pros Of IPFS

The Cons of IPFS

Web3Studio SoJourn Uses IPFS (Source Consensys)

SYNOPSIS

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Vincent Tabora

Editor HD-PRO, DevOps Trusterras (Cybersecurity, Blockchain, Software Development, Engineering, Photography, Technology)