LNS web Draft · 27 November 2026

9. Publishing

A publisher turns a folder into lns-links/1 lists, uploads the files and lists to Logos Storage, and points the LNS name's record at the root list. lns publish does this in one command, and can deploy the same folder to an https:// host in the same run.

Describes lns publish from the same source as the gateway, round 3 (single-publish.mjs, publish.mjs, icon.mjs), with the names CLI for LEZ 0.4. Other publishers may work differently; only the boxed requirements apply to all of them.

9.1 Overview

lns publish runs from the root of a site's repository, where a file called lns.json says what to publish and where. It needs Node 24 or newer, a Logos Storage node to upload to, and the names CLI with the wallet that owns the name. It has no npm dependencies.

node /path/to/lns-gateway/lns.mjs publish [--dry-run] [--lns-only] [--https-only] [--yes] [--strict] [--no-avatar]

It never signs anything itself. The record update is done by your own names CLI, which uses your own wallet. lns publish never reads, prints or passes private keys or passwords. Because Logos Storage has no storage rent or marketplace yet, files stay reachable only while a Storage node keeps them (section 5.11). If the name is held privately, signing the record update also requires a local proof that takes minutes (section 4.9).

A publisher MUST compute the SHA-256 of every file and list from the bytes on its own machine, write it on every list entry, and set cid.sha256 to the root list's SHA-256 in the same record update that sets cid.

publish.mjs hashes each file and each list locally (sha256Hex(bytes), sha256Hex(listBytes)); buildNamesProfileArgs in single-publish.mjs puts --cid, --set cid.sha256=… and --set cid.type=links in one names profile call.

A publisher SHOULD finish uploading every file and list before it updates the record, so the record never points at content that is not there yet.

lns publish uploads in step 2 and signs in step 5, and stops before signing if the upload fails.

9.2 lns.json

FieldRequiredMeaning
nameyesThe LNS name to publish to, bare (alice).
folderyesThe site folder, relative to lns.json.
titlenoWritten as # title on the root list (section 5.4).
excludenoGlob patterns (*, **, ?) left out of the LNS tree but kept for https://, for example ["_headers"]. A pattern ending in / matches folders only.
iconnoA PNG, JPEG, GIF or WebP inside folder, used as the https:// favicon and the LNS avatar (9.5).
storagefor LNSThe Logos Storage REST API URL. /api/storage/v1 is added if missing. Falls back to LOGOS_STORAGE_API.
rpcnoLEZ sequencer JSON-RPC URL. Default https://lez.nameswallet.app/, or LNS_SEQUENCER_URL.
registrynoLNS registry program ID. Default 6Yxj5k8AiuBSuMAYVQFGrYKjJGUSSaWWgoB9D9XXN3gA, or LNS_REGISTRY.
namesnoThe names CLI command or path. Default names.
https.urlunless --lns-onlyThe public https:// base URL of the same site.
https.commandunless --lns-onlyYour deploy command. It runs in the repository root through a shell, with LNS_ROOT_CID and LNS_ROOT_SHA256 set. Its exit code decides success.
lns.replacenoMap of site paths to { "command", "output" }: a static file that replaces that path in the LNS tree only (9.8). command is optional when output already exists.
lns.excludeScriptsnotrue leaves .js and .mjs files and <script> tags out of the LNS tree only. Default false.
maxFiles, maxBytes, maxFileBytesnoSize limits checked before upload. Defaults 2,000 files, 200 MiB in all, 100 MiB per file.

Dotfiles and dot-folders, including .well-known/, never enter the LNS tree. Empty folders are skipped. Symbolic links are refused, so a tree is never published with parts silently missing.

9.3 The six steps

  1. Check. The folder exists, every name in it is a valid lns-links/1 name (section 5.5), there are no symbolic links, and the sizes are within limits. The icon is checked. Anything the content profile (section 7) would remove or block is reported as a warning, and so is every page with a <script> tag and no lns.replace entry ("shows without its scripts on LNS"). Warnings do not stop the run unless --strict is set. Nothing has been sent yet.
  2. LNS upload. If icon is set, a <link rel="icon"> is added to pages that have none. lns.replace commands run. Then the lists are built bottom-up in canonical form (section 5.6), compared with the tree the name points to now, and only new or changed files and the lists above them are uploaded.
  3. Proof. <folder>/.well-known/lns.json is written for the https:// copy: a JSON object with the fields version (1), name, rootCid, rootSha256 and publishedAt. It is left alone if it already matches.
  4. https. https.command runs. It is skipped when nothing changed and <https.url>/.well-known/lns.json already shows the same root.
  5. Sign. The exact record update and its expected fee are shown, you confirm (unless --yes), and your names CLI runs it:
    names profile <name> --cid <rootCid> --set cid.sha256=<rootSha256> --set cid.type=links [--avatar <icon>]
    This sets cid, cid.sha256, cid.type and, with an icon, avatar in one transaction. It is skipped when the record already has that root and avatar. Without a terminal and without --yes, lns publish refuses to sign. After a successful update, if the gateway operator's purge settings are present, it purges the gateway's CDN for the changed URLs (section 8.6). Without them, nothing is purged and the gateway catches up within a few minutes.
  6. Verify. It fetches <https.url>/.well-known/lns.json and one page, resolves the name on chain, and reports either https and lns:// both serve root <cid> or which side is behind.

The order is chosen so the chain never gets ahead of the https:// copy by accident: if the deploy fails, lns publish stops before signing.

9.4 Flags

FlagEffect
--dry-runPrints every step and command. Uploads nothing, adds no favicons, runs no replacement commands, writes no proof, deploys nothing and signs nothing.
--lns-onlyCheck, LNS upload, sign and the LNS half of verify. No favicons, proof or https.command.
--https-onlyCheck, favicons, proof, https.command and the https half of verify. No upload and no signing.
--yes, -ySigns without asking.
--strictAny content-profile warning stops the run at step 1.
--no-avatarLeaves --avatar out. An avatar already on chain is kept.
--icon, --config, --storage, --rpc, --registry, --names, --jsonOverride the matching setting, or print JSON.

9.5 Icon and avatar

One icon serves both copies. On https:// it becomes the favicon of every page that has no icon link of its own. On LNS it becomes the record's avatar (section 4.6), which the Names Browser shows on tiles, history and tabs.

If a configured icon fails, lns publish stops before anything is sent, with a plain reason such as assets/icon.png is 31 KB; the avatar limit is 12 KB: use a 64x64 PNG. With no icon set, it tries the <link rel="icon"> of the root index.html, then favicon.png at the site root. If that file is unusable, it warns and goes on without an avatar.

9.6 Costs

ActionCost on the LEZ 0.4 testnet
Record update (names profile, step 5)about 250,000 LEZ, whatever the size of the site
Uploading files and lists to Logos Storageno LEZ: lns publish pays only for the record update
A re-run where the root and avatar are unchangednothing: no transaction is sent
An on-chain page instead (section 4.5)roughly 185 to 220 LEZ per byte, paid again on every change

The 250,000 figure is the estimate lns publish shows before you confirm. The names CLI and the chain decide the real fee.

9.7 Re-runs and failures

Running lns publish again is always safe. Unchanged files and folders are reused by hash and not uploaded again (it reads up to 50,000 files and 50,000 folders of the old tree to compare). An unchanged proof file is left as it is, an up-to-date https:// host is not redeployed, and an unchanged record gets no transaction.

When a step fails, the message says which copy is ahead and how to finish:

FailureStateTo finish
Check, icon, --strict or a replacement commandNothing was changed.Fix it and run again.
UploadNeither https:// nor the record was changed.Check the Storage node and run again.
https.commandLNS Storage is ahead; the record was not changed.Fix the deploy and run again.
Signing declined or the names CLI failedhttps:// is ahead; the record still points at the old root.Run the printed names profile … command, or run again.
VerifyOne side is still serving the old root, for example during CDN or chain lag.Wait, or run again with --https-only or --lns-only.

9.8 Script pages

LNS clients run no page code (section 7), so a page that builds itself with JavaScript shows empty on LNS. There are two tools for this:

Step 1 lists every page that still has a <script> tag and no replacement, so you can see what will show without its scripts.

9.9 Examples

9.9.1 LNS only

The site in Appendix C: three files for alice, with this lns.json:

{
  "name": "alice",
  "folder": "site",
  "title": "Alice",
  "storage": "http://127.0.0.1:8183"
}

Preview, then publish:

node /path/to/lns-gateway/lns.mjs publish --lns-only --dry-run
node /path/to/lns-gateway/lns.mjs publish --lns-only

The first run uploads five blobs (three files, two lists) and asks to run:

names profile alice --cid CIDrootlist \
  --set cid.sha256=46e9b7064d5ff69a69d2cd6a40235c933f35955d254d5fefd47f00c5b12a07f8 \
  --set cid.type=links

Here CIDrootlist stands for the real root CID that Storage returned. After it lands, lns://alice/ works in the Names Browser and https://alice.lnsweb.online/ on the gateway. Change only docs/intro.html and run again: it uploads the new file, the docs list and the root list, reuses index.html and style.css, and sends one more record update.

9.9.2 https:// and LNS together

{
  "name": "nameswallet",
  "folder": "site",
  "icon": "assets/icon.png",
  "exclude": ["_headers"],
  "lns": {
    "replace": {
      "apps/index.html": {
        "command": "node apps-src/static.mjs",
        "output": "build/lns/apps/index.html"
      }
    },
    "excludeScripts": true
  },
  "storage": "http://127.0.0.1:18183",
  "https": {
    "url": "https://nameswallet.app",
    "command": "npx cf deploy"
  }
}

One run builds a static apps/index.html for LNS, uploads what changed, writes the proof, deploys with npx cf deploy, updates the record with the new root and the icon as avatar, and checks that both copies serve the same root. If nothing changed, it uploads nothing, deploys nothing and sends no transaction.

This document is published the LNS-only way. Its lns.json is in Appendix C.5.

9.10 Safety

A publisher SHOULD show the exact record update and ask for confirmation before it signs.

single-publish.mjs step 5 prints the names profile command and fee, asks unless --yes, and refuses without a terminal.