From f02e102fbf1ba5a43dc552bdc341e1cdb826137e Mon Sep 17 00:00:00 2001 From: yyd106 Date: Tue, 13 Apr 2021 20:06:51 +0800 Subject: [PATCH] Update single-page-website.md --- .../websites-on-ipfs/single-page-website.md | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/docs/how-to/websites-on-ipfs/single-page-website.md b/docs/how-to/websites-on-ipfs/single-page-website.md index 4770198c0..ea06d748c 100644 --- a/docs/how-to/websites-on-ipfs/single-page-website.md +++ b/docs/how-to/websites-on-ipfs/single-page-website.md @@ -228,6 +228,62 @@ An easy way to make sure important data is retained is to use a pinning service. ![Random planet fact website pinned using Pinata and displayed in Firefox](./images/single-page-website/pinned-random-planet-fact-website.png) +#### Decentralized pinning services + +For decentralized websites and apps, it is also possible to pin them on IPFS through a decentralized approach. Technically, decentralized pinning services are realized by blockchain technologies such as [Filecoin](https://filecoin.io/), [Crust Network](crust.network), etc. + +Some well-known DApps, such as [Polkadot Apps](dotapps.io) and [Uniswap Interface](https://app.uniswap.org/#/swap), **have all been pinned to IPFS by integrating Crust decentralized deployment**. For this reason, we're going to use [Crust Network](https://crust.network/) for demonstration in this tutorial. + +0. Prerequest + + > Please make sure you have **Node.js** env, you can go to [download page](https://nodejs.org/en/download/package-manager/) for installation. Be sure to have **IPFS** running locally, you can refer to [this page](https://ipfs.io/#install) to install and run IPFS. + +1. Install Crust Command Line + + ```shell + sudo npm i -g @crustio/crust-cli + ``` + +2. Login with seeds + + > *SEEDS* are 12 secret words of your Crust account. You can refer to this [guide](crust-account.md) to create your Crust Account. + + ```shell + crust-cli login [SEEDS] + ``` + +3. Pin the `index.html` file for your website + + Navigate to the directory of the `index.html` file + + ```shell + crust-cli pin index.html + ``` + + You'll get an IPFS cid from this step, for example: `QmZsYLxJA6pW4mQVi6qskFRDcSWvQcS6wPfteQNzUQWY3m`. + +4. Publish the `index.html` + + ```shell + crust-cli publish QmZsYLxJA6pW4mQVi6qskFRDcSWvQcS6wPfteQNzUQWY3m + ``` + + Now your website is published into Crust Network. Storage nodes in Crust Network will get notified and your website pinned to store. + +5. Query status + + After publishing your website, you can run this command to check how many nodes have pinned your website + + ```shell + crust-cli status QmZsYLxJA6pW4mQVi6qskFRDcSWvQcS6wPfteQNzUQWY3m + ``` + + ```shell + ✅ QmZsYLxJA6pW4mQVi6qskFRDcSWvQcS6wPfteQNzUQWY3m picked, replicas: 149 + ``` + +Crust also provides a [general Github workflow](https://github.com/crustio/ipfs-crust-pinner/blob/main/.github/workflows/template.yml) guiding developers to deploying a website/DApp in a decentralized way by establishing a consistent and automated CI/CD pipeline. Uniswap and Polakdot both are integrated in such an approach. + ## Set up a domain This section is completely optional.