Launch a wensite on Sui Network with Walrus ๐Ÿ‘จโ€๐Ÿ’ป douglas.life

Launching a Website on Sui Using Walrus

This guide provides step-by-step instructions to deploy a static website on the Sui blockchain using the Walrus decentralized storage system. It assumes you have a pre-built website (e.g., in a build or dist directory) and are familiar with basic command-line operations.

Prerequisites

Before starting, ensure you have the following:

  1. Pre-built Website: A directory containing your static website files (e.g., index.html, CSS, JS). This could be the output from a web framework like React, Vue, or plain HTML.
  2. Rust Installed: The site-builder tool requires Rust. Install it by following the instructions at https://www.rust-lang.org/tools/install.
  3. Sui CLI Installed: The Sui command-line interface is needed for interacting with the Sui blockchain. Follow the official Sui installation guide at https://docs.sui.io/guides/developer/getting-started/sui-install.
  4. Walrus CLI Installed: Install the Walrus CLI, which includes the site-builder tool, by following the setup instructions at https://docs.walrus.site/walrus/intro.html#installing-the-walrus-cli. Alternatively, download the pre-built site-builder binary for your operating system from https://github.com/MystenLabs/walrus/releases.
  5. Sui Wallet with Testnet SUI: Set up a Sui wallet (e.g., Sui Wallet browser extension) and fund it with Testnet SUI tokens:
  6. Walrus Testnet WAL Tokens: Obtain Testnet WAL tokens for storage payments from the Walrus faucet: https://faucet.testnet.walrus.site/.

Step-by-Step Instructions

Step 1: Prepare Your Website Directory

Ensure your website files are in a single directory (e.g., ./my-site). The directory must include an index.html file as the entry point. If it doesnโ€™t, you can use the --list-directory flag during publishing to generate a file browser.

  • Verify your directory structure. For example:
    my-site/
    โ”œโ”€โ”€ index.html
    โ”œโ”€โ”€ css/
    โ”‚   โ””โ”€โ”€ styles.css
    โ”œโ”€โ”€ js/
    โ”‚   โ””โ”€โ”€ app.js
    โ””โ”€โ”€ assets/
        โ””โ”€โ”€ image.png
    

Step 2: Configure the Walrus Site-Builder

The site-builder tool uses a configuration file (sites-config.yaml) to manage settings. If this file doesnโ€™t exist in your project directory, the tool will use default settings, but you can create one for advanced customization.

  1. Optional: Create a Configuration File
    • Create a sites-config.yaml file in your project directory.
    • Example configuration:
      title: "My Walrus Site"
      description: "A decentralized website on Sui"
      
    • For advanced settings (e.g., custom headers, routing), refer to the official documentation: https://docs.walrus.site/walrus-sites/advanced.html.

Step 3: Publish Your Walrus Site

Use the site-builder tool to publish your website to Walrus, which stores the files as blobs and creates a Sui object for metadata and ownership.

  1. Run the Publish Command

    • Navigate to your project directory:
      cd my-site
      
    • Execute the publish command, specifying the directory and storage duration (in epochs, where 1 epoch โ‰ˆ 2 days on Walrus Testnet):
      site-builder publish --epochs 100 ./my-site
      
      • --epochs 100: Sets the site to remain active for approximately 200 days (100 epochs ร— 2 days). The maximum is 183 epochs (~1 year).
      • Replace ./my-site with the path to your website directory.
      • If your directory lacks an index.html, add the --list-directory flag:
        site-builder publish --epochs 100 --list-directory ./my-site
        
  2. Output

    • The command generates a Walrus blob for each file and a Sui object ID for the site (e.g., 0x407a3081...).
    • Note the Sui object ID from the output, as itโ€™s required for updates or SuiNS integration.
    • You can view the site on Sui Explorer: https://suiscan.xyz/testnet by searching for the object ID.

Step 4: Access Your Walrus Site

Walrus Sites are accessed via portals, which retrieve files from Walrus and metadata from Sui. You can use a public portal or host your own.

  1. Using a Public Portal

    • Access your site via a portal like https://walrus.site.
    • The URL will be in the format: https://<object-id>.walrus.site, where <object-id> is the Base36-encoded Sui object ID (e.g., https://2hzpawjycxuiuh36047yocxapc69g8ercrypa7ccsk8ek4iqu6.walrus.site).
    • To convert the Sui object ID to Base36, refer to the Walrus documentation or use a Base36 converter tool.
  2. Optional: Host Your Own Portal

Step 5: Optional: Assign a SuiNS Domain

For a human-readable URL, integrate your site with SuiNS (Sui Name Service).

  1. Register a SuiNS Name

    • Purchase a SuiNS name (e.g., my-site.sui) via the SuiNS interface: https://suins.io/.
    • Use your Sui wallet to complete the transaction on Testnet.
  2. Link the SuiNS Name to Your Site

    • Update the siteโ€™s Sui object to point to your SuiNS name using the site-builder tool or Sui CLI.
    • Example command:
      site-builder update --sui-ns my-site.sui --object-id 0x407a3081...
      
      • Replace my-site.sui with your SuiNS name and 0x407a3081... with your siteโ€™s Sui object ID.
    • Your site will now be accessible at https://my-site.walrus.site.
  3. Verify on Sui Explorer

Step 6: Update Your Walrus Site (If Needed)

To update your site (e.g., modify index.html or add new files):

  1. Edit Files

    • Update the files in your website directory (e.g., ./my-site/index.html).
  2. Run the Update Command

    • Use the site-builder update command with the siteโ€™s Sui object ID:
      site-builder update --epochs 100 ./my-site 0x407a3081...
      
      • Replace 0x407a3081... with your siteโ€™s object ID.
      • This updates only the modified files, preserving unchanged blobs.
  3. Verify the Update

    • Access the updated site via the same portal URL or SuiNS domain.
    • Check the Sui Explorer to confirm the updated object metadata.

Step 7: Monitor and Maintain Your Site

Additional Notes

  • Cost Efficiency: Walrus uses the WAL token for storage payments, which is significantly cheaper than traditional Web2 storage or other blockchain solutions like Filecoin or Arweave.
  • Decentralization: Your siteโ€™s files are stored as blobs across Walrusโ€™s decentralized nodes using the Red Stuff encoding algorithm, ensuring high availability and resilience.
  • Programmability: Walrus Sites are Sui objects, allowing integration with smart contracts for dynamic features like NFT-linked personalized sites.
  • Troubleshooting: If you encounter issues, check the Walrus documentation https://docs.walrus.site/ or join the Walrus Discord for community support: https://discord.com/invite/walrusprotocol.

Key Links

Hi there ๐Ÿ‘‹ I'm Gudasol, Welcome to my Hive Blog


Gudasol-Type-Only[WhtOnBlk].png


๐Ÿง™โ€โ™‚๏ธ Mystic ~ ๐Ÿ‘จโ€๐Ÿซ Teacher ~ ๐Ÿ‘จโ€๐Ÿ’ป Coder ~ ๐ŸŽ™ Rapper ~ ๐ŸŽจ Designer


I built cXc.world ๐Ÿ—บ

I teach a model of Universal Consciousness ๐Ÿช

I'm the rapper Gudasol ๐Ÿœ› ๐ŸŒž


my php ๐Ÿก douglas.life

  • ๐ŸŒŽ Fun fact: I have been a Digital Nomad for over 5 years!! Living mostly in Latin America. Currently in Medellin, CO.

Let's Connect

Instagram | Telegram | Twitter | Discord

Find My Latest on Linktree ๐Ÿ”—๐ŸŒณ



๐Ÿ—ณ Freebies + Downloads on Gumroad โœ…



0
0
0.000
1 comments
avatar

Congratulations @douglasjames! You have completed the following achievement on the Hive blockchain And have been rewarded with New badge(s)

You distributed more than 25000 upvotes.
Your next target is to reach 26000 upvotes.

You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

0
0
0.000