# IPFS Learning (updating)
###### tags: `hackfs` `hackathon` `ipfs`
[ToC]
## Products
#### [IPFS](https://ipfs.io/)
Example: [Exchange files between the browser and other IPFS nodes](https://github.com/ipfs/js-ipfs/tree/master/examples/exchange-files-in-browser)
#### [Pinata](https://pinata.cloud/)
It seems Pinata is useful for NFT (OpenSea market for digital art). If you change/update the digital file, the CID will be changed (new hash), making sure every version of the data is unique.
- [IPFS Regions and Replications](https://medium.com/pinata/ipfs-regions-and-replications-a1e52d60dfdb)
#### [Fleek](https://app.fleek.co/)
Fleek is a Netlify-like product that helps auto-deploy a website. I deployed [Big Announcement](https://github.com/Aimeedeer/bigannouncement) on Fleek, and I met problems, which I put it in the `My Testlog` section.
## Tools
- [Libp2p](https://docs.libp2p.io/)
- [Rust-Crate-libp2p](https://docs.rs/libp2p/0.21.1/libp2p/)
- [IPFS CLI](https://docs.ipfs.io/install/command-line-quick-start/#install-ipfs)
- [Awesome IPFS](https://awesome.ipfs.io/tools/)
- [IPFS Deploy](https://github.com/ipfs-shipyard/ipfs-deploy)
- [ipfs-cluster](https://github.com/ipfs/ipfs-cluster)
- [fs-repo-migrations](https://github.com/ipfs/fs-repo-migrations/blob/master/run.md)
- Solved the problem I met
`Error: ipfs repo needs migration`.
- But met new error `Error: merkledag: not found`.
- I searched and found someone met [the same problem](https://discuss.ipfs.io/t/error-merkledag-not-found/951). Some suggestions from the issue:
> `ipfs pin ls` to list the hashes of all the content pinned on your node. This will include everything that you have added using ipfs add command because that command pins the content by default.
- I found out that the problem is, I should run `ipfs daemon` before I use ipfs other commands. This old post helped a lot: [Significance of key generated by ‘ipfs init’](https://discuss.ipfs.io/t/significance-of-key-generated-by-ipfs-init/279). The [origin link on GitHub](https://github.com/ipfs-inactive/faq/issues/166#issuecomment-242868415)
## Books
- [The IPFS Primer](https://flyingzumwalt.gitbooks.io/decentralized-web-primer/SUMMARY.html)
## Articles
- [Publishing my Website on IPFS](http://justinpoliachik.com/posts/2020-03_ipfs_website/)
- [Using IPFS + FileCoin for decentralised storage with Powergate](https://medium.com/@samikshan/using-ipfs-filecoin-for-decentralised-storage-with-powergate-71ffe42f8c09)
- [What’s really happening when you add a file to IPFS?](https://medium.com/textileio/whats-really-happening-when-you-add-a-file-to-ipfs-ae3b8b5e4b0f)
>Have you ever noticed that IPFS hashes all seem to start with Qm? This is because those hashes are actually something called a `multihash`.
>Merkle DAGs are a core concept of IPFS, but they are also at the core of many other technologies like git, bitcoin, dat, etc.
- [IPFS Scalability](https://medium.com/pinata/ipfs-scalability-f0a6f8a7d42b). Pinata team wrote this article, that explored some unsolved problems on IPFS.> A node is a node, no matter where it is hosted. When IPFS requests data from the network, IPFS retrieves that data from nodes based purely on whichever node is the best option at serving the data. IPFS doesn’t just retrieve data from decentralized nodes because the Web3 app using the protocol wants the data to be retrieved from decentralized nodes. This is true for blockchains, too. Ethereum doesn’t differentiate between a full node centralized in the cloud or a full node decentralized in someone’s basement. A node is a node, no matter where it is hosted.
>
> Highly Connected Nodes Are Faster
>
> An Ethereum mining facility’s resources are better at mining than someone’s mining equipment in their basement. The amount of computing resources matter.
- [IPFS Gateway](https://docs.ipfs.io/concepts/ipfs-gateway/#overview)
- [The IPFS Gateway Problem](https://medium.com/pinata/the-ipfs-gateway-problem-64bbe7eb8170)
- [Build a Decentralized Chat App with Knockout and IPFS](https://medium.com/textileio/build-a-decentralized-chat-app-with-knockout-and-ipfs-fccf11e8ce7b)
- [Publish–subscribe pattern](https://en.wikipedia.org/wiki/Publish%E2%80%93subscribe_pattern)
## My Testlog
#### 2020/07/07
Deployed bigannouncement:
- Use IPFS-Cli:
>https://ipfs.io/ipfs/QmVW6oTQAVU1XB65jd8rMqbwaY4f5ryGCpya8VLv84HEEz/
- Use Fleek:
>https://ipfs.fleek.co/ipfs/QmXv37wN6hmYgU7n1B4G9XykUmhyW8pLGToRQQN3uLDL1A/
I encountered bugs when using **Fleek**:
- I deployed the site successfully, and then changed the name to bigannouncement.on.fleek.co. Let's call it **SiteA**
- I deployed the same site/GitHub source again, successfully. Call it **SiteB**
- I deleted **SiteA**
- I wanted rename **SiteB** to bigannouncement.on.fleek.co, but Fleek didn't allow me to
- So I tried to delete **SiteB**, and met a 404 page
- I reported this maybe-bug to Slack-HFS-Fleek channel
- I tried to delete **SiteB** again, and it worked
- I deployed **SiteC** from the same GitHub source successfully
- Then I want to check the `DEPLOYS` tab, and it showed me 404 page again
- I reported the screenshot to the same Slack channel
- Fleek team responsed fast!
#### 2020/07/06
Installed ipfs: https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs
Warning, and solved by https://github.com/nodejs/node-gyp/issues/1861
```
$ xcode-select --install
$ xcode-select -print-path //it will display something like /Library/Developer/CommandLineTools
$ sudo xcode-select --reset //it should change the path to /Applications/Xcode.app/Contents/Developer
```
Installed packages one by one: https://github.com/ipfs/js-ipfs/tree/master/packages
Then installed IPFS -g
```
$ npm install -g ipfs
```
Finally one warning left:
prometheus-gc-stats@0.6.2 requires a peer of prom-client@>= 10 < 12 but none is installed. You must install peer dependencies yourself.
```
$ env -u IPFS_PATH
$ echo $IPFS_PATH
$ unset IPFS_PATH
$ echo $IPFS_PATH
$ ipfs init
```
> initializing IPFS node at /Users/aimeez/.ipfs
> Error: ipfs configuration file already exists!
> Reinitializing would overwrite your keys.