CLI tutorial
Create a store, commit a file, and read it back with the dig-store CLI.
The Quickstart leads with the free, web-first path (build and preview at no cost, publish only at the end). This page is the deeper CLI walkthrough — the parallel track for terminal and CI workflows.
The publish flow at a glance
This is the canonical publish flow — run it top-to-bottom from inside your project once your wallet is funded (step 0):
digs init # create the on-chain store (mints on Chia; store id = launcher id)
digs add -A # stage every file under the store root
digs add --discovery # publish the public /.well-known discovery manifest
digs commit -m "v3" # anchor a new capsule on-chain (dynamic per-capsule $DIG price + XCH fee)
digs push origin # push the deployment to DIGHub (rpc.dig.net)
Building and previewing locally are free — you only spend when you commit a capsule. The rest of this page walks through each step and reads content back.
0. Set up your wallet
digs init mints a singleton on Chia mainnet and costs the uniform capsule price in $DIG + a small XCH fee, so you need a seed and a funded wallet first. (Building and previewing locally are free — you only spend when you publish a capsule.)
digs seed import # import an existing BIP-39 mnemonic (prompted)
# or
digs seed generate # generate a fresh mnemonic (shown once — back it up)
Fund the wallet address that digs seed status shows before continuing. For full details see On-chain anchoring.
1. Initialize a workspace
mkdir my-project && cd my-project
digs init
digs init creates a .dig/ workspace and mints the store's singleton on Chia mainnet — the on-chain launcher id becomes the store id. It blocks until the transaction is confirmed (default timeout 300 s), then writes the store locally. Run interactively, it asks a couple of setup questions:
Relative path to the build/content directory this store captures [.]:
Make this a private (salted) store? [y/N]:
- The content directory is what the store captures (a build dir like
dist/). Press Enter to use the current directory. - Private mixes in a secret salt so the URN alone can't decrypt (see Public vs private).
You can skip the prompts with flags — handy in scripts:
digs init # current dir, public
digs init site --dir dist # a store named "site" capturing ./dist
digs init --private # private store
2. Add and commit
echo "hello dig-store" > readme.txt
digs add readme.txt --key readme # stage one file under the key "readme"
digs commit -m "first deployment" # anchor root on-chain + compile the module
commit anchors the new root on Chia mainnet and blocks until confirmed before finalizing the deployment (spends XCH). See On-chain anchoring for timeout and resume options.
--key sets the resource key explicitly; without it the key defaults to the path relative to the content root. Use -A to stage everything under the content root:
digs add -A
3. Inspect
digs status # what's staged / modified + remaining capacity
digs log # deployments — each root hash is a commit
digs urn readme.txt # preview the exact URN this file has
digs log --json prints the store id and root hashes you'll need to build a full URN.
4. Read it back
A URN locates and decrypts. With the store id and root from digs log --json:
digs cat urn:dig:chia:<storeId>:<rootHash>/readme
# → hello dig-store
Omit the <rootHash> to read from the current deployment:
digs cat urn:dig:chia:<storeId>/readme
Write the output to a file instead of stdout:
digs cat urn:dig:chia:<storeId>/readme --out readme.copy.txt
Where to go next
- On-chain anchoring — wallet setup, funding, init/commit timeouts, anchor status, and config.
- Store workflow — capture a real build directory, run multiple stores per workspace, manage staging. List them with
digs stores. - Sharing over a remote — publish a store and let others
clone/pullit. - Streaming & keys — fetch encrypted vs decrypted, list retrieval keys, checkout a whole deployment.
- View & manage your stores in DIGHUb ↗ — see your published stores in the browser.
- Ready to ship? Publish on DIGHUb ↗ — deploy a new capsule from the web, no CLI required.
Related
- Quickstart — the free, web-first path; publish only at the end
- Installing the CLI — get
dig-storeon your machine first - On-chain anchoring — wallet setup, funding, and costs
- URNs & Encryption — what a URN locates and decrypts
- Using dig-store in your project — the day-to-day release loop
- Concepts & glossary — store, capsule, and URN defined