walrus-sites
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseWalrus Sites — Decentralized Website Hosting
Walrus Sites — 去中心化网站托管
MCP tool: When available in your environment, also query the Sui documentation MCP server () for up-to-date answers. Use it for verification and for details not covered by these reference files.https://sui.mcp.kapa.ai
Walrus Sites lets you deploy a static website (HTML/CSS/JS) to Walrus, with an on-chain Sui object tracking the site's resources. A portal server resolves site subdomains, fetches resources from Walrus, and serves them over HTTP. The result is a fully decentralized frontend — no centralized server, CDN, or DNS required.
Source constraint: All information in this skill is sourced from the MystenLabs/walrus-sites repository and the Walrus Sites documentation. When extending or updating this skill, only pull from these sources. Do not use third-party blogs or unofficial tutorials.
Common failures:
- Blobs expire. Sites published with too few epochs silently break — the portal returns 404 once the blobs expire. Always use a generous value (30+).
--epochs - Portal misconfiguration. The portal's must match the Walrus Sites framework package (
original_package_id), not your app's Move package. The testnet example config ships with the correct value — don't change it.site::Site - Testnet sites can't use . The public
wal.appportal only serves mainnet sites. Testnet requires a self-hosted local portal.wal.app - SPA routing. Single-page apps need routes config to handle client-side routing. Without it, direct navigation to
ws-resources.jsonreturns 404./my-route
MCP工具: 当你的环境中可用时,也可以查询Sui文档MCP服务器()获取最新答案。用它来验证信息,以及获取这些参考文件未涵盖的细节。https://sui.mcp.kapa.ai
Walrus Sites允许你将静态网站(HTML/CSS/JS)部署到Walrus,通过链上Sui对象跟踪站点资源。门户服务器会解析站点子域名,从Walrus获取资源并通过HTTP提供服务。最终实现完全去中心化的前端——无需中心化服务器、CDN或DNS。
来源限制: 本技能中的所有信息均来自MystenLabs/walrus-sites仓库和Walrus Sites文档。扩展或更新本技能时,仅可从这些来源获取内容,请勿使用第三方博客或非官方教程。
常见故障:
- Blob过期。 使用过少纪元数发布的站点会无声失效——一旦Blob过期,门户将返回404错误。请始终使用足够大的值(30+)。
--epochs - 门户配置错误。 门户的必须匹配Walrus Sites框架包(
original_package_id),而非你的应用Move包。测试网示例配置已包含正确值——请勿修改。site::Site - 测试网站点无法使用。 公共
wal.app门户仅托管主网站点。测试网需要自行搭建本地门户。wal.app - SPA路由。 单页应用需要路由配置来处理客户端路由。如果没有该配置,直接导航到
ws-resources.json会返回404错误。/my-route
Sub-skills
子技能
publishing — Building and deploying sites
publishing — 构建并部署站点
Path:
Load when: deploying a new site, updating an existing site, choosing epoch duration, configuring , or troubleshooting errors.
Covers: , , flag, blob expiration, configuration, SPA routing, site naming, for debugging, .
publishing/SKILL.mdws-resources.jsonsite-buildersite-builder publishsite-builder update--epochsws-resources.jsonsite-builder sitemapsite-builder destroy路径:
加载时机: 部署新站点、更新现有站点、选择纪元时长、配置或排查错误时。
涵盖内容: 、、参数、Blob过期、配置、SPA路由、站点命名、用于调试的、。
publishing/SKILL.mdws-resources.jsonsite-buildersite-builder publishsite-builder update--epochsws-resources.jsonsite-builder sitemapsite-builder destroyportal — Running a local portal for testnet
portal — 为测试网运行本地门户
Path:
Load when: the user needs to view a testnet site, set up the local portal, fix portal 404s, or understand how portal resolution works.
Covers: cloning the portal, installing dependencies (Bun), , the gotcha, starting the server, URL format, port conflicts, mainnet vs testnet differences.
portal/SKILL.mdportal-config.yamloriginal_package_id路径:
加载时机: 用户需要查看测试网站点、搭建本地门户、修复门户404错误或了解门户解析原理时。
涵盖内容: 克隆门户仓库、安装依赖(Bun)、、的注意事项、启动服务器、URL格式、端口冲突、主网与测试网的差异。
portal/SKILL.mdportal-config.yamloriginal_package_idRouting guide
路由指南
| Task | Load |
|---|---|
| Deploy a frontend to Walrus Sites | |
| Update an existing deployed site | |
| Fix 404 or expired site | |
| View a testnet site locally | |
| Set up the local portal | |
| Portal shows "Page not found" | |
| Configure SPA routing | |
| Check what resources a site has | |
| Delete a deployed site | |
| Choose between Walrus Sites and traditional hosting | Skill Content below |
| 任务 | 加载内容 |
|---|---|
| 将前端部署到Walrus Sites | |
| 更新已部署的现有站点 | |
| 修复404或过期站点 | |
| 本地查看测试网站点 | |
| 搭建本地门户 | |
| 门户显示“页面未找到” | |
| 配置SPA路由 | |
| 查看站点包含的资源 | |
| 删除已部署的站点 | |
| 在Walrus Sites与传统托管之间做选择 | 下方技能内容 |
Skill Content
技能内容
Key concepts
核心概念
-
Site object. A Sui object of type(from the Walrus Sites framework package). It holds metadata (name, description) and dynamic fields mapping resource paths to Walrus blob references. Created by
site::Site, owned by the publisher's address.site-builder publish -
Resources. Each file in the deployed directory becomes a resource stored on Walrus. Small files may be batched into a single "quilt" blob. Each resource has a path (e.g.,,
/index.html) and optional HTTP headers./assets/main.js -
Portal. A server that mapsURLs to on-chain site objects. It reads the site's dynamic fields to find the requested resource path, fetches the blob from a Walrus aggregator, and returns it as an HTTP response. The portal is framework-level infrastructure, not part of your app.
<base36-site-id>.localhost:3000 -
. A configuration file in the site's root directory that controls resource headers, routing, and site metadata. Auto-generated on first publish with the site object ID. On subsequent runs, the site-builder reads it to determine whether to create a new site or update the existing one.
ws-resources.json -
Blob expiration. Walrus blobs have a finite storage duration measured in epochs. When blobs expire, the portal can no longer fetch them and returns 404. Useto check expiration dates. Re-publish with a higher
site-builder sitemap <object-id>value to fix.--epochs
-
站点对象(Site object):类型为的Sui对象(来自Walrus Sites框架包)。它包含元数据(名称、描述)以及将资源路径映射到Walrus Blob引用的动态字段。由
site::Site创建,归发布者地址所有。site-builder publish -
资源(Resources):部署目录中的每个文件都会成为存储在Walrus上的资源。小文件可能会被批量打包到单个“拼接(quilt)”Blob中。每个资源都有路径(如、
/index.html)和可选的HTTP头。/assets/main.js -
门户(Portal):将URL映射到链上站点对象的服务器。它读取站点的动态字段以找到请求的资源路径,从Walrus聚合器获取Blob,并将其作为HTTP响应返回。门户是框架级基础设施,不属于你的应用。
<base36-site-id>.localhost:3000 -
:站点根目录中的配置文件,用于控制资源头、路由和站点元数据。首次发布时会自动生成并包含站点对象ID。后续运行时,site-builder会读取该文件以确定是创建新站点还是更新现有站点。
ws-resources.json -
Blob过期(Blob expiration):Walrus Blob的存储时长是有限的,以纪元数衡量。当Blob过期时,门户无法再获取它们,会返回404错误。使用查看过期日期。重新发布时使用更高的
site-builder sitemap <object-id>值即可修复。--epochs
Rules
规则
- Always use or higher for testnet deploys. Low values (like 5) cause blobs to expire within days. For production mainnet, use even higher values or
--epochs 30.--permanent - Build before publishing. Run (or equivalent) to produce a static
npm run builddirectory. The site-builder publishes whatever directory you point it at.dist/ - Don't change in the portal config unless you know the Walrus Sites framework package has been upgraded. The testnet example value is correct.
original_package_id - is mainnet only. For testnet, self-host the portal from the
wal.apprepo.MystenLabs/walrus-sites - Check after first publish. It records the site object ID. Keep it in version control so future publishes update the existing site rather than creating a new one.
ws-resources.json
- 测试网部署时始终使用或更高值。 低值(如5)会导致Blob在数天内过期。对于生产主网,请使用更高的值或
--epochs 30参数。--permanent - 发布前先构建。 运行(或等效命令)生成静态
npm run build目录。site-builder会发布你指定的任意目录中的内容。dist/ - 请勿修改门户配置中的,除非你确认Walrus Sites框架包已升级。测试网示例值是正确的。
original_package_id - 仅适用于主网。 测试网需要从
wal.app仓库自行托管门户。MystenLabs/walrus-sites - 首次发布后检查。 它记录了站点对象ID。将其纳入版本控制,以便后续发布时更新现有站点而非创建新站点。
ws-resources.json
Common mistakes
常见错误
- Publishing with and wondering why the site is gone a week later. Blobs expired. Re-publish with
--epochs 5.--epochs 30+ - Changing the portal's to your app's package ID. The portal needs the Walrus Sites framework package ID (
original_package_id), not your Move contract's package ID. These are completely different things.site::Site - Trying to visit a testnet site on . It only serves mainnet. You need a local portal for testnet.
wal.app - Forgetting to build the frontend before publishing. publishes the
site-builder publish dist/directory contents. If you didn'tdist/first, you're publishing source files or stale output.npm run build - Deploying an SPA without fallback routing. React/Vue/Svelte SPAs use client-side routing. Direct navigation to hits the portal, which looks for
/borrowsas a resource — and it doesn't exist. Configure a fallback in/borrows.ws-resources.json - Not killing port 3000 before starting the portal. Vite dev server, Next.js, or other tools often use port 3000. The portal silently fails to bind if the port is taken.
- 使用发布,一周后疑惑站点为何消失。 Blob已过期。重新发布时使用
--epochs 5。--epochs 30+ - 将门户的改为应用的包ID。 门户需要的是Walrus Sites框架包ID(
original_package_id),而非你的Move合约包ID。这两者完全不同。site::Site - 尝试在上访问测试网站点。 它仅托管主网站点。测试网需要本地门户。
wal.app - 发布前忘记构建前端。 会发布
site-builder publish dist/目录的内容。如果未先运行dist/,你发布的将是源文件或过时的输出内容。npm run build - 部署SPA时未配置回退路由。 React/Vue/Svelte等SPA使用客户端路由。直接导航到会访问门户,而门户会查找
/borrows作为资源——但该资源不存在。请在/borrows中配置回退路由。ws-resources.json - 启动门户前未释放3000端口。 Vite开发服务器、Next.js或其他工具通常会使用3000端口。如果端口已被占用,门户会静默绑定失败。