3template = "page_indiced.html"
7## Using Bridge {#using-bridge}
9[Bridge](https://github.com/urbit/bridge) is the application we built for interacting with [Azimuth](https://azimuth.network), the Urbit PKI, and managing your Urbit ID. Importantly, Bridge also allows you to generate a keyfile that you will need to boot your ship so that it can use the Arvo network.
11This guide assumes that you have an Urbit ID, or that you have found someone to send an Urbit ID to your Ethereum address and are looking to claim it.
15To connect to Bridge, go to [https://bridge.urbit.org](https://bridge.urbit.org) into your browser, and enter your identity's credentials in the appropriate fields. If you were invited to claim an Urbit ID, it's very likely that you received an email that would direct you to Bridge, and you can simply follow the hyperlink in that email.
17Once you arrive, proceed through the steps presented. You'll eventually arrive at a page with a few choices: `Invite`, `Admin`, and `Boot Arvo`. `Admin` is the only option that you're interested in right now; click on it. On the `Admin` page, click the `Download Arvo Keyfile` button. Once you have downloaded the keyfile, you can exit Bridge and proceed to [install the Urbit binary](@/install.md).
21Alternatively, Bridge can be run locally. It's more complicated, but we recommend this option for managing sufficiently valuable assets, such as several stars or more. To install local Bridge, navigate to the [release page on GitHub](https://github.com/urbit/bridge/releases/). Download the `.zip` file of the latest version. After you download it, follow the instructions below.
25- Unzip the .zip file that you downloaded (bridge-$version.zip).
26- Open up your command line interface (Terminal on OSX, Command Prompt on Windows).
27- Navigate to the bridge-$version directory, where $version is the appropriate version number.
28- Run this command: `python3 -m http.server 5000 --bind 127.0.0.1.`
30You can then use the Bridge app by navigating to `http://localhost:5000` in your internet browser.
32Note: Bridge allows you to both make reads and writes to the Ethereum blockchain. Writing to the blockchain, such as changing your networking keys, will incur a transaction cost that will require you to have some ETH in your address.
34Once the program is running in your browser, go through the steps presented according to the type of wallet you have. You’ll be presented with a few login options. A notable option is Urbit Master Ticket. This is for those who used our Wallet Generator software. If you bought points from an Urbit sale and then used the Wallet Generator, your networking keys will be set for you. All other login options will require you to set your own networking keys.
36### Accept your transfer
38If you were given points by Tlon you likely already fully own them. But if someone else sent you a point, then you will first need to use Bridge to accept that transfer.
40After you access your Ethereum address, if a point was sent to that address, you'll come to a page that has an `Incoming Transfers` header, under which is a graphic. Click the `Details ->` link under that graphic.
42Now you'll be on the management page of your point. The transfer isn't completed yet, so click `Accept incoming transfer`. Then check both boxes and and click their associated `Sign Transaction` and `Send Transaction` buttons.
44If you already own a point, click on the `Details ->` under your sigil in the `Your Points` section.
46### Set your networking keys
48If you just accepted a point, you'll be returned to your point screen. Notice that that links and buttons are now clickable. You now own this point!
50Click the link that says `Set network keys`. The field presented in the resulting page expects a 32-byte hexadecimal string. If it's filled already, no action is required. If it is empty, you will need to generate such a string. You can generate this data any way you please, but in the terminal on MacOS or Linux, you can write
53hexdump -n 32 -e '4/4 "%08X"' /dev/random
58It should be noted that setting your network keys is an event on the Ethereum network and will therefore cost a trivial, but non-zero, amount of [gas](https://github.com/ethereum/wiki/wiki/Design-Rationale#gas-and-fees) to complete.
60### Generate your keyfile
62From the detail page associated with your point, click the `Generate Arvo Keyfile` link and you'll be taken to a page with a field titled `Network seed`. This field should already be filled in, and should match the hexadecimal string that you entered in the previous step. If it's not filled in or does not match, fill it in with the correct string.
63Click `Generate ->`, which will download a keyfile onto your machine.
65With that keyfile in hand, you can now exit Bridge and continue to the guide to [install the Urbit binary](@/install.md).
67## Using your ship {#urbit-administration}
69Your urbit (also called your _ship_) is a persistent Unix process that you mainly control from the console.
73You can turn your urbit off with `Ctrl-d` from the Chat or Dojo prompts.
75You can force-quit your urbit with `Ctrl-z` from anywhere.
79To restart your urbit simply pass the name of your pier:
93To log an urbit's command line output to a file, use `script`:
96$ script urbit.log ./urbit your-urbit
101Piers are designed to be portable, but it _must_ be done while the urbit
102is not running. Urbit networking is stateful, so you can't run two copies
103of the same urbit in two places.
105To move a pier, simply move the contents of the directory it lives in.
106To keep these files as small as possible we usually use the `--sparse`
107option in `tar`. With a pier `your-urbit/`, something like this should work:
110tar -Scvzf ~/your-urbit.tar.gz ~/your-urbit/
111scp your-old-server:~/your-urbit.tar.gz your-new-server:~
114Then to unzip it, on your other Unix server, run:
117tar xfvz your-urbit.tar.gz
120Delete the tar file, and, after installing Urbit on your new server, start your urbit back up with:
128Your Urbit terminal is separated into two parts: the prompt (the bottom line) and the record (everything above that). The record is shared; all the output from all the apps in your command set appears in it. The prompt is multiplexed.
130In the CLI, Urbit apps can process your input before you hit return. To see this in action try entering `)` as the first character at the Dojo prompt. Since there is no Dojo command or Hoon expression that starts with ')', the Dojo rejects it.
132`Ctrl-x` - Switches the prompt between running console apps
134`Ctrl-c` - Crash current event. Processed at the Unix layer and prints a stack
137`Ctrl-d` - From Chat or Dojo, stops your Urbit process.
139`Ctrl-z` - Stops the Urbit process from _anywhere_.
141`↑` / `↓` - History navigation
143The following emacs-style key bindings are available:
146Ctrl-a Cursor to beginning of the line (Home)
147Ctrl-b Cursor one character backward (left-arrow)
148Ctrl-e Cursor to the end of the line (End)
149Ctrl-f Cursor one character forward (right-arrow)
150Ctrl-g Beep; cancel reverse-search
151Ctrl-k Kill to end of line
152Ctrl-l Clear the screen
153Ctrl-n Next line in history (down-arrow)
154Ctrl-p Previous line in history (up-arrow)
156Ctrl-t Transpose characters
157Ctrl-u Kill to beginning of line
158Ctrl-y Yank from kill buffer
163On startup Urbit tries to bind to `localhost:80`. If you're already running something on port `80` -- such as any other HTTP server, or another urbit -- you'll find the urbit that you just started on `8080`, `8081`, and so on. For planets only, we also proxy web domains through Urbit's own servers. Any planet `~your-urbit` is also at `your-urbit.arvo.network`, but only after you [set up DNS](#dns-proxying).
165Once running, you can sign into Landscape, your ship’s web interface, from `http://localhost` or `https://your-urbit.arvo.network`. Since our HTTPS isn't audited / battle tested, we just call it "secure" HTTPS. You can find that on `8443`. Or `8444` (and so on) if you're already running something on `8443`.
169Planets can spawn moons, which are meant for connected devices: phones, smart TVs, digital thermostats. The basic idea is that your planet runs permanently in a data center somewhere, while moons run on all your devices. Each planet can issue ~4 billion (`2^32`) moons.
171To generate a random moon from your planet, run:
174~sampel-palnet:dojo> +moon
175moon: ~faswep-navred-sampel-palnet
176\/~.0wd.rZU67.3jSny.z1vda.7sr-s.EL1Jt.-76Nj.ugXxY.g6-Bx.HvKZl.G53oV.hPnXe.7U3E3.J4CEe.MEVuq.~08Nt\/
177 .zNT0K.k-Ab~.Nn90d.OZ2fT.-XlQQ.Cfrkf.y6~K0.2Do09.EaE3W.BSK--.5Q~9N.y3QIP.eokH-.T6lwz.gg8MX.7LU5
178 x.DJROE.IzQsy.OXOLr.IOE3a.-QI40.H5ukK.Cw-u4.uxE-y.V-o1F.Q84g0.effP0.de01g.600g1
182You must manually edit the output of `+moon` to get the correct format for the `<key>`:
186- combine into one line, omitting spaces
188- trim the leading `~.`
190`<key>` would be `0wd.rZU67.3jSny.z1vda ... <snip> ... effP0.de01g.600g1`
193Put `<key>` in a file and that file becomes `<keyfile>`.
195Another way of generating `<keyfile>` is:
198~sampel-palnet:dojo> @moon/key +moon
199moon: ~faswep-navred-sampel-palnet
202`<keyfile>` will be at `path/to/sampel-palnet/.urb/put/moon.key` and does not need editing to be used with the `-k` option.
204You can use the resulting output in the same installation flow from the [Installing Urbit](@/install.md) guide, following the same scheme as for booting a planet. That scheme is:
207$ ./urbit -w <moonname> -G <key> -c <piername>
213$ ./urbit -w <moonname> -k <keyfile> -c <piername>
216The `-c <piername>` argument is not required, but it is recommended; otherwise,
217the resulting directory is a rather unwieldy moon name.
219Here's how an example moon might be booted:
222$ ./urbit -w faswep-navred-sampel-palnet -G <key> -c mymoon
228$ ./urbit -w faswep-navred-sampel-palnet -k <keyfile> -c mymoon
231Moons are automatically synced to their parent `%kids` desk, and can control applications on their parent planet using `|link`.
233### Continuity breaches
235While the Urbit network is in this alpha state, we sometimes have to reboot the whole network. This happens either when major changes need to be shipped or we hit a bug that can't be fixed over the air.
237Because Urbit networking is stateful we call this a _continuity breach_. Everything has to be restarted from scratch. Your pier will continue to function after we have breached, but it won’t connect to the rest of the Urbit network.
239When this happens, back up any files you'd like to save, shut down your urbit, and recreate it (as if you were starting for the first time).
241## Creating a comet {#creating-a-comet}
243**Comets** are urbits whose names are 128-bits or 16 syllables, such as:
245`~dasres-ragnep-lislyt-ribpyl--mosnyx-bisdem-nidful-marzod`
247Comet names aren't quite as memorable as others, but they're disposable identities that anyone can make for free to join the live network.
251To boot your comet, go into the command line and run the following command from the directory that was created during Urbit installation:
257This will take a few minutes and will spin out a bunch of boot messages. Toward the end, you'll see something like:
260ames: on localhost, UDP 31337.
261http: live (insecure, public) on 8080
262http: live ("secure", public) on 8443
263http: live (insecure, loopback) on 12321
267## DNS proxying {#dns-proxying}
269We have a system that lets you request a domain name for your ship in the form of `ship.arvo.network`, where `ship` is your ship's name minus the `~`. This allows users to access their ships remotely using Landscape, our graphical web interface.
271Stars and planets follow the same process DNS proxying process, and galaxies have their own requirements. Moons and comets are not supported.
275For a planet or star's DNS proxying request to be made and fulfilled, they must be hosting their ship someplace with a public IP address, and its HTTP server must be listening on port 80.
277To get `ship.arvo.network` on a planet or star, you must set up DNS routing with its parent ship by starting the `:dns` app.
279To do so, simply run this command in your ship's Dojo:
285You'll then be prompted to enter the public IP address of your ship. You can also pass the IP address as an argument, using the .0.0.0.0 (`@if`) syntax. For example:
288> :dns|request .1.2.3.4
291`:dns`, running locally, will make an HTTP request to that IP address on port 80 to confirm that it is itself available at that IP and port. If that fails, you'll receive a `%bail-early` message in `:chat-cli`; this request will retry a few times. If the self-check is successful, the request is relayed to `~zod`, and you'll receive a message saying, `request for DNS sent to ~zod`. Once `~zod` has acknowledged receipt of the request, your local `:dns` app will send a `:chat-cli` message saying `awaiting response from ~zod`.
293The request will be picked up shortly, and the `ship.arvo.network` DNS record will be set to the given IP address. Once that's set up, `~zod` will be notified and `~zod` will, in turn, notify your ship. That ship will now try to verify that it can reach itself on `ship.arvo.network` over port 80. If it can't, it'll send a message saying, `unable to access via ship.arvo.network`. If it can, it will configure itself with that domain and say `confirmed access via ship.arvo.network`.
295Great! You're set up now. Try accessing your `ship.arvo.network` in your browser to use Landscape; we recommend Chrome or Brave.
299Galaxies are already required to have separate DNS entry at galaxy.urbit.org. There's no automated process for getting that binding, so if you're a galaxy-holder, get in touch with us at support@urbit.org.
301There is a command for galaxies that will try to re-use their already-necessary Ames DNS entry for HTTPS:
307This will make HTTP-requests to self-check availability over `galaxy.$AMES-DOMAIN` (currently galaxy.urbit.org), where `galaxy` is the galaxy's name minus the `~`.
309Otherwise, `:dns|auto` works the same as `:dns|ip` does with stars and planets: if it's available or unavailable, Chat messages, and so on.
313Configuring a ship's domain causes the `:acme` app to request an HTTPS certificate for that domain from LetsEncrypt. Note that LetsEncrypt also requires that the HTTP server be listening on port 80. If the certificate request fails, `:acme` will send a `:chat-cli` message with an explanation. Once the certificate is successfully retrieved, `:acme` will install it, causing the HTTP servers to restart. A secure server will be started on port 443 (the HTTPS default) if it's available. Otherwise, it will try 8443, and then increment to the next port until it can successfully bind one.
315The built-in logic for listening on port 80 is similar. Urbit tries to bind port 80; if it cannot, it tries 8080, then increments until it can bind a port. Port 80 is available to unprivileged process on recent version of macOS. Otherwise, the process needs to either be run as root, or be given special permission (CAP\_NET_BIND on Linux).
317## Messaging {#messaging}
319Let’s get started using the `:chat-cli` application, also known more simply as _Chat_. It's the simplest way to talk to people using the command line interface.
323The most common uses of `:chat-cli` right now are communicating over a public chat channel on `~dopzod/urbit-help`, and sending direct messages. Everyone is more than welcome in `~dopzod/urbit-help`. It's the place to get help, ask questions and chat about Urbit in general.
325There are two ways of using `:chat-cli`: from the terminal running the Urbit process, or through the Landscape web UI available from your ship’s URL address, mentioned earlier in this guide.
329In `:chat-cli`, any kind of medium for a message is called a _chat_. There are four types of chats: the _channel_ (public with blacklist), _village_ (private with whitelist), the _journal_ (publicly readable, privately writable), and the _mailbox_ (privately readable, publicly writable). But for now we'll be dealing with the _channel_, a publicly accessible chatroom for general use. We'll discuss the other three kinds in the [manual](#messaging-manual) section later on.
331Let's join the `~dopzod/urbit-help` channel. Use `ctrl-x` to switch from the Dojo prompt to the Chat prompt.
336~your-urbit:chat-cli> ;join ~dopzod/urbit-help
339Scrolling down your terminal window, you'll probably see a playback of previous `~dopzod/urbit-help` messages that you missed. You c
341Post a line to `~dopzod/urbit-help:`
344~your-urbit:chat-cli= Hello, world!
347You'll see your message printed below messages from others that came before it. You can always type `;chats` in the `chat-cli` prompt to list all the chats you're in:
351Glyphs will be automatically assigned to channels, but have the option of binding a glyph (single non-alphanumeric character) to the channel you're joining; the syntax is in the form of `;join ~dopzod/books +`. The chosen glyph will be the symbol that ends your prompt, and it will be what you use as a shortcut to switch to this channel.
354~your-urbit:chat-cli= ;+
358Use `;leave` to unsubscribe from a channel:
361~your-urbit:chat-cli= ;leave ~dopzod/urbit-help
364Now, let's create a channel we can invite some friends to:
367~your-urbit:chat-cli= ;create channel /my-channel
370Now you can tell your friends to `;join ~your-urbit/my-channel`.
374To send a direct message to someone, first set your audience:
377~your-urbit:chat-cli= ;~talsur-todres
380You'll see your prompt change:
383~your-urbit:chat-cli[~talsur-todres]
386Now you and `~talsur-todres` can exchange messages directly.
389~your-urbit:chat-cli[~talsur-todres] Hey buddy!
392To set your audience back to `~dopzod/urbit-help`:
395~your-urbit:chat-cli[~talsur-todres] ;~dopzod/urbit-help
398You'll see your prompt change back:
406You can use Chat to evaluate Hoon code and share the results with everyone in a chat. To do so, preface your Hoon with `#`.
409~your-urbit:chat-cli= #(add 2 2)
415~your-urbit# (add 2 2)
419### Creating and managing chats
421As mentioned before, any urbit can host any number of chats. Existing chats can be deleted or modified with various commands. All commands in this section should be sent from the `chat-cli>` prompt.
425Syntax: `;create [type] /name +`, where `+` represents an optional glyph.
427Creates and joins a chat, where `[type]` is any of the following:
428- `channel`: public chat. Has a blacklist for write control.
429- `village`: invite-only chat.
430- `journal`: publicly readable, invite-only for writing.
431- `mailbox`: publicly writeable, can only be read by its host.
433Let's create an example mailbox:
436sampel-palnet:chat-cli> ;create mailbox /coolbox ^
441Syntax: `;delete /name`
447You'll see status notifications when people enter or leave chats you're subscribed to.
449#### Notifications off
453Turn off status (and config) notifications.
457Syntax: `;unset quiet`
459Turn on status (and config) notifications.
463Glyphs are found at the end of your prompt to as a quick indicator of where
464your messages will be sent.
466Glyphs are assigned by chat hash out of the following list:
469> = + - } ) , . " ' ^ $ % & @
472Alphanumeric characters and `|#;:*~_` are reserved; all others (the
473above list, and `\/!?({<`) can be manually assigned.
475For example, `-` the glyph at the end of the prompt below might indicates that
476messages sent from this prompt will go to some chat with that glyph:
479~sampel-palnet:chat-cli-
482To see what chat is bound to a glyph, use the `;what` command followed by the
483glyph in question, or use `;what` without specifying a glyph to see all of your
484subscriptions which are bound to glyphs. For example, to see `=`:
487~sampel-palnet:chat-cli> ;what =
491To see all of your glyph-bound subscriptions:
494~sampel-palnet:chat-cli> ;what
495> ~paldev/numismatic-forum
500Not every audience has a glyph, however. When the audience doesn't have a glyph,
501such as in the case of direct-messaging a ship, we see their name at the end of
502the prompt instead. Here we're talking directly to `~dannum-mitryl`:
505~sampel-palnet:chat-cli[~dannum-mitryl]
510Syntax: `;bind [glyph] /chat-name`
512Assigns the chosen glyph to a chat owned by your ship.
517~sampel-palnet:chat-cli> ;bind + /my-chat
522Syntax: `;unbind [glyph] /chat-name`
524Unassigns the chosen glyph from a chat owned by your ship.
529~sampel-palnet:chat-cli> ;unbind + /my-chat
534Received posts are prefixed with a glyph to let you know what the
535audience is. You can activate an individual post to see the full
538There are a few special-purpose glyphs:
540- `|` - Informational messages
541- `:` - Posts directly to you
542- `;` - Posts to you and others (a multiparty conversation)
543- `*` - Posts to a complex audience that doesn't directly include you.
552Set audience to `~ship/chat`.
554#### Set audience by glyph
558Set audience to the chat previously bound to the chosen glyph.
560#### Set audience to ship
564Set audience to another ship.
566#### Set audience to own chat
570Set audience to a chat on your own ship.
572#### Set audience and send message
574Syntax: `;~dannum-mitryl this is a private message`
576Set the audience and send a post in the same line. This works for all of the
577above audience commands.
579Your audience is configured with regard to the following rules (in order):
581- if you manually set the audience, that audience.
582- if you activated a post, the post you activated.
583- audience of the last post sent.
585### Miscellaneous configuration
589Syntax: `;set showtime`
591Show the timestamp for each message. This is set by default.
595Syntax: `;unset showtime`
597Stop showing the timestamp for each message.
601Syntax: `;set timezone [+/-][hours]`
603Adjust the display of timestamps to a specific timezone. Relative to UTC.
605#### Sound notification on
609Emit a terminal bell sound if your six-syllable ship name is mentioned in
610a message. This is set by default.
612#### Sound notification off
614Syntax `;unset notify`
616Do not notify when your ship name is mentioned.
620Syntax: `;set width [number]`
622Set the rendering width of `:chat-cli` to a specific number of characters.
626## Shell {#using-the-shell}
628The Dojo is our shell; it processes system commands and returns output. It's a
629good place to quickly experiment with Urbit. On the surface the Dojo is just a
630Hoon REPL. On the inside, the Dojo is a system for operating on and transforming
635You can use the Dojo to run arbitrary Hoon code, as well as non-Hoon system
640Evaluate a Hoon expression (whitespace matters):
643~your-urbit:dojo> (add 2 2)
644~your-urbit:dojo> %+ add 2 2
647Tall-form Hoon may require multiple lines:
650~your-urbit:dojo> %+ add
655Hoon uses something called [the subject](@/docs/hoon/hoon-tutorial/the-subject-and-its-legs.md).
656The Dojo has its own subject and that's where Hoon's equivalent of variables,
657called faces, are stored.
659Use `=var` to save faces to the Dojo subject.
662~your-urbit:dojo> =foo (add 2 2)
665Note, however, that `=var` is Dojo syntax, not Hoon syntax. You cannot bind a
666face in a `.hoon` file in this way.
670Use `=dir` to set the current working directory:
673~your-urbit:dojo> =dir %/gen
676(`%` represents your current directory. For a complete explanation on urbit
677paths, see the [filesystem section](#filesystem).)
679Generators (files in `/gen`) are run with `+`:
682~your-urbit:dojo> +hello 'world'
685Save output to a file in `%clay` with `*`:
688~your-urbit:dojo> *some/file/path/hoon 'hello world'
691Run system commands from `:hood`, like `reload`, using `|`:
694~your-urbit:dojo> |reload %eyre
699Generators are short Hoon scripts, saved as `.hoon` files in the `/gen`
700directory. Many Dojo commands exist in the form of generators. The syntax for
701running a generator is `+genname` for a generator saved as `genname.hoon`.
705Accepts a path and displays the file. Similar to Unix `cat`.
708~your-urbit:dojo> +cat %/gen/curl/hoon
713Generates a code that is used to remotely log into your ship. No
717~your-urbit:dojo> +code
722Retrieves data from a URL. Accepts a `tape`. Similar to Unix `curl`.
725~your-urbit:dojo> +curl "http://nyt.com"
730Just prints the argument. Accepts a `@ta`.
733~your-urbit:dojo> +hello 'mars'
738Similar to Unix `ls`. Accepts a path.
741~your-urbit:dojo> +ls %/gen
742~your-urbit:dojo> +ls /~talsur-todres/home/2/gen/program
747Generates a random moon from a planet. No arguments.
750~your-urbit:dojo> +moon
755Compile the current state of the kernel and output a
756noun. Usually downloaded to a file in unix. No arguments.
759~your-urbit:dojo> .urbit/pill +solid
764Testrunner. Can test multiple generators at once, conventionally ones
765in the `/test` folder. Takes a path.
768~your-urbit:dojo> +test /lib
773Generate a ticket for an urbit ship. Takes an urbit name (`@p`).
777~your-urbit:dojo> +ticket ~talsur-todres-your-urbit
782Generate a recursive directory listing. Takes a path.
785~your-urbit:dojo> +tree %/sys
790The hood is the system daemon. See `gen/hood` and `app/hood`.
792`|hi` - Sends a direct message. Sort of like Unix `write`. Accepts
793an urbit name (`@p`) and a string (`tape`, which is text wrapped with double-quotes).
796~your-urbit:dojo> |hi ~binzod "you there?"
799`|link` / `|unlink` - Link / unlink a remote app. Accepts an
800Urbit name and an app name.
803~your-urbit:dojo> |link ~talsur-todres %octo
806`|mass` - Prints the current memory usage of all the kernel modules.
810~your-urbit:dojo> |mass
813`|reload` - Reloads a kernel module (vane) from source. Accepts any
817~your-urbit:dojo> |reload %clay %eyre
820`|reset` - Reloads `hoon.hoon` and all modules. No arguments.
823~your-urbit:dojo> |reset
826`|start` - Starts an app. Accepts an app name.
829~your-urbit:dojo> |start %curl
836#### Sources and sinks
838A Dojo command is either a **source** or a **sink**. A source is just something
839that can be printed to your console or the result of some computation. A
840sink is an **effect**: a change to the filesystem, a network message, a
841change to your environment, or a typed message to an app.
843Sources can be chained together, but we can only produce one effect per
848#### `=` - Set variable
850Set any environment variable:
853~your-urbit:dojo> =foo 42
854~your-urbit:dojo> (add 2 foo)
859Make sure to note that `=var` is Dojo syntax, not Hoon syntax. You cannot bind a
860variable in a `.hoon` file in this way.
862#### Special variables
864There are a few special variables that the Dojo maintains.
866#### `:` - Send to app
868`:app` goes to a local `app`, `:~ship/app` goes to the `app` on `~ship`.
870Send a `helm-hi` message to `hood`:
873~your-urbit:dojo> :hood &helm-hi 'hi'
876Apps usually expect marked data, so `&` is often used here.
878#### `*` - Save in `%clay`
880Save a new `.hoon` file in `gen`:
883~your-urbit:dojo> *%/gen/foo/hoon '# hello'
886The last component of the path is expected to be the mark (or mime
889#### `.` - Export to Unix
891Export a noun to Unix with `.`:
894~your-urbit:dojo> .foo/bar/baz (add 2 2)
897Which creates a file at `pier/.urb/put/foo/bar.baz`.
899This is very often used with `+solid`:
902~your-urbit:dojo> .urbit/pill +solid
905Which outputs a new `urbit.pill` to `pier/.urb/put/urbit.pill`
909#### `&` - Mark conversion
911Convert between marks using `&`, with the destination mark first. You can stack multiple mark conversions together, and some marks can only be converted to specific other marks. In this example, [Udon](@/docs/arvo/sail-and-udon.md#udon) is converted to `&hymn` (a mark which supplies the `html`, `head`, `body`, and closing tags) first, before being converted to HTML:
914~your-urbit:dojo>&html &hymn &udon ';h1#hello: hello'
915'<html><head></head><body><h1 id="hello">hello</h1></body></html>'
918Performing a conversion straight from Udon to the `&hymn` mark reveals a bit more about its mark conversion:
921~your-urbit:dojo>&hymn &udon ';h1#hello: hello'
922[[%html ~] [[%head ~] ~] [[%body ~] [g=[n=%h1 a=~[[n=%id v="hello"]]] c=~[[g=[n=%$ a=~[[n=%$ v="hello"]]] c=~]]] ~] ~]
925As does converting straight from Udon to HTML:
928~your-urbit:dojo>&html &udon ';h1#hello: hello'
932#### `_` - Run a function
934Use `_` to run a gate (or function):
936Write an arbitrary function and pass data to it:
939~your-urbit:dojo> _|=([a=@] (mul a 3)) 3
943Use a function to get the status code from an http request:
946~your-urbit:dojo> _|=([p=@ud q=* r=*] p) +http://google.com
950#### `+` `-` - HTTP requests
952`+http[s]://example.com` - sends a GET request
954`+http[s]://example.com &json [%s 'hi']` - sends a POST request with the
955JSON `"hi"` in the body.
957`-http[s]://example.com &json [%s 'hi']` - sends a PUT request with the
958JSON `"hi"` in the body.
960Note that the first of these is a source while the last two are sinks.
964Generators are simple Hoon scripts loaded from the filesystem. They live
967An example of a generator that is built into your urbit is `+code`. It produces
968the code needed to log into your ship remotely.
971~your-urbit:dojo> +code
972fintyr-haldet-fassev-solhex
977You can use `=` to set an environment variable in Dojo, but there are
978a few reserved names that have special uses.
982Current working `%clay` desk and revision. Read / write.
987~your-urbit:dojo> =dir %/gen
988~your-urbit:dojo> +ls %
989404/hoon docs/ dojo/hoon lib/ listen/hoon md static/udon talk/ testing/udon tree/main/ unmark/ womb/
994Current set of libraries (`/lib`) in your environment. Can be set
995with `/+`. Read / write.
1000~your-urbit:dojo> /+ number-to-words
1002Now we can use arms from lib/number-to-words.hoon
1004~your-urbit:dojo> (to-words:eng-us:number-to-words 123.456)
1009Current set of structures (`/sur`) in your environment. Can be set
1010with `/-`. Read / write.
1015~your-urbit:dojo> /- sole
1017Now we can use arms in sur/sole.hoon.
1019~your-urbit:dojo> `sole-effect:sole`[%bel ~]
1024The current (128-bit `@da`) time. Read-only.
1029~your-urbit:dojo> now
1030~2016.3.21..21.10.57..429a
1035The current urbit ship. Read-only.
1040~your-urbit:dojo> our
1046512 bits of entropy. Read-only.
1051~your-urbit:dojo> eny
1052\/0vnt.d474o.gpahj.jcf3o.448fh.2lamb.82ljm.8ol8u.b02vi.mrvvp.b7et2.knb7m.l8he\/
1053 8.8qb9s.drm36.77n9b.a0qst.30g03.l5lb5.nvsbc.v39tn
1059If you encounter `%dy-edit-busy` while entering commands, it is
1060because your Dojo is blocked on a timer or an HTTP request. Type backspace
1061and your Dojo will end the blocked command.
1064## Filesystem {#filesystem}
1066Urbit has its own revision-controlled filesystem, Clay. Clay is a typed, global,
1067referentially transparent namespace. An easy way to think about it is like typed
1070The most common way to use Clay is to mount a Clay node in a Unix directory. The mounted directory is always at the root of your pier directory.
1074This quick-start guide will walk you through some common commands. Follow along
1075using your Dojo. When you get a `>=` message after entering a command, this means
1076that the command was successful.
1078It's important to note that whenever you want to sync changes from your Unix
1079directory to your ship, you must use the `|commit %desk` command, where `%desk`
1080is the desk that you'd like to sync to.
1082When developing it's a good idea to use a separate desk. Create a `%sandbox`
1083desk based on the `%home` desk:
1086~your-urbit:dojo> |merge %sandbox ~your-urbit %home
1089Running `our` produces your ship-name, meaning that you can run the following
1090command instead of typing out the entire thing. Useful for comets due to their
1094~your-urbit:dojo> |merge %sandbox our %home
1097Most of the time we want to use Clay from Unix. Mount the entire contents of
1098your `sandbox` desk to Unix:
1101~your-urbit:dojo> |mount /=sandbox=
1104To explore the filesystem from inside Urbit `+ls` and `+cat` are useful. `+ls`
1105displays files in the current directory, and `+cat` displays the contents of
1108We can use `%` to mean "current directory." The result of the command below
1109is just like using `ls` in a Unix terminal.
1112~your-urbit:dojo> +ls %
1115Notice how `+cat %` does the same thing. That's because everything in Clay,
1116including directories, is a file.
1118Sync from your friend `~some-ship`'s `%experiment` desk to your
1122~your-urbit:dojo> |sync %sandbox ~some-ship %experiment
1125If and when your sync is successful, you will receive a message:
1128activated sync from %experiment on ~some-ship to %sandbox
1131The ship that you sync from will get their own message indicating that you're
1132both connected as peers:
1135; ~your-urbit is your neighbor.
1144A path in Clay is a list of URL-safe text, restricted to the characters
1145`[a z]`,`[0 9]`, `.`, `-`, `_`, and `~`. Formally this is a `(list knot)`,
1146meaning that each segment, delineated by `/`, is of the `knot` ASCII-text type.
1147In other words, paths are expressed as `/foo/bar/baz`. File extensions are
1148separated from file names with `/`, not `.`. Extensions are syntactically
1149identical to subdirectories, except that they must terminate the path.
1151Paths begin with a piece of data called a `beak`. A beak is formally a
1152`(p=ship q=desk r=case)`; it has three components, and might look like
1153`/~dozbud-namsep/home/11`.
1155The first `beak` component is `ship`, which is, as you might guess, the name of
1156an Urbit ship. The second component is `desk`, which is a workspace meant to
1157contain other directories; the default desk is `%home`. The third component is
1158`case`, which represents version information in various ways: date and time;
1159a version sequence, which is a value incremented by one whenever a file on the
1160given `desk` is modified; or an arbitrary plaintext label.
1162You can find what your `beak` is at any given moment by
1163typing `%` in the Dojo and looking at the first three results.
1165We use `beak`s because, unlike the current internet, the Urbit network uses a
1166global namespace. That means that a file named `example.hoon` in the `/gen`
1167directory on the `%home` desk of your ship `~lodleb-ritrul` would have a
1168universal address to anyone else on the network:
1169`/~lodleb-ritrul/home/186/gen/example/hoon`. That, of
1170course, doesn't mean that everyone on the network has privileges to access that
1173The structure that combines a `beak` with further path information is called a
1178The `%` command, which we gestured at in the above section, represents the
1179**relative path**, which is the path where you are currently working. If your
1180working directory is just your home desk, indicated by the
1181prompt `~your-planet:dojo>`, then running the command below will print your
1182working directory's `beam` information: your `beak`, and a `~` that represents
1183the empty list since no path is present.
1189`%`s can be stacked to indicate one level further up in the hierarchy for each
1190additional `%`. Try the following command:
1193~your-planet:dojo> %%%
1196You'll probably notice that it only has your ship name and the empty list. The
1197two additional `%`s abandoned the `case` and the `desk` information by moving
1198up twice the hierarchy.
1200There are no local relative paths. `/foo/bar` must be written as
1205You don't need to write out the explicit path every time you want to reference
1206somewhere outside of your working directory. You can substitute `=` for the
1209Recall that a full address in the the Urbit namespace is a `beam`: the
1210`/ship/desk/case/path`. If you've switched to another desk before, you're
1211already familiar with substitution syntax:
1214~your-urbit:dojo> =dir /=sandbox=
1217The above command substitutes uses substitution to use your current `ship` and
1218`case`; only the `desk` argument, which is located between the other two, is
1219given something new. Without substitution, you would need to write:
1222~your-urbit:dojo> =dir /~your-urbit/home/85
1225Substitutions work the same way in `beak`s (the `ship/desk/case` part) and
1226paths. For example, if you are in the `/gen` directory, you can reference a file
1227in the `/app` directory like below. (`+cat` displays the contents of a file).
1230~your-urbit:dojo> =dir %/gen
1231~your-urbit:dojo/=/=/~2018.10.2..00.35.44..d7e8/gen> +cat /===/app/curl/hoon
1234Note what was substituted out, and note that we don't need to separate `=` with
1237If we changed our working directory to something called `/gen/gmail`, we could
1241~your-urbit:dojo/=/=/~2018.10.2..00.35.44..d7e8/gen> =dir %/gmail
1242~your-urbit:dojo/=/=/~2018.10.2..00.35.44..d7e8/gen/gmail> +cat /===/app/=/split/hoon
1245Because both paths share a directory named `/gmail` at the same position in the
1246address hierarchy – which, if you recall, is just a `list` – the above command
1249We can do the same thing between desks. If `%sandbox` has been merged with
1250`%home`, the following command will produce the same results as the above
1254~your-urbit:dojo/=/=/~2018.10.2..00.35.44..d7e8/gen/gmail> +cat /=sandbox=/app/=/split/hoon
1257Most commonly this is used to avoid having to know the current revision
1258number in the `dojo`: `/~lodleb-ritrul/home/~2018.10.2..00.35.44..d7e8/gen/example/hoon`
1260#### Changing directories
1262Change the working directory with `=dir`. It's our equivalent of the Unix `cd`.
1264For example, the syntax to navigate to `/home/gen/ask` is:
1267~your-urbit:dojo> =dir /=home=/gen/ask
1270This command will turn your prompt into something like this:
1273~your-urbit:dojo/=/=/~2018.10.2..00.35.44..d7e8/gen/ask>
1276Using `=dir` without anything else uses the null path, which returns you to
1280~your-urbit:dojo/=/=/~2018.10.2..00.35.44..d7e8/gen/ask> =dir
1283Your dojo prompt will turn back into `~your-urbit:dojo>`.
1285To go up levels in the path hierarchy, recall the relative path expression
1286`%`. Stacking them represents another level higher in the hierarchy than
1287the current working directory for each `%` beyond the initial. The command below
1288brings you one level up:
1291~your-urbit:dojo> =dir %/gen
1292~your-urbit:dojo/=/=/~2018.10.2..00.35.44..d7e8/gen> =dir %%
1299Syntax: `|mount /clay/path [Unix-name]`
1301Mount the `clay-path` at the Unix mount point `Unix-name`.
1306|mount %/gen generators
1309Mounts `%/gen` to `/generators` inside your pier directory.
1314|unmount [clay-path || Unix-name]
1317Unmount the path or name from Unix.
1325Unmounts the Clay path `%/gen` from whatever name it was mounted as.
1331Unmounts the Unix path `/generators`.
1336|merge desk beak[, =gem strategy]
1339Merges a `beak` into a `desk` using an optional merge `strategy`.
1341A `beak` is a ship-desk-case triple, encoded as a
1342path(`/~dozbud/home/2`)
1347|merge %home-work /=home=, =gem %fine
1350Merge `/=home=` into `%home-work` using merge strategy `%fine`.
1353|merge %examples ~wacbex-ribmex %examples
1356Merge the `%examples` desk from `~waxbex-ribmex`
1361|sync desk plot [plot-desk]
1364Subscribe to continuous updates from remote `plot` on local `desk`.
1365`plot-desk` can specify the remote `desk` name. When omitted it defaults
1366to being the same as `desk`. Non-comet urbits have
1367`|sync %home ~parent %kids` automatically set up (where `~parent` is the
1368planet that issued a moon, the star that issued a planet, or the galaxy
1374|sync %home-local ~dozbud %home
1382|unsync desk plot [plot-desk]
1385Unsubscribe from updates from remote `plot` on local `desk` with
1386optional `plot-desk`. Arguments must match original `|sync` command.
1391|unsync %home-local ~dozbud %home
1400Label the current version of `desk` `name`.
1410`%init` - used if it's the first commit to a desk. Also can be used to
1411"reinitialize" a desk – revision numbers keep going up, but the new
1412revision isn't necessarily a descendent of the previously numbered
1413version, allowing merges to be rerun.
1415`%this` - keep what's in Bob's desk, but join the ancestry.
1417`%that` - take what's in Alice's desk, but join the ancestry. This is
1418the reverse of `%this`. This is different from `%init` because the new
1419commit has both sides in its ancestry.
1421`%fine` - "fast-forward" merge. This succeeds if and only if one head is in the
1422ancestry of the other.
1424`%meet`, `%mate`, and `%meld` - find the most recent common ancestor to
1425use as our merge base.
1427A `%meet` merge only succeeds if the changes from the merge base to
1428Alice's head (hereafter, "Alice's changes") are in different files than
1429Bob's changes. In this case, the parents are both Alice's and Bob's
1430heads, and the data is the merge base plus Alice's changed files plus
1433A `%mate` merge attempts to merge changes to the same file when both
1434Alice and Bob change it. If the merge is clean, we use it; otherwise, we
1435fail. A merge between different types of changes – for example,
1436deleting a file vs changing it – is always a conflict. If we succeed,
1437the parents are both Alice's and Bob's heads, and the data is the merge
1438base plus Alice's changed files plus Bob's changed files plus the merged
1441A `%meld` merge will succeed even if there are conflicts. If there are
1442conflicts in a file, then we use the merge base's version of that file,
1443and we produce a set of files with conflicts. The parents are both
1444Alice's and Bob's heads, and the data is the merge base plus Alice's
1445changed files plus Bob's changed files plus the successfully merged
1446files plus the merge base's version of the conflicting files.
1448`%auto` - meta-strategy. Check to see if Bob's desk exists, and if it
1449doesn't we use an `%init` merge. Otherwise, we progressively try
1450`%fine`, `%meet`, and `%mate` until one succeeds. If none succeed, we
1451merge Bob's desk into a scratch desk. Then, we merge Alice's desk into
1452the scratch desk with the `%meld` option to force the merge. Finally, we
1453annotate any conflicts, if we know how.
1459Syntax: `+cat path [path ...]`
1461Similar to Unix `cat`. `+cat` takes one or more `path`s, and prints their
1462contents. If that `path` is a file, the contents of the file is printed. If the
1463`path` terminates in a directory, the list of names at that path is produced.
1469Similar to Unix `ls`. `+ls` takes a single `path`.
1471Produces a list of names at the `path`.
1474~your-urbit:dojo> +cat %/our/home/gen/curl/hoon
1481Remove the data at `path`. `Path` must be a path to the actual node, not a
1486Syntax: `|cp to from`
1488Copy the file at `from` into the path `to`.
1492Syntax: `|mv to from`
1494Move the file at `from` into the path `to`.
1496In Clay, `|mv` is just a shorthand for `|cp` then `|rm`. The `|rm`
1497doesn't happen unless the `|cp` succeeds.
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list