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

README.md

3.36 Kb · 84 lines

gno.land/r/moul/x/plan9/dev/v0

The chain as a Plan 9 device tree. Everything a realm normally reaches through an import of chain/runtime is published here as a file instead, so it can be read, listed, bound and unioned like anything else.

cat /dev/sysname     the chain id
cat /dev/height      the block height
cat /dev/session     what a delegated key is allowed to touch
device contents
caller pkgpath of the realm that crossed into this read
domain the chain domain
drivers the table itself
height current block height
null always empty
random sha256 of chain id and height, hex; block-deterministic, not unpredictable
session the calling key's session scope, one AllowPath per line
sysname the chain id
time block time, RFC3339
user the origin caller's address
zero endless NUL bytes; reads exactly what you ask for

A device is code, not storage: reading /dev/height runs a function, so it is never stale.

The cross-realm mount

This realm posts its tree to r/moul/x/plan9/ns's /srv at deploy time, so any account can bind it into their own namespace and nobody has to import this realm to use it:

bind /srv/dev /dev

That is the mechanism the whole experiment turns on: an interface value published by one realm, stored by another, and called back later from a read-only Render. Gno has no dynamic dispatch by path, so a mount cannot be a client pulling a server by name; /srv is not a convenience here, it is the only available mechanism, which is a pleasing accident.

The tree is read-only, like every synfs tree: the files have no Write, so grafting this into a stranger's namespace cannot be turned into a write against this realm.

Why /dev/session is the interesting one

A gno.land account session is a delegated key scoped to a list of path prefixes. That is Plan 9's "the namespace is the capability set", rediscovered thirty-four years later, minus the ability to look at it as a tree. This file prints it.

Design and analysis: moul/gno-contracts#136.


Not affiliated with Plan 9. 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. This realm borrows the vocabulary and none of the code: it is an independent homage, asking what that ecosystem's spirit looks like on a chain. Full attribution: NOTICE.


Part of moul/gno-contracts — moul's versioned gno.land contracts. See the repository for the full catalog, build/test tooling, and usage.

Dependency graph:

gno.land/r/moul/x/plan9/dev/v0 dependency graph

🧪 Highly experimental — potentially vibe-coded. Not audited; may break, change, or be removed at any time. Do not use with anything of value. Full disclaimer: DISCLAIMER.