on master help sign in
split smart contract pages
commit948e3ca77d15845cf5a9ab9bd3410d2dffe31756 authordrbeefsupreme <drbeefsupreme@discordja.net> dateThu 30 Sep 2021, 16:57 (5 years ago) parentaf8772c
4 files changed+358−212
content/docs/azimuth/azimuth-eth.md+147 content/docs/azimuth/azimuth.md+50−2 content/docs/azimuth/contract.md−210 content/docs/azimuth/ecliptic.md+161
content/docs/azimuth/azimuth-eth.mdnew file+147
@@ -0,0 +1,147 @@
1++++
2+title = "Azimuth.eth"
3+weight = 5
4+template = "doc.html"
5++++
6+
7+[Azimuth.eth](https://etherscan.io/address/azimuth.eth) is used for storing all
8+data related to Azimuth points and their ownership, and should be considered to
9+be the ledger for Azimuth. This contract is only a data store - it only contains
10+the bare minimum of business logic. See [Ecliptic.eth](/docs/azimuth/ecliptic)
11+for the contract containing the business logic for this ledger. `Azimuth.eth`
12+cannot be modified directly by [galaxy vote](/docs/glossary/upgrade) - they are
13+only eligible to modify the Ecliptic.
14+
15+The general state of Azimuth is given as follows.
16+
17+```
18+ // points: per point, general network-relevant point state
19+ //
20+ mapping(uint32 => Point) public points;
21+
22+ // rights: per point, on-chain ownership and permissions
23+ //
24+ mapping(uint32 => Deed) public rights;
25+
26+ // operators: per owner, per address, has the right to transfer ownership
27+ // of all the owner's points (ERC721)
28+ //
29+ mapping(address => mapping(address => bool)) public operators;
30+
31+ // dnsDomains: base domains for contacting galaxies
32+ //
33+ // dnsDomains[0] is primary, the others are used as fallbacks
34+ //
35+ string[3] public dnsDomains;
36+```
37+
38+Urbit ID's are formalized as [ERC-721 non-fungible
39+tokens](https://eips.ethereum.org/EIPS/eip-721) and are indexed by a number
40+between `0` and `2^32-1`, or `uint32`. There are two data structures associated to a given
41+`uint32`: a `Point` and a `Deed`. A `Point` contains data about networking keys
42+and sponsorship status, arranged in the following `struct`:
43+
44+```
45+ struct Point
46+ {
47+ // encryptionKey: (curve25519) encryption public key, or 0 for none
48+ //
49+ bytes32 encryptionKey;
50+ //
51+ // authenticationKey: (ed25519) authentication public key, or 0 for none
52+ //
53+ bytes32 authenticationKey;
54+ //
55+ // spawned: for stars and galaxies, all :active children
56+ //
57+ uint32[] spawned;
58+ //
59+ // hasSponsor: true if the sponsor still supports the point
60+ //
61+ bool hasSponsor;
62+
63+ // active: whether point can be linked
64+ //
65+ // false: point belongs to prefix, cannot be configured or linked
66+ // true: point no longer belongs to prefix, can be configured and linked
67+ //
68+ bool active;
69+
70+ // escapeRequested: true if the point has requested to change sponsors
71+ //
72+ bool escapeRequested;
73+
74+ // sponsor: the point that supports this one on the network, or,
75+ // if :hasSponsor is false, the last point that supported it.
76+ // (by default, the point's half-width prefix)
77+ //
78+ uint32 sponsor;
79+
80+ // escapeRequestedTo: if :escapeRequested is true, new sponsor requested
81+ //
82+ uint32 escapeRequestedTo;
83+
84+ // cryptoSuiteVersion: version of the crypto suite used for the pubkeys
85+ //
86+ uint32 cryptoSuiteVersion;
87+
88+ // keyRevisionNumber: incremented every time the public keys change
89+ //
90+ uint32 keyRevisionNumber;
91+
92+ // continuityNumber: incremented to indicate network-side state loss
93+ //
94+ uint32 continuityNumber;
95+ }
96+```
97+
98+The owner of an Urbit ID may also set several [proxies](/docs/using/id/proxies)
99+by modifying their `Deed`:
100+
101+```
102+struct Deed
103+ {
104+ // owner: address that owns this point
105+ //
106+ address owner;
107+
108+ // managementProxy: 0, or another address with the right to perform
109+ // low-impact, managerial operations on this point
110+ //
111+ address managementProxy;
112+
113+ // spawnProxy: 0, or another address with the right to spawn children
114+ // of this point
115+ //
116+ address spawnProxy;
117+
118+ // votingProxy: 0, or another address with the right to vote as this point
119+ //
120+ address votingProxy;
121+
122+ // transferProxy: 0, or another address with the right to transfer
123+ // ownership of this point
124+ //
125+ address transferProxy;
126+ }
127+```
128+
129+Finally, each Ethereum address may set for itself a number of `operators`,
130+as defined and required by the ERC-721 standard. These are for third party
131+brokers/wallets/auctioneers/etc such as [OpenSea](http://opensea.io).
132+
133+The ledger also contains some other state—`dnsDomains`—which are domain names by
134+which the IP address of a galaxy may be looked up, e.g. `zod.urbit.org` resolves
135+to `35.247.119.159`. This is used for bootstrapping the network from DNS. Three
136+domains may be listed here, but as of today they are all `urbit.org`. This may
137+only be updated by the owner of Ecliptic, but arguably each galaxy ought to be
138+able to set its own domain name and so we do not expect this to remain the case
139+forever.
140+
141+All data in this ledger is stored and processed locally on your ship by the
142+[`%azimuth` Gall agent](/docs/azimuth/l2-flow#azimuth), including [layer
143+2](/docs/azimuth/layer2) data. Because state transitions resulting from layer 2
144+transactions are not included in this ledger, in general the local store will
145+differ from what is kept in Azimuth.eth.
146+
147+
content/docs/azimuth/azimuth.md+50−2
@@ -35,7 +35,8 @@ which Ethereum addresses own which Urbit ID's as well as the public keys needed
3535to communicate with those ID's. All identity-related operations, such as
3636transfers, are governed by Azimuth. Azimuth isn't built strictly for Arvo -- the
3737smart contracts on Ethereum are sufficient to be used as a generalized identity
38−system for other projects.
38+system for other projects. Azimuth is considered to be the technical
39+nomenclature for the PKI, while Urbit ID is the common nomenclature.
3940
4041These otherwise-parallel systems meet when you want to connect to the Arvo
4142network. Your Arvo personal server, called your _ship_, needs to be able to
@@ -46,6 +47,43 @@ A metaphor might help illustrate the relationship between these two systems: the
4647Arvo network is the neighborhood that you live in; Azimuth is the bank vault
4748that stores the deed to your house.
4849
50+## Smart contracts
51+
52+Azimuth consists of the following smart contracts:
53+
54+ - [Azimuth.eth](https://etherscan.io/address/azimuth.eth)
55+ `0x223c067f8cf28ae173ee5cafea60ca44c335fecb`: contains all on-chain state for
56+ Azimuth. Most notably, ownership and public keys. Can't be modified directly,
57+ you must use the Ecliptic.
58+ - [Ecliptic.eth](https://etherscan.io/address/ecliptic.eth):
59+ `0x9ef27de616154FF8B38893C59522b69c7Ba8A81c ` is used as an interface for
60+ interacting with your points on-chain. Allows you to configure keys, transfer
61+ ownership, etc.
62+ - [Polls](https://etherscan.io/address/0x7fecab617c868bb5996d99d95200d2fa708218e4):
63+ `0x7fecab617c868bb5996d99d95200d2fa708218e4` registers votes by the Galactic
64+ Senate on proposals. These can be either static documents or Ecliptic
65+ upgrades.
66+ - [Linear Star
67+ Release](https://etherscan.io/address/0x86cd9cd0992f04231751e3761de45cecea5d1801):
68+ facilitates the release of blocks of stars to their owners over a period of
69+ time.
70+ - [Conditional Star
71+ Release](https://etherscan.io/address/0x8c241098c3d3498fe1261421633fd57986d74aea):
72+ `0x8c241098c3d3498fe1261421633fd57986d74aea` facilitates the release of
73+ blocks of stars to their owners based on milestones.
74+ - [Claims](https://etherscan.io/address/0xe7e7f69b34d7d9bd8d61fb22c33b22708947971a):
75+ `0xe7e7f69b34d7d9bd8d61fb22c33b22708947971a` allows point owners to make
76+ claims about (for example) their identity, and associate that with their
77+ point.
78+ - [Censures](https://etherscan.io/address/0x325f68d32bdee6ed86e7235ff2480e2a433d6189):
79+ `0x325f68d32bdee6ed86e7235ff2480e2a433d6189` simple reputation management,
80+ allowing galaxies and stars to flag points for negative reputation.
81+ - [Delegated
82+ Sending](https://etherscan.io/address/0xf6b461fe1ad4bd2ce25b23fe0aff2ac19b3dfa76):
83+ enables network-effect like distributing of planets.
84+
85+ Walkthroughs of some of the smart contracts are linked to [below](#other).
86+
4987## Naive rollups
5088
5189In 2021, Tlon introduced a new system to Azimuth intended to reduce gas costs
@@ -67,7 +105,17 @@ A casual overview of the naive rollups system can be found on the
67105are encouraged to read our Layer 2 documentation, starting with the [Layer 2
68106Overview](/docs/azimuth/layer2).
69107
70−## Other resources
108+## Other resources {#other}
109+
110+### [Azimuth.eth](/docs/azimuth/azimuth-eth)
111+
112+A description of the `azimuth.eth` smart contract, which is the data store for
113+Azimuth.
114+
115+### [Ecliptic.eth](/docs/azimuth/ecliptic)
116+
117+A description of the `ecliptic.eth` smart contract, which is the business logic
118+for `azimuth.eth`. This includes an overview of all function calls available.
71119
72120### [Urbit HD Wallet](/docs/azimuth/hd-wallet)
73121
content/docs/azimuth/contract.md−210
@@ -2,7 +2,6 @@
22title = "Smart Contracts"
33weight = 4
44template = "doc.html"
5−aliases = ["/docs/learn/azimuth"]
65+++
76
87This document summarizes the Ethereum smart contracts that
@@ -40,212 +39,3 @@ Azimuth consists of the following smart contracts:
4039 - [Delegated
4140 Sending](https://etherscan.io/address/0xf6b461fe1ad4bd2ce25b23fe0aff2ac19b3dfa76):
4241 enables network-effect like distributing of planets.
43−
44− We give a more in-depth look at a few of them below.
45−
46−## [Azimuth.eth](https://etherscan.io/address/azimuth.eth)
47−
48−This contract is used for storing all data related to Azimuth points and their
49−ownership, and should be considered to be the ledger for Azimuth. This contract
50−is only a data store - it only contains the bare minimum of business logic. See
51−[the Ecliptic](#ecliptic) for the contract containing the business logic for
52−this ledger. `Azimuth.eth` cannot be modified directly by [galaxy
53−vote](/docs/glossary/upgrade) - they are only eligible to modify the Ecliptic.
54−
55−Urbit ID's are formalized as [ERC-721 non-fungible
56−tokens](https://eips.ethereum.org/EIPS/eip-721). The
57−data associated to a given Urbit ID is known as a `point`. A `point` is the
58−following `struct`:
59−
60−```
61− struct Point
62− {
63− // encryptionKey: (curve25519) encryption public key, or 0 for none
64− //
65− bytes32 encryptionKey;
66− //
67− // authenticationKey: (ed25519) authentication public key, or 0 for none
68− //
69− bytes32 authenticationKey;
70− //
71− // spawned: for stars and galaxies, all :active children
72− //
73− uint32[] spawned;
74− //
75− // hasSponsor: true if the sponsor still supports the point
76− //
77− bool hasSponsor;
78−
79− // active: whether point can be linked
80− //
81− // false: point belongs to prefix, cannot be configured or linked
82− // true: point no longer belongs to prefix, can be configured and linked
83− //
84− bool active;
85−
86− // escapeRequested: true if the point has requested to change sponsors
87− //
88− bool escapeRequested;
89−
90− // sponsor: the point that supports this one on the network, or,
91− // if :hasSponsor is false, the last point that supported it.
92− // (by default, the point's half-width prefix)
93− //
94− uint32 sponsor;
95−
96− // escapeRequestedTo: if :escapeRequested is true, new sponsor requested
97− //
98− uint32 escapeRequestedTo;
99−
100− // cryptoSuiteVersion: version of the crypto suite used for the pubkeys
101− //
102− uint32 cryptoSuiteVersion;
103−
104− // keyRevisionNumber: incremented every time the public keys change
105− //
106− uint32 keyRevisionNumber;
107−
108− // continuityNumber: incremented to indicate network-side state loss
109− //
110− uint32 continuityNumber;
111− }
112−```
113−
114−We remark that `uint32` is a 32-bit integer, and that 32 bits is the size of the
115−Urbit address space. Thus each ID is ultimately a 32-bit number, which one can
116−check in dojo with `\`@\`~sampel-palnet` or `\`@ub\`~sampel-palnet` to see it
117−written in binary. Thus `spawned`, `sponsor`, and `escapeRequestedTo` are
118−`uint32`'s referring to a particular Urbit ID.
119−
120−The owner of an Urbit ID may also set several [proxies](/docs/using/id/proxies)
121−by modifying their `Deed`:
122−
123−```
124−struct Deed
125− {
126− // owner: address that owns this point
127− //
128− address owner;
129−
130− // managementProxy: 0, or another address with the right to perform
131− // low-impact, managerial operations on this point
132− //
133− address managementProxy;
134−
135− // spawnProxy: 0, or another address with the right to spawn children
136− // of this point
137− //
138− address spawnProxy;
139−
140− // votingProxy: 0, or another address with the right to vote as this point
141− //
142− address votingProxy;
143−
144− // transferProxy: 0, or another address with the right to transfer
145− // ownership of this point
146− //
147− address transferProxy;
148− }
149−```
150−
151−Finally, each owner of an Urbit ID may set for itself a number of `operators`,
152−as defined and required by the ERC-721 standard. These are for third party
153−brokers/wallets/auctioneers/etc such as [OpenSea](http://opensea.io).
154−
155−The ledger also contains some other state—domain names by which the IP
156−address of a galaxy may be looked up, e.g. `zod.urbit.org` resolves to
157−`35.247.119.159`. This is used for bootstrapping the network from DNS. Three
158−domains may be listed here, but as of today they are all `urbit.org`. This may
159−only be updated by the owner of Ecliptic, but arguably each galaxy ought to be
160−able to set its own domain name and so we do not expect this to remain the case
161−forever.
162−
163−All data in this ledger is stored and processed locally on your ship by the
164−[`%azimuth` Gall agent](/docs/azimuth/l2-flow#azimuth), including [layer
165−2](/docs/azimuth/layer2) data. Because state transitions resulting from layer 2
166−transactions are not included in this ledger, in general the local store will
167−differ from what is kept in Azimuth.eth.
168−
169−## [Ecliptic.eth](https://etherscan.io/address/ecliptic.eth) {#ecliptic}
170−
171−Ecliptic.eth holds the business logic for the ledger kept by Azimuth.eth. It may
172−be modified by [galaxy vote](/docs/glossary/upgrade). This determines things
173−such as what the various proxies are capable of, how keys are changed, or
174−verifying that a request is valid.
175−
176−You can read about [Urbit's first
177−upgrade](https://github.com/urbit/azimuth/pull/35) to Ecliptic, which occurred
178−in the summer of 2021, [here](https://urbit.org/blog/first-contract). The
179−[second](https://github.com/urbit/azimuth/pull/43) occurred later in the year
180−and consisted of several small modifications to ready the PKI for the
181−introduction of naive rollups.
182−
183−There are currently 17 events which may be called in Ecliptic, which we explain
184−in the following. Most of these have a corresponding [layer 2
185−action](/docs/azimuth/l2-actions), and most of them may be performed using
186−[Bridge](/using/id/using-bridge). We describe how this is so where applicable.
187−
188−### `doEscape`
189−
190−Corresponds to `%adopt` on layer 2.
191−
192−This action may be performed using Bridge.
193−
194−Allows a potential sponsor to accept a `setEscapeRequest` from a potential
195−sponsee. Planets may only be adopted by stars, and stars may only be adopted by
196−galaxies.
197−
198−### `setSpawnProxy`
199−
200−Sets the spawn proxy for a point.
201−
202−This action may be performed using Bridge.
203−
204−Corresponds to `%set-spawn-proxy` on layer 2.
205−
206−### `setTransferProxy`
207−
208−Sets the transfer proxy for a point.
209−
210−This action is performed by Bridge when transferring a point from one address to
211−another. This makes transferring into a two-step process in order to reduce the
212−likelihood of accidental transfer.
213−
214−Corresponds to `%set-transfer-proxy` on layer 2.
215−
216−### `renounceOwnership`
217−
218−Renounces ownership of the Ecliptic contract. This leaves the contract with no
219−owner, and thus it would no longer possible to call functions with the
220−`onlyOwner` modifier. This action may only be performed by the owner of
221−Ecliptic,
222−
223−### `activatePoint`
224−
225−### `setManagementProxy`
226−
227−### `setVotingProxy`
228−
229−### `setEscapeRequest`
230−
231−### `setDnsDomains`
232−
233−### `loseSponsor`
234−
235−### `setOperator`
236−
237−### `registerSpawned`
238−
239−### `cancelEscape`
240−
241−### `setOwner`
242−
243−### `transferOwnership`
244−
245−Transfers ownership of the Ecliptic contract to a new owner. This may only be
246−performed by the owner of the contract, and is not available in Bridge or layer 2.
247−
248−### `incrementContinuityNumber`
249−
250−### `setKeys`
251−
content/docs/azimuth/ecliptic.mdnew file+161
@@ -0,0 +1,161 @@
1++++
2+title = "Ecliptic.eth"
3+weight = 6
4+template = "doc.html"
5++++
6+
7+[Ecliptic.eth](https://etherscan.io/address/ecliptic.eth) holds the business
8+logic for the ledger kept by Azimuth.eth. It may be modified by [galaxy
9+vote](/docs/glossary/upgrade). This determines things such as what the various
10+proxies are capable of, how keys are changed, or verifying that a request is
11+valid.
12+
13+You can read about [Urbit's first
14+upgrade](https://github.com/urbit/azimuth/pull/35) to Ecliptic, which occurred
15+in the summer of 2021, [here](https://urbit.org/blog/first-contract). The
16+[second](https://github.com/urbit/azimuth/pull/43) occurred later in the year
17+and consisted of several small modifications to ready the PKI for the
18+introduction of naive rollups.
19+
20+There are currently [28 functions](#write) which may be called to write to
21+the Ecliptic, and [17 functions](#read) to read data from the Ecliptic. Many of these
22+have a corresponding [layer 2 action](/docs/azimuth/l2-actions), and/or can be
23+performed using [Bridge](/using/id/using-bridge). We note these facts where applicable.
24+
25+## Write functions {#write}
26+
27+Here we briefly describe each function in the Ecliptic which allows one to write
28+data to Ethereum. These can be called using
29+[Etherscan](https://etherscan.io/address/ecliptic.eth#writeContract), but
30+the most common functions may be called from within Bridge.
31+
32+### `startDocumentPoll`
33+
34+#### Accepts
35+
36+`uint8 _galaxy, bytes32 _proposal`
37+
38+#### Action
39+
40+Starts a [document poll](/docs/glossary/docvote). Galaxies only. `_galaxy` is
41+the calling galaxy, and `_proposal` is a keccak-256 hash of any arbitrary
42+document or string of text.
43+
44+### `detach`
45+
46+A sponsor may call this on a sponsee to set `hasSponsor` for their `Point` to
47+`false`.
48+
49+
50+### `approve`
51+
52+### `updateDocumentPoll`
53+
54+### `onUpgrade`
55+
56+### `transferPoint`
57+
58+### `transferFrom`
59+
60+### `createGalaxy`
61+
62+### `setTransferProxy`
63+
64+Sets the `transferProxy` for a `Point`. This action may only be performed by the
65+owner of the `Point` or their transfer proxy.
66+
67+This action is performed by Bridge when transferring a point from one address to
68+another. This makes transferring into a two-step process in order to reduce the
69+likelihood of accidental transfer.
70+
71+Corresponds to `%set-transfer-proxy` on layer 2.
72+
73+### `safeTransferFrom`
74+
75+### `configureKeys`
76+
77+### `castUpgradeVote`
78+
79+### `updateUpgradePoll`
80+
81+### `castDocumentVote`
82+
83+### `renounceOwnership`
84+
85+Renounces ownership of the Ecliptic contract. This leaves the contract with no
86+owner, and thus it would no longer possible to call functions with the
87+`onlyOwner` modifier. This action may only be performed by the owner of
88+Ecliptic.
89+
90+### `setManagementProxy`
91+
92+Sets the `managementProxy` for a `Point`. This action may only be performed by the
93+owner of the `Point` or their management proxy.
94+
95+This action may be performed using Bridge.
96+
97+Corresponds to `%set-management-proxy` on layer 2.
98+
99+### `startUpgradePoll`
100+
101+### `spawn`
102+
103+### `setApprovalForAll`
104+
105+### `setVotingProxy`
106+
107+Sets the `votingProxy` for a `Point`. This action may only be performed by
108+galaxies, by either their owner or their voting proxy.
109+
110+This action may be performed using Bridge.
111+
112+This action does exist on layer 2 as `%set-voting-proxy`, however since galaxies
113+cannot be deposited to layer 2 they cannot set a layer 2 voting proxy.
114+
115+### `setSpawnProxy`
116+
117+Sets the `spawnProxy` for a `Point`. This action may only be performed by stars and
118+galaxies, by either their owner or their spawn proxy.
119+
120+This action may be performed using Bridge.
121+
122+Corresponds to `%set-spawn-proxy` on layer 2.
123+
124+### `safeTransferFrom`
125+
126+### `setDnsDomains`
127+
128+Sets `dnsDomains`. This may only be done by the owner of the contract. This may
129+not be done using Bridge and has no corresponding action on layer 2.
130+
131+### `reject`
132+
133+### `escape`
134+
135+Sets `escapeRequested` to `true` and `escapeRequestedTo` to a given `uint32`
136+indexing a `Point`. This action may only be performed by planets and stars, by
137+either the owner of the `Point` or their management proxy.
138+
139+This action may be performed in Bridge.
140+
141+Corresponds to `%escape` on layer 2.
142+
143+### `adopt`
144+
145+Corresponds to `%adopt` on layer 2.
146+
147+This action may be performed using Bridge.
148+
149+Allows a potential sponsor to accept a `setEscapeRequest` from a potential
150+sponsee. Planets may only be adopted by stars, and stars may only be adopted by
151+galaxies.
152+
153+### `cancelEscape`
154+
155+### `transferOwnership`
156+
157+Transfers ownership of the Ecliptic contract to a new owner. This may only be
158+performed by the owner of the contract, and is not available in Bridge or layer 2.
159+
160+
161+