diff --git a/docs/bee/installation/package-manager.md b/docs/bee/installation/package-manager.md index 0b70ca86..13cd5361 100644 --- a/docs/bee/installation/package-manager.md +++ b/docs/bee/installation/package-manager.md @@ -440,8 +440,8 @@ curl -s localhost:1633/peers | jq ".peers | length" Perfect! We are accumulating peers, this means you are connected to the network, and ready to start [using Bee](/docs/develop/introduction) to [upload and -download](/docs/develop/access-the-swarm/upload-and-download) content or host -and browse [websites](/docs/develop/access-the-swarm/host-your-website) hosted +download](/docs/develop/upload-and-download) content or host +and browse [websites](/docs/develop/host-your-website) hosted on the Swarm network. Welcome to the swarm! 🐝 🐝 🐝 🐝 🐝 diff --git a/docs/bee/working-with-bee/bee-api.md b/docs/bee/working-with-bee/bee-api.md index f3ddfa5b..bd1d9de4 100644 --- a/docs/bee/working-with-bee/bee-api.md +++ b/docs/bee/working-with-bee/bee-api.md @@ -17,7 +17,7 @@ Detailed information about Bee API endpoints can be found in the [API reference ## Interacting With the API -You can interact with the Bee API using standard HTTP requests, allowing you to programmatically access all of your Bee node's various functions such as [purchasing stamp batches](/docs/develop/tools-and-features/buy-a-stamp-batch), [uploading and downloading](/docs/develop/access-the-swarm/upload-and-download), [staking](/docs/bee/working-with-bee/staking), and more. +You can interact with the Bee API using standard HTTP requests, allowing you to programmatically access all of your Bee node's various functions such as [purchasing stamp batches](/docs/develop/tools-and-features/buy-a-stamp-batch), [uploading and downloading](/docs/develop/upload-and-download), [staking](/docs/bee/working-with-bee/staking), and more. ### Alternatives for Working with the API diff --git a/docs/bee/working-with-bee/node-types.md b/docs/bee/working-with-bee/node-types.md index 78bb5ab4..d4e6aef2 100644 --- a/docs/bee/working-with-bee/node-types.md +++ b/docs/bee/working-with-bee/node-types.md @@ -18,8 +18,8 @@ Bee can operate in different modes, each tailored to specific use cases: | Feature | Full Node | Light Node | Ultra-Light Node | | ----------------------------------------------------------------------- | --------- | ---------- | ---------------- | -| Free tier [downloads](/docs/develop/access-the-swarm/upload-and-download) | βœ… | βœ… | βœ… | -| [Uploading](/docs/develop/access-the-swarm/upload-and-download) (Can purchase [postage stamp batches](/docs/develop/tools-and-features/buy-a-stamp-batch)) | βœ… | βœ… | ❌ | +| Free tier [downloads](/docs/develop/upload-and-download) | βœ… | βœ… | βœ… | +| [Uploading](/docs/develop/upload-and-download) (Can purchase [postage stamp batches](/docs/develop/tools-and-features/buy-a-stamp-batch)) | βœ… | βœ… | ❌ | | Can exceed free tier downloads | βœ… | βœ… | ❌ | | Storage sharing | βœ… | ❌ | ❌ | | [Storage incentives](/docs/bee/working-with-bee/staking/) | βœ… | ❌ | ❌ | diff --git a/docs/concepts/access-control.md b/docs/concepts/access-control.md index 57bbe791..0c6f7f53 100644 --- a/docs/concepts/access-control.md +++ b/docs/concepts/access-control.md @@ -6,7 +6,7 @@ id: access-control The Access Control Trie (ACT) implements the operation of encryption at the chunk level, with the presence of a decryption/encryption key being the only distinction between accessing private and public data. :::info -This article describes the high level concepts and functionalities of ACT. If you're ready to try it out for yourself, please refer to this [hands on usage guide with specific details](/docs/develop/access-the-swarm/act/). +This article describes the high level concepts and functionalities of ACT. If you're ready to try it out for yourself, please refer to this [hands on usage guide with specific details](/docs/develop/act/). ::: In decentralized public data storage systems like Swarm, data is distributed across multiple nodes. Ensuring diff --git a/docs/concepts/what-is-swarm.mdx b/docs/concepts/what-is-swarm.mdx index 7c026785..3cb2a354 100644 --- a/docs/concepts/what-is-swarm.mdx +++ b/docs/concepts/what-is-swarm.mdx @@ -56,7 +56,7 @@ Built on top of the overlay network is also an [incentives layer](/docs/concepts The third part of Swarm is a component that provides high-level data access and defines APIs for base-layer features. This layer is responsible for providing an easy-to-use interface for developers to interact with Swarm's underlying storage and communication infrastructure. -Swarm's high-level data access component provides [APIs that allow developers to perform various operations](/api/) on the network, including [uploading and downloading data](/docs/develop/access-the-swarm/upload-and-download) and searching for content. These APIs are designed to be simple and intuitive, making it easy for developers to build decentralised applications on top of Swarm. +Swarm's high-level data access component provides [APIs that allow developers to perform various operations](/api/) on the network, including [uploading and downloading data](/docs/develop/upload-and-download) and searching for content. These APIs are designed to be simple and intuitive, making it easy for developers to build decentralised applications on top of Swarm. ### 4. Application Layer diff --git a/docs/develop/access-the-swarm/access-control.md b/docs/develop/access-control.md similarity index 100% rename from docs/develop/access-the-swarm/access-control.md rename to docs/develop/access-control.md diff --git a/docs/develop/access-the-swarm/host-your-website.md b/docs/develop/access-the-swarm/host-your-website.md deleted file mode 100644 index 97dc00b0..00000000 --- a/docs/develop/access-the-swarm/host-your-website.md +++ /dev/null @@ -1,99 +0,0 @@ ---- -title: Host a Webpage -id: host-your-website ---- - -Bee treats ENS as a first class citizen, wherever you can use a Swarm reference, you can also use an ENS domain where the `content` ENS Resolver record is set to be a `bzz://` reference. - -:::info -You may substitute ENS names for Swarm references in any of the [API methods](/api/) where you would normally use a Swarm reference. -::: - -### Enable ENS on Your Node - -In order to resolve ENS names using your API endpoints, you must specify a valid ENS resolver endpoint when starting your Bee node. We recommend that users run their own Geth node, which can be trusted absolutely, however service providers such as [https://cloudflare-eth.com](https://cloudflare-eth.com) or [Infura](https://infura.io) may suffice. Public gateways such as [gateway.ethswarm.org](https://gateway.ethswarm.org) will also usually provide ENS resolution. - -```bash -bee start --resolver-options "https://cloudflare-eth.com" -``` - -If specifying using your `bee.yaml` configuration file, the syntax is as follows: - -```bash -resolver-options: [ "https://cloudflare-eth.com" ] -``` - -Once you have restarted your node, you should be able to see the Swarm homepage at: - -[http://localhost:1633/bzz/swarm.eth/](http://localhost:1633/bzz/swarm.eth/) - -:::info -Use the `resolver-options` flag to point the Bee resolver to any ENS compatible smart-contract on any EVM compatible chain -::: - -:::warning -Make sure you trust the gateway you are interacting with! To ensure that you are retrieving the correct content, run your own ENS resolver and Bee node. -::: - -### Link an ENS domain to a website. - -First we will need to upload the website assets to Swarm in order to -get its Swarm reference hash, see -[uploading a directory](/docs/develop/access-the-swarm/upload-and-download) -for more information. - -This time we will also include the `Swarm-Index-Document` header set to the `index.html`. This will cause Bee to serve each directories `index.html` file as default when browsing to the directory root `/` url. We will also provide a custom error page, using the `Swarm-Error-Document` header. - -In the case that your website is a single page app, where you would like to direct to the JavaScript history API powered router, you may provide the `index.html` page for both settings. - -```bash - curl -X POST -H "Content-Type: application/x-tar" -H "swarm-postage-batch-id: 81c4520b47a434738d14fd38053a32c20aaf1a36d7f35f0d86ef25c70403d7a8" -H "Swarm-Index-Document: index.html" -H "Swarm-Error-Document: index.html" --data-binary @website.tar http://localhost:1633/bzz -``` - -```json -{ - "reference": "b25c89a401d9f26811680476619a1eb4a4e189e614bc6161cbfd8b343214917b" -} -``` - -Next, we add a `Content` record to your ENS domain's resolver contract. - -We recommend the excellent [ENS Domains Dapp](https://app.ens.domains/) used -with the [MetaMask](https://metamask.io/) browser extension for registering and -administrating your ENS domain. - -Once you have registered your name, and have connected MetaMask with the -relevant Ethereum account, you must first set the resolver to use the public ENS -if you have not already done so. - -First, navigate to 'My Names', and select the name you would like to link your Swarm content to. - -Press 'Set' next to your resolver record. - -![alt text](/img/ens-1.png "Press set resolver.") - -Select 'Use Public Resolver'. - -![alt text](/img/ens-2.png "Use Public Resolver.") - -Select '+' to add a record. - -![alt text](/img/ens-3.png "Press add a record.") - -Choose the 'Content' record type from the drop down menu. - -![alt text](/img/ens-4.png "Choose the content record type from the drop down menu.") - -Add the Swarm reference you created earlier and press 'Save'. - -![alt text](/img/ens-5.png "Add the Swarm reference you created earlier and press 'Save'.") - -Verify the Content Record has been created! - -![alt text](/img/ens-6.png "Verify the Content Record has been created.") - -Done! πŸ‘ - -Now you will be able to see your website hosted using the ENS name instead of the Swarm Reference! - -![alt text](/img/ens-7.png "View your website using the ENS name.") diff --git a/docs/develop/access-the-swarm/introduction.md b/docs/develop/access-the-swarm/introduction.md deleted file mode 100644 index f7696682..00000000 --- a/docs/develop/access-the-swarm/introduction.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: Introduction -id: introduction ---- - -This section introduces guides for the primary use cases of building on Swarm. - -* [**Upload and Download**](/docs/develop/access-the-swarm/upload-and-download) - Learn how to upload and retrieve different types of data from Swarm, in both Node.js and browser environments. - -* [**Host a Website**](/docs/develop/access-the-swarm/host-your-website) - Publish a website to Swarm, and optionally configure ENS for a human-readable domain. - -* [**Add Access Control**](/docs/develop/access-the-swarm/act) - Restrict access to your Swarm content and share it only with authorized users. diff --git a/docs/develop/host-your-website.md b/docs/develop/host-your-website.md new file mode 100644 index 00000000..a530b4b8 --- /dev/null +++ b/docs/develop/host-your-website.md @@ -0,0 +1,481 @@ +--- +title: Host a Webpage +id: host-your-website +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +There are two primary methods most developers should use for uploading a website to Swarm - `swarm-cli` and `bee-js`. Depending on the specific use case, it may make more sense to pick one or the other. + +For a simple website such as a personal blog or company page, using `swarm-cli` is simplest and fastest way to get your site uploaded and accessible on Swarm. + +However for developers who need finer grained control over the process or who wish to build a more complex application which require programmatically spinning up new pages, `bee-js` is required. + +:::tip +The guides below assume you already have a registered ENS domain name. By using an ENS domain name, you can make your Swarm hosted website accessible through an easy to remember human-readable name rather than a Swarm hash. If you don't have an ENS domain name registered, you can get one using the official ENS application at [app.ens.domains](https://app.ens.domains/). Refer to their support section for a step-by-step guide to [register an ENS domain](https://support.ens.domains/en/articles/7882582-how-to-register-a-eth-name). +::: + +:::tip FIX FOR ENS NOT WORKING ON LOCALHOST +If the site doesn’t load from localhost, it’s probably an with the resolver RPC (the RPC endpoint for the Ethereum node used to resolve your ENS domain name). + +Some endpoints, such as: + +``` +https://cloudflare-eth.com +``` + +may not resolve properly on localhost. + +As of the writing of this guide, both of these free and public endpoints work reliably for localhost resolution: + +``` +https://mainnet.infura.io/v3/ +https://eth-mainnet.public.blastapi.io +``` + +Alternatively, you can run your own Ethereum node and use that as the RPC. +::: + +## Host a Site With **swarm-cli** + +This guide shows you how to get your website hosted on Swarm with just a few simple commands by using `swarm-cli` from your terminal. + +### Prerequisites + +* A running Bee node (either a [standard installation](/docs/bee/installation/quick-start) or [Swarm Desktop](/docs/desktop/install)) +* A valid postage batch +* [`swarm-cli` installed](https://docs.ethswarm.org/docs/bee/working-with-bee/swarm-cli) +* A valid postage stamp batch +* Your static website files (you can also use the example website files provided below) +* (Optional for part one - "Upload & Access by Hash") An ENS domain which you [previously registered](https://support.ens.domains/en/articles/7882582-how-to-register-a-eth-name) + +### Upload & Access by Hash + + +You can download the example website files from the [ethersphere/examples](https://github.com/ethersphere/examples/tree/main/basic-static-website) repository. + + +#### Uploading the Website + +1. Go to the folder containing your website files. + +The example website files look like this: + +``` +my-website/ +β”œβ”€β”€ index.html # main landing page +β”œβ”€β”€ 404.html # custom error page +β”œβ”€β”€ styles.css # basic styling +β”œβ”€β”€ script.js # optional script +β”œβ”€β”€ favicon.svg # site icon +└── robots.txt # default robots config +``` + +* `index.html` will be served by default when users visit the root URL. +* `404.html` will be served for non-existent paths. +* The other files are optional and can be customized. + + +2. Run: + + + + + +```powershell +swarm-cli upload . ` + --stamp ` + --index-document index.html ` + --error-document 404.html +```` + + + + + +```bash +swarm-cli upload . \ + --stamp \ + --index-document index.html \ + --error-document 404.html +``` + + + + + +* Replace `` with your postage batch ID. +* `--index-document` tells Bee which file to serve at the root. +* `--error-document` defines the fallback file for missing paths. + +3. The upload will return a Swarm reference hash, for example: + +``` +cf50756e6115445fd283691673fa4ad2204849558a6f3b3f4e632440f1c3ab7c +``` + +Copy this and save it. You’ll need it for both direct access and [ENS integration](#connect-site-to-ens-domain). + + +#### Accessing the Website + +Anyone with a Bee node can now access the site using the Swarm hash you just saved: + +``` +http://localhost:1633/bzz// +``` + + +### (Recommended) Use Feeds for Seamless Updates - swarm-cli + +*If you have not already connected your site to your ENS domain, [do that now](#connect-site-to-ens-domain) before returning here.* + +If you have an ENS domain and Swarm hosted website, you can make the site available through the domain by registering website's Swarm hash as a content hash through the [ENS domain management app](https://app.ens.domains/). However, if you ever edit and reupload your site to Swarm, you will need to re-register your new website hash to make it available at your ENS domain. + +Therefore, instead of directly using your website hash as the content hash for your ENS domain, upload your site as a feed update and use the feed manifest hash as the content hash. Then every time you update your site as a new feed update, the ENS domain will always resolve to the newest version of your site without the need to register a new hash each time. + +:::tip +The examples below refer to core feed concepts such as "publisher identity", and "topic". To learn more about these concepts refer to the [bee-js documentation](https://bee-js.ethswarm.org/docs/soc-and-feeds/#feeds). +::: + +In this section, you will: + +1. Create a publisher identity +2. Upload your site to a feed (this automatically creates the feed manifest) +3. Copy the feed manifest reference +4. Use that manifest reference as your ENS contenthash + + +#### Step 1: Create a dedicated publisher identity + +This key will sign feed updates. + +```bash +swarm-cli identity create website-publisher +``` + +Terminal output: + +```bash +Name: website-publisher +Type: V3 Wallet +Private key: 0x22e918ef68c9bc975112ceaaee0ee0f147baa79da257873659bddbfd84a646fe +Public key: 0x218c79f8dfb26d077b6379eb56aa9c6e71edf74dde8ecd27dac5016528aea80ee121b9e5050adf3948c8b0d8cffda763d7fb1f5608250b5009c5d50e158ab4a5 +Address: 0x2fb11d37a9913bd3258b9918c399f35fd842a232 +``` + +Record the output in a secure location as a backup β€” you will need this identity for future updates. + +If you need to view/export it later: + +```bash +swarm-cli identity export website-publisher +``` + +#### Step 2: Upload your website to a feed (creates the manifest automatically) + + + + +```bash +swarm-cli feed upload ./website \ + --identity website-publisher \ + --topic-string website \ + --stamp \ + --index-document index.html \ + --error-document 404.html +``` + + + + +```powershell +swarm-cli feed upload .\website ` + --identity website-publisher ` + --topic-string website ` + --stamp ` + --index-document index.html ` + --error-document 404.html +``` + + + +You will see output that includes your **feed manifest reference**, for example: + +```bash +Swarm hash: 387dc3cf98419dcb20c68b284373bf7d9e8dcb27daadb67e1e6b6e0f17017f1f +URL: http://localhost:1633/bzz/387dc3cf98419dcb20c68b284373bf7d9e8dcb27daadb67e1e6b6e0f17017f1f/ +Feed Manifest URL: http://localhost:1633/bzz/6c30ef2254ac15658959cb18dd123bcce7c16d06fa7d0d4550a1ee87b0a846a2/ +Stamp ID: 3d98a22f +Usage: 50% +Capacity (mutable): 20.445 KB remaining out of 40.890 KB +``` + +You can find the manifest hash at `Feed Manifest URL` in the URL right after `/bzz/`: `6c30ef2254ac15658959cb18dd123bcce7c16d06fa7d0d4550a1ee87b0a846a2` + +Save this hash, you will use it for the next step. + +This is your **permanent website reference**. It is a reference to a feed manifest which points to the latest feed entry so that you can use it as a static, unchanging reference for your website even as you make multiple updates to the site. Every time you update the website through the feed, this manifest will point to the hash for the newest version of the website. + + +#### Step 3: Use the feed reference as the ENS contenthash + +Follow the [official ENS guide](https://support.ens.domains/en/articles/12275979-how-to-add-a-decentralized-website-to-an-ens-name) for registering a content hash adding your content hash in the ENS UI (see [guide](#connect-site-to-ens-domain)). However, rather than registering your website's hash directly, register the feed manifest hash we saved from the previous step from our example above. + +Example: + +``` +bzz://6c30ef2254ac15658959cb18dd123bcce7c16d06fa7d0d4550a1ee87b0a846a2 +``` + +Now your ENS name will always point to a static reference which will always resolve to the latest version of your website. + +#### Updating your site in the future + +When you have a new version of your site, just run `feed upload` again using the same topic and identity: + + + + +```bash +swarm-cli feed upload ./website \ + --identity website-publisher \ + --topic-string website \ + --stamp \ + --index-document index.html \ + --error-document 404.html +``` + + + + +```powershell +swarm-cli feed upload .\website ` + --identity website-publisher ` + --topic-string website ` + --stamp ` + --index-document index.html ` + --error-document 404.html +``` + + + + +* The **feed manifest reference stays the same**. +* The feed now points to the newly uploaded site version. +* No ENS changes needed. + + +## Host a Website with **bee-js** + +This guide explains how to host a website on Swarm using the `bee-js` JavaScript SDK instead of the CLI. + +For developers building apps, tools, or automated deployments, `bee-js` offers programmatic control over uploading and updating content on Swarm. + +### Prerequisites + +* A running Bee node (either a [standard installation](/docs/bee/installation/quick-start) or [Swarm Desktop](/docs/desktop/install)) +* A valid postage stamp batch +* Node.js (18+) and `@ethersphere/bee-js` installed in your project +* Static website files (HTML, CSS, etc.) - feel free to use the [provided example site](https://github.com/ethersphere/examples/tree/main/basic-static-website) +* (Optional for part one - "Upload & Access by Hash") An ENS domain which you [previously registered](https://support.ens.domains/en/articles/7882582-how-to-register-a-eth-name) + + +### Upload and Access by Hash + +Install bee-js: + +```bash +npm install @ethersphere/bee-js +``` + +Website upload script: + +```js +import { Bee } from "@ethersphere/bee-js"; + +const bee = new Bee("http://localhost:1633"); + +const batchId = ""; // Replace with your actual postage batch ID + +const result = await bee.uploadFilesFromDirectory(batchId, "./website", { + indexDocument: "index.html", + errorDocument: "404.html" +}); + +console.log("Swarm hash:", result.reference.toHex()); +``` + +```bash +Swarm hash: 6c45eae389b3bffce21443316d0bd47c4101545092b7c72c313a33ee7d003475 +``` + +After running the script, copy the Swarm hash output to the console and then use it to open your Swarm hosted website in the browser: + +```bash +http://localhost:1633/bzz// +``` + + +### (Recommended) Use Feeds for Seamless Updates - bee-js + +*If you have not already connected your site to your ENS domain, [do that now](#connect-site-to-ens-domain) before returning here.* + +If you have an ENS domain and Swarm hosted website, you can make the site available through the domain by registering website's Swarm hash as a content hash through the [ENS domain management app](https://app.ens.domains/). However, if you ever edit and reupload your site to Swarm, you will need to re-register your new website hash to make it available at your ENS domain. + +Therefore, instead of directly using your website hash as the content hash for your ENS domain, upload your site as a feed update and use the feed manifest hash as the content hash. Then every time you update your site as a new feed update, the ENS domain will always resolve to the newest version of your site without the need to register a new hash each time. + +:::tip +You will need a publisher key to use for setting up your website feed. + +You can use the `PrivateKey` class to generate a dedicated publisher key: + +```js +const crypto = require('crypto'); +const { PrivateKey } = require('@ethersphere/bee-js'); + +// Generate 32 random bytes and construct a private key +const hexKey = '0x' + crypto.randomBytes(32).toString('hex'); +const privateKey = new PrivateKey(hexKey); + +console.log('Private key:', privateKey.toHex()); +console.log('Public address:', privateKey.publicKey().address().toHex()); +```` + +Example output: + +```bash +Private key: 634fb5a872396d9693e5c9f9d7233cfa93f395c093371017ff44aa9ae6564cdd +Public address: 8d3766440f0d7b949a5e32995d09619a7f86e632 +``` + +Store this key securely. + +Anyone with access to it can publish to your feed. + +*It is recommended to use a separate publishing key for each feed.* +::: + +#### Example Script + +:::tip +The script below refers to some core feed concepts such as the feed "topic" and "writer". To learn more about these concepts and feeds in general, refer to the [bee-js documentation](https://bee-js.ethswarm.org/docs/soc-and-feeds/#feeds). +::: + +The script performs these steps: + +1. **Connects to your Bee node** and loads your postage batch + publisher private key. +2. **Creates a feed topic and writer** for publishing website updates. +3. **Uploads the `./website` directory** to Swarm and logs the resulting content hash. +4. **Publishes that hash to the feed** so it becomes the latest feed entry. +5. **Creates a feed manifest** and logs its reference β€” this is the permanent hash you use for ENS or stable URLs. + + +```js +import { Bee, Topic, PrivateKey } from "@ethersphere/bee-js"; +const bee = new Bee("http://localhost:1633"); +const batchId = "" // Replace with your batch id +const privateKey = new PrivateKey(""); // Replace with your publisher private key +const owner = privateKey.publicKey().address(); + +// Upload and Create Feed Manifest + +const topic = Topic.fromString("website"); +const writer = bee.makeFeedWriter(topic, privateKey); + +const upload = await bee.uploadFilesFromDirectory(batchId, "./website", { + indexDocument: "index.html", + errorDocument: "404.html" +}); + +console.log("Website Swarm Hash:", upload.reference.toHex()) + +await writer.uploadReference(batchId, upload.reference); + +const manifestRef = await bee.createFeedManifest(batchId, topic, owner); +console.log("Feed Manifest:", manifestRef.toHex()); +``` + +Upon the successful execution of the script, the hash of the uploaded website will be logged along feed manifest hash. Copy the "Feed Manifest" hash to be used in the next step: + +```bash +Website Swarm Hash: 6c45eae389b3bffce21443316d0bd47c4101545092b7c72c313a33ee7d003475 +Feed Manifest: caa414d70028d14b0bdd9cbab18d1c1a0a3bab1b20a56cf06937a6b20c7e7377 +``` + +Follow the [official ENS guide](https://support.ens.domains/en/articles/12275979-how-to-add-a-decentralized-website-to-an-ens-name) for registering a content hash adding your content hash in the ENS UI (see [guide](#2-connecting-your-website-to-ens)). However, rather than registering your website's hash directly, register the feed manifest hash we saved from the previous step from our example above. + +``` +bzz:// +``` + +Future updates just re-run: + +```js +await writer.upload(batchId, newUpload.reference); +``` + +Your ENS domain will always point to the latest upload via the feed manifest. + +You’ve now got a programmatic way to deploy and update your Swarm-hosted site with ENS support using `bee-js`! + +## Connect Site to ENS Domain + +Once your site is uploaded to Swarm, you can make it accessible via an easy to remember ENS domain name rather than its Swarm hash: + +``` +https://yourname.eth.limo/ +https://yourname.bzz.link/ +``` + +or through your own node: + +``` +http://localhost:1633/bzz/yourname.eth/ +``` + +#### Using the Official ENS Guide + +ENS provides a clear walkthrough with screenshots showing how to add a content hash to your domain with their [easy to use app](https://app.ens.domains/): + +[How to add a Decentralized website to an ENS name](https://support.ens.domains/en/articles/12275979-how-to-add-a-decentralized-website-to-an-ens-name) + +The guide covers: + +* Opening your ENS domain in the ENS Manager +* Navigating to the Records tab +* Adding a Content Hash +* Confirming the transaction + + +#### Swarm-Specific Step + +When you reach Step 2 in the ENS guide (β€œAdd content hash record”), enter your Swarm reference in the following format: + +:::tip +For the content hash, you can use a Swarm hosted website's hash directly, or as is recommended in the [`swarm-cli`](#recommended-use-feeds-for-seamless-updates---swarm-cli) and [`bee-js`](#recommended-use-feeds-for-seamless-updates---bee-js) guides above, publish your site to a feed and use the feed manifest hash instead. By using a feed manifest as the content hash, you can avoid repeated ENS registry updates. +::: + +``` +bzz:// +``` + +Example: + +``` +bzz://cf50756e6115445fd283691673fa4ad2204849558a6f3b3f4e632440f1c3ab7c +``` + +This works across: + +* eth.limo and bzz.link +* localhost (with a compatible RPC) +* any ENS-compatible Swarm resolver + +You do not need to encode the hash or use any additional tools. `bzz://` is sufficient. \ No newline at end of file diff --git a/docs/develop/introduction.md b/docs/develop/introduction.md index b44049a8..ad9dce1f 100644 --- a/docs/develop/introduction.md +++ b/docs/develop/introduction.md @@ -44,7 +44,7 @@ pagination_next: null