on master help sign in
flow, azimuth overview, layer 2 edits
commit4be1e144f55b11cb8a47a42c0bb7b1c752a2758a authordrbeefsupreme <drbeefsupreme@discordja.net> dateWed 3 Nov 2021, 16:30 (5 years ago) parentf48ac72
4 files changed+62−49
content/docs/azimuth/azimuth.md+10−10 content/docs/azimuth/flow.md+33−24 content/docs/azimuth/l2/layer2.md+13−11 content/docs/azimuth/life-and-rift.md+6−4
content/docs/azimuth/azimuth.md+10−10
@@ -18,7 +18,7 @@ look at the source and play around, or see [Getting Started](/getting-started/).
1818## Arvo vs. Azimuth
1919
2020Urbit is a project, not a single computer system. It has multiple components:
21−Arvo, the operating system; and Azimuth, the identity system. Let's compare
21+Arvo, the operating system, and Azimuth, the identity system. Let's compare
2222them.
2323
2424**Arvo** is an operating system that provides the software for a personal
@@ -81,13 +81,13 @@ Azimuth consists of the following smart contracts:
8181 Sending](https://etherscan.io/address/0xf6b461fe1ad4bd2ce25b23fe0aff2ac19b3dfa76):
8282 enables network-effect like distributing of planets.
8383
84− Walkthroughs of some of the smart contracts are linked to [below](#other).
84+Walkthroughs of some of the smart contracts are linked to [below](#other).
8585
8686## Naive rollups
8787
8888In 2021, Tlon introduced a new system to Azimuth intended to reduce gas costs
8989for working with Urbit ID and friction associated with using cryptocurrency in
90−general called **naive rollups**, often referred to as **layer 2**. This system
90+general called **naive rollups**, often referred to as **layer 2** or L2. This system
9191allows batches of Azimuth transactions to be submitted together as a single
9292transaction using an Urbit node known as a "roller". The PKI state transitions
9393resulting from these transactions are computed locally by your urbit rather than
@@ -100,9 +100,8 @@ blockchains. However, anybody can run a roller, and even using your own ship as
100100a roller to submit single transactions results in significant savings.
101101
102102A casual overview of the naive rollups system can be found on the
103−[blog](/blog/rollups). Developers
104−are encouraged to read our Layer 2 documentation, starting with the [Layer 2
105−Overview](/docs/azimuth/l2/layer2).
103+[blog](/blog/rollups). Developers are encouraged to read our Layer 2
104+documentation, starting with the [Layer 2 Overview](/docs/azimuth/l2/layer2).
106105
107106## Other resources {#other}
108107
@@ -114,7 +113,7 @@ referred to as a "master ticket".
114113### [Data Flow](/docs/azimuth/flow)
115114
116115Diagrams and explanations of how data flows between Bridge and the various
117−components inside Urbit involved with layer 2.
116+components inside Urbit involved with Azimuth and L2.
118117
119118### [Azimuth.eth](/docs/azimuth/azimuth-eth)
120119
@@ -128,11 +127,12 @@ for `azimuth.eth`. This includes an overview of all function calls available.
128127
129128### [Advanced Azimuth Tools](/docs/azimuth/advanced-azimuth-tools)
130129
131−Expert-level tooling for generating, signing, and sending layer 1 Azimuth-related
130+Expert-level tooling for generating, signing, and sending layer 1 Azimuth
132131transactions from within Urbit itself.
133132
134133### [Life and Rift](/docs/azimuth/azimuth)
135134
136−An explanation of how Azimuth indexes networking keys and breaches to keep track
137−of the most recent set of networking keys necessary to communicate with a ship.
135+An explanation of how Azimuth indexes networking keys revisions and breaches to
136+keep track of the most recent set of networking keys necessary to communicate
137+with a ship.
138138
content/docs/azimuth/flow.md+33−24
@@ -8,28 +8,27 @@ This document summarizes the various components involved with Azimuth and
88how they communicate with each other. This also constitutes an explanation for
99how Urbit implements the data flow of naive rollups.
1010
11−The following diagram illustrates the high-level structure of Azimuth.
12−
13−[![High level overview](https://media.urbit.org/docs/layer2/l2-high.png)](https://media.urbit.org/docs/layer2/l2-high.png)
14−
1511## Bridge
1612
17−The primary way in which users interact with Azimuth is via Bridge. Bridge is
18−responsible for collecting transactions from users, signing them, and forwarding
19−them to a roller via an HTTP API.
13+The primary way in which users interact with Azimuth is via
14+[Bridge](https://bridge.urbit.org). Bridge is responsible for collecting
15+transactions from users, signing them, and forwarding them to a roller via an
16+HTTP API.
2017
2118## Azimuth
2219
2320Azimuth was originally defined as a set of smart contracts on Ethereum that
24−defines the state and business logic of the PKI for layer 1. With the advent of
21+defines the [state](/docs/azimuth/azimuth-eth) and [business
22+logic](/docs/azimuth/ecliptic) of the PKI for layer 1. With the introduction of
2523naive rollups, this has also come to include the set of components used for
2624dealing with the PKI within Urbit, as now the complete PKI state is stored
27−offchain. The following sections outline what each component is responsible for
28−and how it communicates with the others.
25+offchain (though this state is derived entirely from on-chain data). The
26+following sections outline what each component is responsible for and how it
27+communicates with the others.
2928
3029The Gall agents involved with Azimuth are summarized as follows:
3130 - [`%azimuth`](#azimuth) - obtains and holds PKI state.
32− - [`%azimuth-rpc`](#azimuth-rpc) - JSON RPC-API for `%azimuth`
31+ - [`%azimuth-rpc`](#azimuth-rpc) - JSON RPC-API for `%azimuth`.
3332 - [`%eth-watcher`](#eth-watcher) - Ethereum event log collector.
3433 - [`%roller`](#roller) - submits batches of L2 transactions to Ethereum.
3534 - [`%roller-rpc`](#roller-rpc) - JSON RPC-API for `%roller`.
@@ -90,7 +89,7 @@ Scries can be inferred from the `+on-peek` arm:
9089`%eth-watcher`, located at `/app/eth-watcher.hoon`, is responsible for listening
9190to an Ethereum node and collecting event logs from it. It is general-purpose and
9291not particular to Azimuth. It sends collected transactions to `+on-agent` in
93−`%azimuth`, which then obtains the resulting PKI transitions by passing them through
92+`%azimuth`, which then obtains the resulting PKI state transitions by passing them to
9493[`naive.hoon`](#naive).
9594
9695[![Eth-watcher](https://media.urbit.org/docs/layer2/roller-agents.png)](https://media.urbit.org/docs/layer2/roller-agents.png)
@@ -105,6 +104,11 @@ that are awaiting confirmation, history of transactions sent organized by
105104Ethereum address, and when the next batch of transactions will be sent. See also
106105[Rollers](/docs/azimuth/l2/roller) for more information on the roller.
107106
107+The following diagram illustrates how the roller interacts with Bridge and
108+Ethereum at a high level.
109+
110+[![High level overview](https://media.urbit.org/docs/layer2/l2-high.png)](https://media.urbit.org/docs/layer2/l2-high.png)
111+
108112The relationship between the roller and other agents is outlined in the
109113following diagram.
110114
@@ -135,29 +139,30 @@ arm:
135139```
136140
137141This app is not responsible for communicating with Bridge via HTTP. Instead, that is
138−handled by `roller-rpc.hoon`. The scries are also communicated to Bridge via
139−`roller-rpc.hoon`.
142+handled by `%roller-rpc`. The scries are also communicated to Bridge via
143+`%roller-rpc`.
140144
141145#### `%roller-rpc`
142146
143147`%roller-rpc`, stored at `/app/roller-rpc.hoon`, is a very simple Gall app responsible for receiving HTTP RPC-API
144148calls, typically sent from other Urbit ID users via Bridge. It then translates
145149these API calls from JSON to a format understood by `%roller` and
146−forwards them. This app
150+forwards them to `%roller`. This app
147151does not keep any state - its only purpose is to act as an intermediary between
148152Bridge and `%roller`. See [here](/docs/azimuth/l2/layer2-api) for more
149153information on the JSON RPC-API.
150154
151155### `naive.hoon` {#naive}
152156
153−`/lib/naive.hoon` is a gate whose sample is a `verifier`, `chain-id=@ud`,
157+`/lib/naive.hoon` consists of a gate whose sample is a `verifier`, `chain-id=@ud`,
154158`state`, and `input`, which outputs a cell of `[effects state]`. This is the
155−transition function which updates the state of the PKI stored in `azimuth.hoon`
159+transition function which updates the state of the PKI stored in `%azimuth`
156160which handles state transitions caused by both layer 1 and layer 2 transactions.
157161A high-level overview of how `naive.hoon` functions can be found
158162[here](/docs/azimuth/l2/layer2#layer-2).
159163
160−A `verifier` is any gate of the form
164+A `verifier` is a gate whose sample is of the form `[dat=octs v=@ r=@ s=@]` and
165+which returns `(unit address)`:
161166
162167```hoon
163168+$ verifier $-([dat=octs v=@ r=@ s=@] (unit address))
@@ -169,11 +174,13 @@ tuple, according to the format for signed transactions outlined in the
169174[bytestring format](/docs/azimuth/l2/bytestring) documentation.
170175
171176`chain-id` is the ID used by the Ethereum blockchain, which is `1337`. See [bytestring
172−format](/docs/azimuth/l2/bytestring) for more information.
177+format](/docs/azimuth/l2/bytestring) for more information. This is used so that
178+e.g. transactions on the Ropsten test network cannot be replayed on the mainnet.
173179
174180`state` is the current state of the PKI. This is structured similarly to the
175181state held in [Azimuth.eth](/docs/azimuth/azimuth-eth), but will differ in
176−general since `state` takes into account layer 2 transactions as well.
182+general since `state` takes into account layer 2 transactions as well. See the
183+[Layer 2 Overview](/docs/azimuth/l2/layer2#state) for more on how PKI state is handled.
177184
178185```hoon
179186+$ state
@@ -209,15 +216,17 @@ general since `state` takes into account layer 2 transactions as well.
209216+$ dominion ?(%l1 %l2 %spawn)
210217+$ operators (jug address address)
211218```
219+
212220`points` should be self-explanatory if you are already familiar with the
213−structure of [Azimuth.eth](/docs/azimuth/azimuth-eth). The only new addition is `dominion`, which is a record of
221+structure of [Azimuth.eth](/docs/azimuth/azimuth-eth). The only new addition is
222+`dominion`, whose value says
214223whether a ship is on layer 1, layer 2, or layer 1 with a layer 2 spawn proxy.
215224See [Layer 2 actions](/docs/azimuth/l2/l2-actions) for an overview of how
216−`dominion` determines the actions available to a ship.
225+`dominion` determines the PKI actions available to a ship.
217226
218227`operators` already existed on layer 1 and are defined as a part of the [ERC-721
219228standard](https://eips.ethereum.org/EIPS/eip-721).
220229
221−`dns` is a list of DNS entries associated to galaxy IP addresses. At present, this
222−is always `~['urbit.org' 'urbit.org' 'urbit.org']`.
230+`dns` is a list of DNS entries by which galaxy IP addresses may be looked up. At
231+present, this is always `~['urbit.org' 'urbit.org' 'urbit.org']`.
223232
content/docs/azimuth/l2/layer2.md+13−11
@@ -365,27 +365,29 @@ guaranteed as the Azimuth Ethereum smart contracts.
365365
366366### Arvo is deterministic
367367
368−Crucial to the functionality of Ethereum smart contracts is they work the same
369−way every time since the Ethereum Virtual Machine is determinsistic. Similarly,
370−as the state of Arvo is evolved via [a single pure function](/docs/arvo/overview#an-operating-function), Urbit is
371−deterministic as well. This property makes it well-suited for cases where side
372−effects are unacceptable such as smart contracts, and thus `naive.hoon` is
373−worthy of the name "Hoon smart contract".
368+Crucial to the functionality of Ethereum smart contracts is that they work the
369+same way every time since the Ethereum Virtual Machine is deterministic.
370+Similarly, as the state of Arvo is evolved via [a single pure
371+function](/docs/arvo/overview#an-operating-function), Arvo is deterministic as
372+well. This property makes it well-suited for cases where side effects are
373+unacceptable such as smart contracts, and thus `naive.hoon` is worthy of the
374+name "Hoon smart contract".
374375
375376### Restricted standard library
376377
377378A standard security practice is to reduce the surface area of attack to be as
378379minimal as possible. One common source of exploits among all programming
379−languages are issues with the standard library of functions, and this often
380−leads to there being multiple implementations of standard library functions for
380+languages are issues with the standard library of functions, and this is one factor
381+that leads to the existence of multiple implementations of standard library functions for
381382a given programming language. For instance, `glibc` is the most widely used
382383standard library for the C programming language, but sheer size gives a large
383384surface area in which to find exploits. Thus, other standard libraries have been
384385written such as `musl` that are much smaller, and some argue to be more secure
385−at least partially due to fewer lines of code. Hoon is not yet popular to have
386+at least partially due to fewer lines of code. Hoon is not yet popular enough to have
386387multiple standard library implementations, but `naive.hoon` shucks the usual
387−standard library and so its subjects contains only the exact standard library
388−functions needed for it to function (`/lib/std.hoon`).
388+standard library and so its subject contains only the exact standard library
389+functions needed for it to function. This library is known as `tiny` and is
390+found at `/lib/tiny.hoon`.
389391
390392### Unit tests
391393
content/docs/azimuth/life-and-rift.md+6−4
@@ -13,10 +13,12 @@ and [Jael](/docs/arvo/jael/jael-api) to ensure that communication between
1313ships is always done with the most recent set of networking keys, and that
1414networking state is appropriately reset when a breach has occurred.
1515
16−Every ship begins with a `life` and `rift` of 0. For
17−galaxies, stars, and planets, these values are stored in the Azimuth PKI, while
18−for moons, these values are stored by their parent. Comets cannot change their
19−networking keys, nor can they breach, and so their `life` and `rift` are always 0.
16+Every ship begins with a `life` and `rift` of 0. For galaxies, stars, and
17+planets, these values are stored in the [Azimuth
18+PKI](/docs/azimuth/azimuth-eth#points) as `keyRevisionNumber` and
19+`continuityNumber`, while for moons, these values are stored by their parent.
20+Comets cannot change their networking keys, nor can they breach, and so their
21+`life` and `rift` are always 0.
2022
2123You can check your current `life` and `rift` number by running the `+keys our`
2224generator in dojo. You can inspect another ship's `life` and `rift` by running