on master help sign in
overhaul development section content
commit44ed011aacd068446ec7402f523d74362eb9b3d2 authorJosh Lehman <josh@starcity.com> dateThu 11 Mar 2021, 11:00 (6 years ago) parent991692d
9 files changed+322−485
development/_index.md+12−11 development/airlock.md−135 development/community-projects.md−20 development/develop.md+107−94 development/environment.md+62 development/grants.md+87 development/integrating-api.md−224 development/precepts.md+5−1 development/project-repositories.md+49
development/_index.md+12−11
@@ -1,28 +1,29 @@
11+++
22title = "Development"
3−weight = 200
3+weight = 100
44sort_by = "weight"
55template = "sections/docs/chapters.html"
66+++
77
8+This section covers the development process in general.
89
10+## [Getting Started](@/docs/development/develop.md)
911
10−## [Developer's Guide](@/docs/development/develop.md)
12+An orientation to the various development paths within the Urbit ecosystem
1113
12−How to get started developing on Urbit.
14+## [Environment Setup](@/docs/development/environment.md)
1315
14−## [Using the HTTP API](@/docs/development/integrating-api.md)
16+How to get your development environment ready for Urbit development.
1517
16−How to use Urbit's HTTP API. See also [Eyre](@/docs/arvo/eyre/eyre.md),
17−[Arvo's](@/docs/arvo/arvo.md)'s HTTP server vane.
18+## [Grants Program](@/docs/development/grants.md)
1819
19−## [Airlock](@/docs/development/airlock.md)
20+An introduction to our grants program, where you can earn address space for
21+contributing to the project.
2022
21−The set of APIs for interacting with a running Urbit ship from outside the Urbit network.
23+## [Project Repositories](@/docs/development/project-repositories.md)
2224
23−## [Community Projects](@/docs/development/community-projects.md)
24−
25−Projects created by the community.
25+A directory of official code repositories, and unofficial community-maintained
26+ones.
2627
2728## [Precepts](@/docs/development/precepts.md)
2829
development/airlock.mddeleted−135
@@ -1,135 +0,0 @@
1−+++
2−title = "Airlock"
3−weight = 30
4−template = "doc.html"
5−+++
6−
7−Airlock is the term to describe the set of APIs for interacting with a running Urbit ship from outside of the Urbit network.
8−
9−## Urlock-py
10−
11−Urlock-py is a python library for using Airlock.
12−
13−It consists of a single class `Urlock`. Methods are below.
14−
15−`__init__(url, code)`
16−
17− Constructor
18−
19− `url` - url to the http interface of the running ship
20−
21− `code` - the `+code` of the ship, should never be published
22−
23−
24−`connect()`
25−
26− Connect to the running ship
27−
28−
29−`poke(ship, app, mark, j)`
30−
31− `ship` - ship to send the poke
32−
33− `app` - gall application to send the poke to
34−
35− `mark` - mark of data sent to the gall application
36−
37− `j` - json poke data
38−
39−
40−`ack(eventId)`
41−
42− Send an acknowledgment of receipt of a message so it's cleared from the ship's queue
43−
44− `eventId` - id of the event to acknowledge
45−
46−
47−`sse_pipe()`
48−
49− returns the sseclient object
50−
51−
52−`subscribe(ship, app, path)`
53−
54− `ship` - ship on which the gall application lives
55−
56− `app` - gall application to subscribe to
57−
58− `path` - path to subscribe on
59−
60−
61−Below is a simple script to send a message and subscribe to a chat channel. The specifics require an understanding of the `chat-store` and `chat-hook` interfaces.
62−
63−Even without experience with python this should be pretty readable.
64−
65−```
66−#!/usr/bin/python3
67−
68−import urlock
69−import baseconvert
70−import time
71−import random
72−import dumper
73−
74−zod = urlock.Urlock("http://localhost:8080", "lidlut-tabwed-pillex-ridrup")
75−r = zod.connect()
76−s = zod.subscribe("zod", "chat-store", "/mailbox/~/~zod/mc")
77−
78−pipe = zod.sse_pipe()
79−
80−s = baseconvert.base(random.getrandbits(128), 10, 32, string=True).lower()
81−uid = '0v' + '.'.join(s[i:i+5] for i in range(0, len(s), 5))[::-1]
82−
83−p = zod.poke("zod", "chat-hook", "json", {"message": {"path": "/~/~zod/mc",
84− "envelope": {"uid": uid,
85− "number": 1,
86− "author": "~zod",
87− "when": int(time.time() * 1000),
88− "letter": {"text": "hello world!"}}}})
89−
90−
91−for m in pipe.events():
92− dumper.dump(m)
93− dumper.dump(zod.ack(int(m.id)))
94−```
95−
96−After the imports, instantiating the Urlock class with the address of the running ship and the `+code` from the ship. This code should not be shared. The one used here is for fakezods.
97−
98−```
99−zod = urlock.Urlock("http://localhost:8080", "lidlut-tabwed-pillex-ridrup")
100−```
101−
102−Next we connect to the ship and set up a subscription to chat-store
103−
104−```
105−r = zod.connect()
106−s = zod.subscribe("zod", "chat-store", "/mailbox/~/~zod/mc")
107−```
108−
109−After this we get the SSE pipe that all responses will arrive on.
110−
111−```
112−pipe = zod.sse_pipe()
113−```
114−
115−Next comes some setup for specific implementation details of `chat-hook` and a `poke` is sent to create a new chat message.
116−
117−```
118−s = baseconvert.base(random.getrandbits(128), 10, 32, string=True).lower()
119−uid = '0v' + '.'.join(s[i:i+5] for i in range(0, len(s), 5))[::-1]
120−
121−p = zod.poke("zod", "chat-hook", "json", {"message": {"path": "/~/~zod/mc",
122− "envelope": {"uid": uid,
123− "number": 1,
124− "author": "~zod",
125− "when": int(time.time() * 1000),
126− "letter": {"text": "hello world!"}}}})
127−```
128−
129−Finally, the loop here is used to read messages from the sse pipe and send back an acknowledgment. This is important to clear the queue on the ship.
130−
131−```
132−for m in pipe.events():
133− dumper.dump(m)
134− dumper.dump(zod.ack(int(m.id)))
135−```
development/community-projects.mddeleted−20
@@ -1,20 +0,0 @@
1−+++
2−title = "Community Projects"
3−weight = 50
4−template = "doc.html"
5−+++
6−
7−## Tutorials
8−
9−Here are some tutorials written by members of the Urbit community.
10−
11−- [A Nock Interpreter](https://jtobin.io/nock) by `~nidsut-tomdun`
12−- [Basic Hoonery](https://jtobin.io/basic-hoonery) by `~nidsut-tomdun`
13−- [The Complete Guide to
14− Gall](https://github.com/timlucmiptev/gall-guide/blob/master/overview.md) by
15− `~timluc-miptev`
16−- [Nock for Everyday Coders](https://blog.timlucmiptev.space/part1.html) by `~timluc-miptev`
17−- [Rote - An Annotated Flashcard App](https://github.com/lukechampine/rote)
18−
19−If you want to add something to the list, [shoot us an email](mailto:support@urbit.org) or make a pull request in the [docs repository](https://github.com/urbit/docs).
20−
development/develop.md+107−94
@@ -6,99 +6,112 @@ template = "doc.html"
66aliases = ["/docs/using/creating-a-development-ship/", "/docs/getting-started/contributing"]
77+++
88
9−You can develop on Urbit in three ways:
9+There are many ways to get involved as a developer. This guide serves to give
10+you a "lay of the land" for developing on Urbit. Let's start with what you can
11+contribute to. At a high level, you can:
12+
13+- [Build clients](#clients), which use Urbit as their back-end to store data and
14+ interact with the network
15+- [Develop agents](#agents), or more precisely [*gall*
16+ agents](@/docs/arvo/gall/gall.md), which are written in [Hoon](/docs/hoon/)
17+ and can best be thought of as microservices
18+- [Contribute to Urbit's core](#core), which involves contributing to Urbit
19+ itself &mdash; either the operating system
20+ ([Arvo](https://github.com/urbit/urbit/tree/master/pkg/arvo)), runtime
21+ ([Vere](https://github.com/urbit/urbit/tree/master/pkg/urbit)), or public key
22+ infrastructure ([Azimuth](https://github.com/urbit/azimuth))
23+
24+Below we'll go into more detail about each of these options and do our best to
25+point you towards a number of additional helpful resources that can be found
26+throughout the docs.
27+
28+### Build Clients {#clients}
29+
30+Urbit ships with [Landscape](@/docs/landscape/overview.md), which can be thought
31+of as its flagship client. Landscape can be broken into two different technical
32+components: there's the collection of [services](#services) that utilize the
33+Urbit for networking and data persistence, and the JavaScript client, which is
34+an [interface](https://github.com/urbit/urbit/tree/master/pkg/interface) built
35+with [React](https://reactjs.org).
36+
37+Additionally, you can [contribute to
38+Landscape](https://github.com/urbit/urbit/blob/master/pkg/interface/CONTRIBUTING.md)
39+by tackling issues in its [issue
40+tracker](https://github.com/urbit/landscape/issues) and/or running the the
41+[development stream](https://groups.google.com/a/urbit.org/g/dev/c/r2hv4ajCLwk).
42+
43+You can create your own clients that uses Urbit to store data and interact with
44+other Urbit ships without writing any Hoon code thanks to Urbit's HTTP APIs.
45+This could be a chat client, a writing app, a game, or anything else that can
46+communicate over HTTP.
47+
48+To get started quickly with the language of your choice, see the list
49+libraries that provide HTTP interfaces to Urbit [here](https://github.com/urbit/awesome-urbit#http-apis-airlock).
50+
51+To learn more about how to work with Urbit's HTTP interface, follow [this
52+guide](@/docs/arvo/eyre/using-eyre.md).
53+
54+Alternatively, command-line interface (CLI) applications can be built using a
55+library called `shoe`, which you can learn more about
56+[here](@/docs/hoon/guides/cli-tutorial.md). This does require Hoon knowledge.
57+
58+### Develop Agents {#agents}
59+
60+Gall agents can be best thought of as individual services with a
61+statically-typed interface and built-in database. They're written in
62+[Hoon](@/docs/hoon/overview.md) and all conform to a specific
63+[interface](@/docs/arvo/gall/gall-api.md) that's defined by the kernel vane
64+called [Gall](@/docs/arvo/gall/gall.md).
65+
66+Applications built on Urbit utilize a collection of different agents, each of
67+which handle specific functionality. The [Landscape
68+architecture](@/docs/landscape/overview.md) is a good reference implementation
69+to see how this pattern works in practice.
70+
71+If you want to learn how to build gall agents, your best bet is to first [learn
72+the Hoon programming language](@/docs/hoon/hoon-school/_index.md), and then follow that
73+up with the [Gall guide](@/docs/arvo/gall/tutorial.md).
74+
75+### Contribute to Urbit Core {#core}
76+
77+Working on the core means improving the Urbit project itself, working with the
78+existing community of Urbit developers. The kernel is much more stable, but
79+generally more challenging from an engineering standpoint.
80+
81+Just arrived and unsure what to work on? An ideal way to get started is by
82+experimenting with the system, talking to other developers, and reading (or
83+[contributing to](https://github.com/urbit/docs)) the [documentation](/docs/).
84+
85+Prefer learning with an instructor? Our community runs an online course that
86+covers the basics of Urbit development called
87+[Hooniversity](https://hooniversity.org/). If course-based learning works well
88+for you, we recommend you sign up.
89+
90+The Urbit developer community congregates around [the urbit-dev mailing
91+list](https://groups.google.com/a/urbit.org/forum/#!forum/dev), the
92+`~bitbet-bolbel/urbit-community` group on Landscape, and [Urbit’s GitHub
93+repository](https://github.com/urbit/urbit). It’s a good idea to sign up, see
94+what people are talking about, and introduce yourself.
95+
96+Once you’re comfortable working with Urbit, check out the [project’s issues on
97+GitHub](https://github.com/urbit/urbit/issues) or some of our [contribution
98+bounties](https://grants.urbit.org/).
99+
100+If you’re looking for some guidance, need help, or would prefer direct
101+communication for your ideas, you can also always reach out to us directly at
102+[support@urbit.org](mailto:support@urbit.org).
103+
104+## Next Steps
105+
106+From here, you'll probably want to learn more about:
107+
108+- How to set up a [development environment](@/docs/development/environment.md)
109+- Our [grants program](@/docs/development/grants.md), where you can earn address
110+ space for helping the project grow
111+- The different [project
112+ repositories](@/docs/development/project-repositories.md), both official and
113+ community-maintained
114+- Our development [Precepts](@/docs/development/precepts.md), which outline the
115+ philosophies that drive Urbit development
10116
11−- [Applications using Urbit](#api), which use Urbit as the back-end to store data and communicate with others
12−- [Urbit Applications](#application), which are written in [Hoon](/docs/hoon/), and run as part of Urbit
13−- [Urbit Core](#core), which involves contributing to Urbit's operating system ([Arvo](https://github.com/urbit/urbit/tree/master/pkg/arvo)) or runtime ([Vere](https://github.com/urbit/urbit/tree/master/pkg/urbit))
14117
15−This guide will start by getting you set up to run an Urbit ship, and then tell you everything you need to know to do either.
16−
17−### Setting up your environment
18−
19−We assume you’ve gotten a basic introduction to Urbit. If you haven’t, read the [Understanding Urbit](@/understanding-urbit/_index.md) series.
20−
21−Once you’re ready, you can get started on the network right away and take some first steps, without acquiring an identity, by [creating a comet](@/using/install.md#comet).
22−
23−When developing, however, we recommend [booting a development ship](#creating-a-development-ship) and working locally -- you may need to make changes that could, in the wrong hands, destroy the ship’s environment, and it’s best to do so in a safe, separate place.
24−
25−## Applications using Urbit {#api}
26−
27−Urbit ships with its own set of apps written in its own language, Hoon. However it is also meant to integrate with applications written in other languages via an API. The clearest example of an application using Urbit is Landscape, the default client. Although it does currently ship with Urbit, its front-end is a separate piece of software that uses Urbit's HTTP APIs to interact with an Urbit ship. You can create your own application that uses Urbit to store data and interact with other Urbit ships without writing any Hoon code thanks to Urbit's HTTP APIs. This could be a chat client, a writing app, a game, or anything else that can communicate over HTTP.
28−
29−To get started quickly with the language of your choice, see the following libraries that provide HTTP interfaces to Urbit:
30−
31− - [Python](https://github.com/baudtack/urlock-py) (Stable)
32− - [Swift](https://github.com/dclelland/UrsusAirlock) (Under development)
33− - [Haskell](https://github.com/bsima/urbit-airlock) (Under active development)
34− - [JavaScript](https://www.npmjs.com/package/urbit) (Under active development)
35− - Go (Pending release)
36−
37−[View details about using the API or creating your own implementation here.](@/docs/development/integrating-api.md)
38−
39−## Urbit Applications {#application}
40−
41−Urbit applications are still young, but can be fun to experiment with.
42−
43−When creating user applications on Urbit, you aren’t tied to any particular user interface. They can work without providing a response to the user, or by printing to the Dojo, or with an interface in Landscape, which uses [Eyre](@/docs/arvo/eyre/eyre.md) (the Arvo vane that serves HTTP to serve a React-based interface to the application through a web browser).
44−
45−When writing applications, you will often make use of [Gall](@/docs/hoon/hoon-school/gall.md), the Arvo vane that manages user applications.
46−
47−If you want to see examples of Urbit applications with common functionality requirements, you can see our [examples](https://github.com/urbit/examples) repository. If you want to get started building applications with a Landscape interface, check out our [create-landscape-app](https://github.com/urbit/create-landscape-app) repository.
48−
49−## Urbit Core {#core}
50−
51−Working on the core means improving the Urbit project itself, working with the existing community of Urbit developers. The kernel is much more stable, but generally more challenging from an engineering standpoint.
52−
53−Just arrived and unsure what to work on? An ideal way to get started is by experimenting with the system, talking to other developers, and reading (or [contributing to](https://github.com/urbit/docs)) the [documentation](/docs/).
54−
55−Prefer learning with an instructor? Our community runs an online course that covers the basics of Urbit development called [Hooniversity](https://hooniversity.org/). If course-based learning works well for you, we recommend you sign up.
56−
57−The Urbit developer community congregates around [the urbit-dev mailing list](https://groups.google.com/a/urbit.org/forum/#!forum/dev), the `~bitbet-bolbel/urbit-community` group on Landscape, and [Urbit’s GitHub repository](https://github.com/urbit/urbit). It’s a good idea to sign up, see what people are talking about, and introduce yourself.
58−
59−Once you’re comfortable working with Urbit, check out the [project’s issues on GitHub](https://github.com/urbit/urbit/issues) or some of our [contribution bounties](https://grants.urbit.org/).
60−
61−If you’re looking for some guidance, need help, or would prefer direct communication for your ideas, you can also always reach out to us directly at [support@urbit.org](mailto:support@urbit.org).
62−
63−## Creating a development ship {#creating-a-development-ship}
64−
65−To do work with Hoon and with the system, we recommended using a "fake" ship -- one not connected to the network.
66−
67−Because such a ship has no presence on the network, you don't need an Azimuth identity for its purposes. You just need to have [installed our software](/using/install).
68−
69−To create a fake ship named `~zod`, run the command below. You can replace `zod` with any valid Urbit ship-name.
70−
71−```
72−./urbit -F zod
73−```
74−
75−Now you should see a block of boot messages, starting with the Urbit version number. Welcome!
76−
77−
78−## How else can I contribute? {#how}
79−
80−The Urbit project is a global community of developers, users, and fans. If you’re interested in getting involved, there’s space for you; you don’t have to be a developer to be a part of the project.
81−
82−### Running stars and galaxies
83−
84−There are two ways to participate in the Arvo network: as a user running a planet and as an infrastructure provider running a galaxy or a star.
85−
86−For planets, Urbit is a peer-to-peer network where users can interact with each other via Landscape, or using custom applications that anyone can write.
87−
88−Running a planet helps build Urbit’s community, surfaces bugs, and helps core developers improve Urbit under realistic conditions.
89−
90−Stars and galaxies, however, have additional responsibilities and play a role in peer discovery as well as star and planet distribution. You can think of stars and galaxies as similar to the DNS system in the modern Internet. Most users don’t know it exists, but without it, the web wouldn’t work at all.
91−
92−Running a reliable galaxy or star, and spawning stars and planets from them, are excellent ways to help bootstrap the Urbit network.
93−
94−If you’re interested in running a galaxy or star, you’ll be reliably providing peer discovery for your children just by running your node – and we’re doing our best to make this both easy and profitable. If you’re interested in this, see [Star and Galaxy Operations](@/using/os/stars-and-galaxies.md).
95−
96−If you’re interested in distributing planets, read on.
97−
98−### Distribute points
99−
100−Want to get your friends and family into Urbit? Distribute planets using Bridge with a feature called **delegated sending**.
101−
102−Here’s how it works: any star can grant a number of invites to any of its child planets. Those planets can then send one-time-use invite codes via email to anyone of their choosing.
103−
104−For instructions on how to grant and send invites, check out [Using Bridge](@/using/id/using-bridge.md).
development/environment.mdnew file+62
@@ -0,0 +1,62 @@
1++++
2+title = "Environment Setup"
3+description = "How to set up an environment for Urbit development."
4+weight = 10
5+template = "doc.html"
6++++
7+
8+This guide covers best practices for preparing your environment to develop
9+within the Urbit ecosystem.
10+
11+## Creating a development ship
12+
13+To do work with Hoon, we recommended using a "fake" ship -- one that's not
14+connected to the network.
15+
16+Because such a ship has no presence on the network, you don't need an Azimuth
17+identity. You just need to have [installed the Urbit binary](/using/install).
18+
19+To create a fake ship named `~zod`, run the command below. You can replace `zod`
20+with any valid Urbit ship-name.
21+
22+```
23+./urbit -F zod
24+```
25+
26+This should take a couple of minutes, during which you should see a block of boot
27+messages, starting with the Urbit version number.
28+
29+
30+## Hoon support in text editors
31+
32+A variety of plugins have been built to provide support for the Hoon language in
33+different text editors:
34+
35+#### Atom
36+Atom is free and open-source and runs on all major operating systems. It is
37+available [here](https://atom.io/). A package for Hoon support is maintained by
38+Tlon and may be obtained using the package manager within the editor by
39+searching for `Hoon`.
40+
41+#### Sublime Text
42+Sublime Text is closed-source, but may be downloaded for free and there is no
43+enforced time limit for evaluation. It runs on all major operating systems. It
44+is available [here](https://www.sublimetext.com/).
45+
46+#### Visual Studio Code
47+Visual Studio Code is free and open-source and runs on all major operating
48+systems. It is available [here](https://code.visualstudio.com/). Hoon support
49+may be acquired in the Extensions menu within the editor by searching for
50+`Hoon`.
51+
52+#### Emacs
53+
54+Emacs is free and open-source and runs on all major operating systems. It is
55+available [here](https://www.gnu.org/software/emacs/). Hoon support is available
56+with [hoon-mode.el](https://github.com/urbit/hoon-mode.el).
57+
58+#### Vim
59+
60+Vim is free and open-source and runs on all major operating systems. It is
61+available [here](https://www.vim.org/). Hoon support is available with
62+[hoon.vim](https://github.com/urbit/hoon.vim) and is maintained by Tlon.
development/grants.mdnew file+87
@@ -0,0 +1,87 @@
1++++
2+title = "Grants Program"
3+weight = 20
4+template = "doc.html"
5+aliases = ["/docs/using/creating-a-development-ship/", "/docs/getting-started/contributing"]
6++++
7+
8+## Grants Program {#grants}
9+
10+The [Urbit Foundation](https://urbit.org/blog/first-steps-towards-urbit-org/)
11+runs a [Grants program](https://grants.urbit.org), where you can earn address
12+space ([stars](@/docs/glossary/star.md)) in exchange for contributing to the
13+project.
14+
15+Grants come in four different flavors at present: [bounties](#bounties),
16+[proposals](#proposals), [scholarships](#scholarships) and [gifts](#gifts).
17+
18+If you're curious about grants, join the conversation in Landscape at
19+`~wolref-podlex/foundation` or book some time to [talk with
20+us](https://calendly.com/wolref/30min).
21+
22+### Bounties {#bounties}
23+
24+[Bounties](https://grants.urbit.org/bounties) are specific, tightly-scoped
25+pieces of work that we at the Urbit Foundation think are of high value to the
26+ecosystem at large. They're frequently development-focused, but also often
27+relate to marketing, community-building or technical writing.
28+
29+Bounties are usually competitive&mdash;worker requests should provide plenty of
30+information about why the requester is right candidate for the job.
31+
32+### Proposals {#proposals}
33+
34+Where Bounties are put forward by the Foundation,
35+[Proposals](https://grants.urbit.org/proposals) come from the community. These
36+are things that our community thinks Urbit needs, and span a wide range of
37+topics: we've got [books being
38+written](https://grants.urbit.org/proposals/1590647060-a-book-about-urbit),
39+[videos being
40+produced](https://grants.urbit.org/proposals/1350087489-urbit-explainer-video),
41+help with [production of
42+events](https://grants.urbit.org/proposals/1751024973-urbit-event-series),
43+[marketing](https://grants.urbit.org/proposals/1395578140-smol-future-sustained-knowledge-sharing-and-marketing)
44+and
45+[documentation](https://grants.urbit.org/proposals/1888977136-graph-store-documenation-guide),
46+and
47+[ambitious](https://grants.urbit.org/proposals/21131866-webrtc-gall-agent-and-external-app)
48+[development](https://grants.urbit.org/proposals/1760204192-urbit-lfs)
49+[projects](https://grants.urbit.org/proposals/337545546-urbian-a-customized-linux-distribution-for-urbit-appliances)
50+all happening. If you've got skills and time to put into Urbit, we'll put you to
51+work.
52+
53+Proposals are more likely to be approved if their relevance to the project is
54+made clear, their scope is clearly defined, the proposer is qualified, and it's
55+obvious that a lot of thought has gone into the idea.
56+
57+If you've got an idea and want some help turning it into a proposal, book some
58+time with us [here](https://calendly.com/wolref/30min).
59+
60+### Scholarships {#scholarships}
61+
62+Scholarships are the newest addition to the grants program that pairs
63+contributors with core Urbit developers to tackle infrastructure projects. These
64+generally take the form of contributions to
65+[Arvo](@/docs/system-overview/arvo.md) or
66+[Vere](@/docs/system-overview/vere.md).
67+
68+Tackling a scholarship requires an advanced understanding of Urbit. It's
69+expected that you've got a demonstrated command of the Hoon language or other
70+part of Urbit through existing contributions on our repositories or successfully
71+completed grants.
72+
73+New scholarships are posted within the Foundation group in Landscape
74+(`~wolref-podlex/foundation`), and you can sign up for the waitlist using [this
75+form](https://airtable.com/shr6Xmo55h8dZ0O46).
76+
77+### Gifts {#gifts}
78+
79+Not every contribution is made with a plan or according to a specification.
80+Sometimes people just fix issues, help newcomers, or promote the project because
81+they want to.
82+
83+Roughly every six months we [give
84+out](https://urbit.org/blog/urbit-grants-and-mid-2019-gifts/) a [bunch of
85+address space](https://urbit.org/blog/gifts-q3-2020/) to those that have helped
86+the project without asking for anything in return, just because we want to. It
87+just feels good, man.
development/integrating-api.mddeleted−224
@@ -1,224 +0,0 @@
1−+++
2−title = "Using the HTTP API"
3−description = "How to use Urbit's API."
4−weight = 20
5−template = "doc.html"
6−+++
7−
8−This guide is aimed at developers who have a working knowledge of HTTP grammar (`PUT`, `GET`), and should not require any special knowledge of Urbit's internals. To learn more about a specific application within Urbit, please search for that with the docs once you have finished this guide.
9−
10−## Authentication
11−
12−The first step in creating an application *on* Urbit (to be distinguished from an Urbit application) is to authenticate with the desired ship. This can be a planet, comet, or any other Urbit ship. For the purposes of this example, we will be running a "fakezod" on port 8080. Run this code, substituting the appropriate path to your Urbit binary:
13−
14−```bash
15−/path/to/urbit -p 8080 -F zod
16−```
17−
18−(for the unfamiliar, this will create a folder named "zod" in your working directory, from which the ship will run. Use `/path/to/urbit -p 8080 zod` in the future)
19−
20−You can run `+code` in the dojo to get the key, but a fakezod's key is always `lidlut-tabwed-pillex-ridrup`. This is our password, our API token that we will use.
21−
22−Run this code in your bash terminal (requires cURL):
23−
24−```bash
25−curl -i localhost:8080/~/login -X POST -d "password=lidlut-tabwed-pillex-ridrup"
26−```
27−Let's explain what this does:
28−
29− - `-i` displays the headers, so that you can see the cookie that gets sent
30− - `localhost:8080/~/login` is the URL to which you are POSTing. You will note this is also the URL you visit when you log into Landscape.
31− - `-X POST` specifies that you are POSTing data, not GETting.
32− - `-d "password=lidlut-tabwed-pillex-ridrup"` specifies the key for your Urbit that we retrieved above. It is sent as form data, as if it were sent from an HTML form input field (which it is in Landscape)
33−
34−You should see the following:
35−
36−```bash
37−HTTP/1.1 200 ok
38−Date: Sun, 01 Jan 2020 00:00:00 GMT
39−Connection: keep-alive
40−Server: urbit/vere-0.10.8
41−set-cookie: urbauth-~zod=0v3.fvaqc.nnjda.vude1.vb5l6.kmjmg; Path=/; Max-Age=604800
42−transfer-encoding: chunked
43−```
44−
45−The `Date` and `set-cookie` will be slightly different of course.
46−
47−Take a look at the `set-cookie` line. This is now your session authentication, and will need to be sent with any future requests. It consists of three parts:
48−
49− - `urbauth` is a prefix that Eyre uses to check for presence of authentication
50− - `~zod` is the name of the ship you are logging in as
51− - `0v3.fvaqc.nnjda.vude1.vb5l6.kmjmg` is the actual authentication token.
52−
53−At present there is no way to separate these parts — you must pass a cookie *as* a cookie. This string must be in the `Cookie` header. The `set-cookie` header is only used for this request upon response. It is what browsers expect when receiving a cookie.
54−
55−## Interacting with Urbit
56−
57−Once authenticated, you will perform all your operations on a channel. You may open as many channels as needed using the same authentication token, but this will increase complexity and memory usage on your Urbit ship.
58−
59−Interacting with Urbit comprises two parts:
60−
61−1. Sending information via PUT requests, which receive HTTP status code `204` (no content) upon success. We will not receive updated information (as in a POST request).
62−2. Receiving data on channels, which must first be subscribed to via an initial request. These come in the form of SSEs ([Server-Sent Events](https://www.w3.org/TR/eventsource/))
63−
64−These can be used independently, i.e. you may choose to only send information or only receive information from your Urbit, based on your application. Both can take place on the same channel.
65−
66−### Creating a Channel
67−
68−For this example, we will use the following channel:
69−
70−```
71−http://localhost:8080/~/channel/1601844290-ae45b
72−```
73−
74−Let's examine the parts. A channel is simply a URL in this pattern: `{url}/~/channel/{uid}` where `{uid}` is a string of your choosing. Most libraries default to the current unix time plus six hexadecimal characters. Your program should determine a channel for its current session and store that in its state.
75−
76−The channel does not yet exist in Urbit, however. To subscribe to events on this URL, you must first make a request (PUT) to Urbit on this URL. The simplest way to do this is to `hi` ourselves, as if we had entered `|hi our` in the dojo. A `hi` is analogous to a ping, and does not manipulate state. Let's learn how to make requests using this as an example.
77−
78−### Making Requests
79−
80−All requests will take the form of sending a message. Messages can take different forms, such as `subscribe`s, `ack`s, and `poke`s. These are called actions and there are more than these, but these will cover most basic use cases. You can think of them as a somewhat more sophisticated HTTP grammar. A message always requires an `id` and an `action`. Other fields depend on the specific action.
81−
82−Let's look at the structure of a message by examining the most basic `hi` we will send.
83−
84−```js
85−{
86− 'id': 1, // Required. A sequential ID. Keep track of which messages you have sent.
87− 'action': 'poke', // Required. The action to take. poke is the most basic way of sending data, like HTTP POST
88− 'ship': 'zod', // Required by poke. The ship on which to perform the poke. You can only poke foreign ships with JSON, but this is the authenticated ship.
89− 'app': 'hood', // Required by poke. The Urbit app to which to send the data.
90− 'mark': 'helm-hi', // Required by poke. The "mark," or type, of data being sent.
91− 'json': 'Opening airlock' // Required by poke. The actual data being sent.
92−}
93−```
94−
95−Let's open our channel by sending the following request using cURL (**remember to change the cookie**):
96−
97−```bash
98−curl --header "Content-Type: application/json" \
99− --cookie "urbauth-~zod=0v3.fvaqc.nnjda.vude1.vb5l6.kmjmg" \
100− --request PUT \
101− --data '[{"id":1,"action":"poke","ship":"zod","app":"hood","mark":"helm-hi","json":"Opening airlock"}]' \
102− http://localhost:8080/~/channel/1601844290-ae45b
103−```
104−
105−If you switch to your fakezod's dojo, you should see `< ~zod: Opening airlock`.
106−
107−Note that in the JSON that we sent via `--data`, the payload is wrapped in `[]`. This is because we can send multiple messages in a single payload, and Eyre expects a list of items, even if we are only sending one.
108−
109−You will always receive a `204` status code if the `PUT` request successfully reached Urbit, authentication succeeded, and the payload was valid. This is merely an HTTP status code, however. If the request failed within Urbit itself, however, you will receive a "nack" event that you will have to process separately.
110−
111−Let's look at how to receive events from Urbit.
112−
113−### Subscribing to Events
114−
115−Now that Urbit has opened an Eyre channel at our URL, we can watch for events on that URL by sending a `subscribe` message. Let's look at the anatomy of a `susbcribe`:
116−
117−```js
118−{
119− 'id': 2, // Required. This is the next message we are sending, so we give it the next ID.
120− 'action': 'subscribe', // Required.
121− 'ship': 'zod', // Required by subscribe.
122− 'app': 'chat-view', // Required by subscribe. In this case, we want to watch events that occur in the chat-view app, which is responsible for handling incoming chats.
123− 'path': '/primary' // Required by subscribe. All apps have different path structures. In the case of chat-view, this is where we see all incoming chats.
124−}
125−```
126−
127−This is all we need to send Urbit to say "On this URL through which I am sending information, send me SSEs whenever something occurs on this app at this path."
128−
129−You should be able to send this information if you were able to send the above cURL example. However, we now need to be able to listen to the SSEs. The `EventSource` object is available for JavaScript in the browser context, as this is why SSEs were invented, but there should be a library for it in your chosen language. Take a look at a Browser JavaScript example:
130−
131−```js
132−const eventSource = new EventSource('http://localhost:8080/~/channel/1601844290-ae45b', {
133− withCredentials: true // Required, sends your cookie
134−});
135−
136−eventSource.addEventListener('message', function (event) {
137− ack(Number(event.lastEventId)); // See section below
138− const payload = JSON.parse(event.data); // Data is sent in JSON format
139− payload.id === event.lastEventId; // The SSE spec includes event IDs. This information is duplicated in the payload.
140− const data = payload.json; // Beyond this, the actual data will vary between apps
141−});
142−
143−eventSource.addEventListener('error', function (event) {
144− handleError(event);
145−});
146−
147−```
148−
149−### Handling Received Events
150−
151−Once you have received an event, it is expected that you will "ack" or "acknowledge" that you have received them. To do so, simply send a message in the following format:
152−
153−```js
154−{
155− 'id': 3, // Required. Picking up where we left off
156− 'action': 'ack', // Required.
157− 'event-id': 15, // Required by ack. Whichever SSE of which you are acknowledging receipt
158−}
159−```
160−
161−### Unsubscribing from Events
162−
163−You may want to stop receiving events from a particular app path, but you don't want to close the channel altogether yet. Let's look at how to do that. Take a look at the example for subscribing. We sent that message with `id: 2`. We will use that ID to cancel the relevant subscription:
164−
165−```javascript
166−{
167− 'id': 4, // Required. We always increment the ID as we send messages.
168− 'action': 'unsubscribe', // Required.
169− 'subscription': 2 // Required by unsubscribe. This corresponds to the id of a subscribe message sent earlier.
170−}
171−```
172−
173−### Deleting a Channel
174−
175−You should clean up your channel when able. To do so, simply send a `delete` message and Eyre will handle the rest so your program can safely exit.
176−
177−```javascript
178−{
179− 'id': 5, // Required.
180− 'action': 'delete' // Required.
181−}
182−```
183−
184−## Other Operations
185−
186−There are other operations which require authentication but do not require the use of a channel. Some operations are app-specific and will not be enumerated here, but there are two operations that exist across Urbit: `scry` and `spider`.
187−
188−### Scrying
189−
190−Scrying lets you see what an app has exposed at a particular path. It does not manipulate state.
191−
192−It takes the form `{url}/~/scry/{app}{path}.{mark}`
193−
194− Let's get the base hash of our fakezod in the same way that Landscape does it.
195−
196−```bash
197−curl --header "Content-Type: application/json" \
198− --cookie "urbauth-~zod=0v3.fvaqc.nnjda.vude1.vb5l6.kmjmg" \
199− --request GET \
200− http://localhost:8080/~/scry/file-server/clay/base/hash.json
201−```
202−
203−Note the use of a `GET` request.
204−
205−In this example we're scrying the `file-server` app at the path `/clay/base/hash` and using the `json` mark, which is most common. We receive `"0"` which is correct because we are at the top level of the hierarchy using a fake ship.
206−
207−Scry will fail with a 500 or return a 404 if no data is found.
208−
209−### Running Threads with Spider
210−
211−Running threads is an exception to the rule that we outlined in the section on channels. It uses a `POST` request and both manipulates state and receives information back. It also exposes the ability to send a sequence of commands, i.e. a "thread," hence the name.
212−
213−It takes the form `{url}/spider/{inputMark}/{threadname}/{outputmark}.json`
214−
215−This should be considered an advanced technique, but the basic structure of a request can be seen here:
216−
217−```bash
218−curl --header "Content-Type: application/json" \
219− --cookie "urbauth-~zod=0v3.fvaqc.nnjda.vude1.vb5l6.kmjmg" \
220− --request POST \
221− --data '[{"foo": "bar"}]' \
222− http://localhost:8080/spider/graph-view-action/graph-create/json.json
223−
224−```
development/precepts.md+5−1
@@ -1,9 +1,13 @@
11+++
22title = "Precepts"
3−weight = 60
3+weight = 40
44template = "doc.html"
55+++
66
7+<br>
8+
9+<img class="ba" src="https://media.urbit.org/site/posts/essays/pre-01.jpg">
10+
711Urbit is a principled approach to system design and programming, but it's often not obvious what those principles are. We have many specific terms for the different parts of the project: Arvo is the OS, Hoon is the language, Tlon is the company, Azimuth is the identity system, Ames is the network. But the word most associated with the project is "Urbit", and it's not clear what technically it refers to. It's only a small stretch to say that "Urbit" *is* this set of principles, and that if anybody follows these principles strictly they will create a system that is isomorphic to the Urbit.
812
913Some of these are commonly held among many software projects, and some are not. Some are only debatably better than the alternatives, but Urbit exclusively chooses them.
development/project-repositories.mdnew file+49
@@ -0,0 +1,49 @@
1++++
2+title = "Project Repositories"
3+weight = 30
4+template = "doc.html"
5++++
6+
7+Here's a breakdown of the various repositories that comprise the project. All of
8+our code is hosted on GitHub, so you can of course peruse it there at
9+[https://github.com/urbit](https://github.com/urbit).
10+
11+### Urbit
12+
13+Urbit OS, the Landscape interface and Vere are all contained in one monolithic
14+repository that can be found [here](https://github.com/urbit/urbit). The repo is
15+large, so here's some links to its various high-level components
16+
17+- [Arvo](https://github.com/urbit/urbit/tree/master/pkg/arvo): the part of the urbit pepo that comprises Arvo, the Urbit OS.
18+- [Vere](https://github.com/urbit/urbit/tree/master/pkg/urbit): the part of the
19+ urbit repo that comprises the C and Haskell interpreters.
20+- [Landscape
21+ interface](https://github.com/urbit/urbit/tree/master/pkg/interface): the part
22+ of the urbit repo that contains the interface code for Landscape.
23+ - [Issue Tracker](https://github.com/urbit/landscape/issues): the Landscape issue
24+ tracker is a separate repository.
25+
26+### Urbit ID
27+
28+- [azimuth](https://github.com/urbit/azimuth): the public-key infrastructure
29+ (PKI) that comprises Urbit ID, live on the Etheereum blockchain.
30+- [bridge](https://github.com/urbit/bridge): an application for interacting with
31+ Azimuth that can be accessed at [bridge.urbit.org](https://bridge.urbit.org).
32+- [urbit-key-generation](https://github.com/urbit/urbit-key-generation): a javascript library for key derivation and HD
33+ wallet generation functions.
34+- [sigil-js](https://github.com/urbit/sigil-js): a javascript library for
35+ generating sigils.
36+
37+### Content
38+
39+- [urbit.org](https://github.com/urbit/urbit.org): the source for the urbit.org
40+ website.
41+- [docs](https://github.com/urbit/docs): the source for the documentation that
42+ you're currently reading.
43+ - *Note:* the documentation is loaded into the
44+ [urbit.org](https://github.com/urbit/urbit.org) repo as a submodule.
45+
46+### Community
47+
48+The best way to keep track of the various community projects is via our
49+[**awesome-urbit**](https://github.com/urbit/awesome-urbit) repository.