Modules
Deploy a module
Publish a fully on-chain static site and point your .quai name at it — entirely from the CLI. The bytes are stored in contract state and verified by hash on load.
Before you start
- Clone the repo and install dependencies with
npm install. - You own the
.quainame you want to bind (register it first on the site). - A funded Quai key for gas, set in
.env.
CYPRUS1_PK=0xyour_private_key
MAINNET_RPC_URL=https://rpc.quai.network/cyprus1Configuration
Every step below is driven by environment variables. The ones you’ll touch most often:
CYPRUS1_PKPrivate key that signs and pays for the deploy. (MAINNET_CYPRUS1_PK takes priority if set.)MAINNET_RPC_URLQuai RPC endpoint. Defaults to https://rpc.quai.network/cyprus1.QNS_SITE_DIRFolder of files to publish. Defaults to examples/static-site.QNS_ENTRY_PATHEntry file route, e.g. /index.html. Auto-detected if omitted.QNS_SITE_TITLEHuman title stored in the manifest.QNS_NAMEThe .quai name this site will be bound to.QNNS_CONTRACTCanonical QNNS address — required when setting the anchor.SET_ANCHORSet to true to actually write the anchor on-chain.Publish in three steps
Publish the site bytes
Chunk, hash, and upload your files. This deploys a QNSStaticContentStore and a QNSStaticSiteModule, then writes a deployment record to deployments/ and prints the 96-byte anchor. It does not bind your name yet.
QNS_NAME=yoursite \
QNS_SITE_DIR=./examples/static-site \
QNS_SITE_TITLE="My on-chain site" \
npm run publish:static:mainnetBind your name to the module
Write the anchor into the registry so yoursite.quai resolves to the module you just deployed. This requires that your wallet owns the name. Set SET_ANCHOR=true to send the transaction (omit it for a dry run).
QNS_NAME=yoursite \
QNNS_CONTRACT=0x001d4668f5621ee6211C396243faFe163A057516 \
SET_ANCHOR=true \
npm run anchor:module:mainnetVerify and view
Re-read the module from chain, recompute the manifest and file hashes, and confirm they match. Then load it the way a wallet would, or open it in the inspector.
npm run verify:module:mainnet
QNS_NAME=yoursite npm run load:module:mainnetyoursite.quai, and in the module inspector.Shortcut: deploy an example
To see the whole flow end-to-end without building files, deploy one of the bundled examples:
# fully on-chain fixed static site
npm run deploy:examples:mainnet
# HTML + CSS static site
npm run deploy:examples:html:mainnetNext
How modules work →The anchor, manifest, and loader behind these commands.