Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

ns/v0 package

Overview

Package ns is a Plan 9 namespace server for gno.land.

Every account gets a private, persistent namespace: its own RAM root plus a mount table it alone controls. Realms publish file trees into /srv, accounts bind those trees wherever they like, and a read-only rc shell renders the whole thing in gnoweb.

This is the part of Plan 9 that gno does not otherwise have. The chain has a single global tree of realm paths that looks the same to everybody; here a name means what YOU bound it to. Composing two realms that were never written to work together stops being a redeploy and becomes a transaction:

Example
1gnokey maketx call -pkgpath gno.land/r/moul/x/plan9/ns/v0 -func Exec \
2  -args 'bind -ac /srv/dev /dev; echo hello > /tmp/greeting'

SECURITY. Mounted trees are READ-ONLY by construction: ninep.File has no mutating method, so grafting a foreign realm's tree into your namespace cannot be turned into a write against that realm. Writes only ever reach a memfs tree this realm created for you. A crossing write method would mint THIS realm's frame for the callee, which is the confused-deputy shape that r/gov/dao's Executor relies on deliberately and p/nt/grc20's Teller refuses deliberately; it is out of scope for v0. See moul/gno-contracts#136.

NOTICE. Plan 9 from Bell Labs is the work of the Computing Science Research Center at Bell Labs; the name and the marks are theirs, and the copyright is held by the Plan 9 Foundation (https://p9f.org). This realm is not affiliated with, endorsed by, or sponsored by them, and contains no Plan 9 code: it borrows the vocabulary so that the design reads without a glossary, and it is an homage, asking what that ecosystem's spirit looks like on a chain. Full attribution: NOTICE.md at the root of moul/gno-contracts.

Function

Post

func Post(cur realm, name string, f ninep.File)

Post publishes a file tree under name in /srv, where any account can bind it. The posting realm is recorded and is the only one that may Unpost.

Names are first come, first served, which is fine for an experiment and would not be for anything else.

Params

Command

# WARNING: This command is running in an INSECURE mode.
# It is strongly recommended to use a hardware device for signing
# and avoid trusting any computer connected to the internet,
# as your private keys could be exposed.

gnokey maketx call -pkgpath "gno.land/r/moul/x/plan9/ns/v0" -func "Post" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -chainid "gnoland-1" -remote "https://rpc.gno.land" ADDRESSgnokey query -remote "https://rpc.gno.land" auth/accounts/ADDRESS
gnokey maketx call -pkgpath "gno.land/r/moul/x/plan9/ns/v0" -func "Post" -args $'' -args $'' -gas-fee 1000000ugnot -gas-wanted 1_000_000_000 -send "" -broadcast=false ADDRESS > call.tx
gnokey sign -tx-path call.tx -chainid "gnoland-1" -account-number ACCOUNTNUMBER -account-sequence SEQUENCENUMBER ADDRESS
gnokey broadcast -remote "https://rpc.gno.land" call.tx