Skip to content

Commit fc4353c

Browse files
committed
Add config docs
1 parent 64b5552 commit fc4353c

File tree

6 files changed

+336
-23
lines changed

6 files changed

+336
-23
lines changed

docs/sage/config.md

Lines changed: 316 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,316 @@
1+
---
2+
slug: /config
3+
---
4+
5+
# Config
6+
7+
The config files are used to control the app's backend, rather than UI specific things (such as the default fee).
8+
9+
:::note
10+
If the app is open, any changes you make to the config will not be reflected until restarted. Additionally, changes may be overwritten if an action is taken in the UI or RPC to modify the config.
11+
:::
12+
13+
## config.toml
14+
15+
An example config looks like this:
16+
17+
```toml
18+
version = 2
19+
20+
[global]
21+
log_level = "DEBUG"
22+
fingerprint = 1239439275
23+
24+
[network]
25+
default_network = "mainnet"
26+
target_peers = 5
27+
discover_peers = true
28+
29+
[rpc]
30+
enabled = true
31+
port = 9257
32+
```
33+
34+
### version
35+
36+
The version specified at the top level of the config indicates the schema being used. Prior to 0.10.0, an old schema was used for the config file, so the schema version is 2 to indicate an automatic migration to the new schema has taken place. Do not change this value yourself.
37+
38+
```toml
39+
version = 2
40+
```
41+
42+
### global.log_level
43+
44+
This decides what the minimum severity of logs to output to the console or log file should be. It defaults to `INFO`, which provides a good balance between relevant information and frequency. If you're trying to diagnose a problem in the app, or like having more information as to what's going on, you can set it to `DEBUG`.
45+
46+
```toml
47+
[global]
48+
log_level = "INFO"
49+
```
50+
51+
### global.fingerprint
52+
53+
If specified, this is the fingerprint of the wallet you are currently logged into. This can be changed in the UI, via the RPC, or manually if the app is not running.
54+
55+
```toml
56+
[global]
57+
fingerprint = 1239439275
58+
```
59+
60+
### network.default_network
61+
62+
The name of the network you want to connect to by default. This can be overridden on a per-wallet basis, but while you are logged out or in a wallet that doesn't have such an override, this network will be used. The network itself is configured in the networks.toml file. Since 0.8.3, mainnet is the default network.
63+
64+
```toml
65+
[network]
66+
default_network = "mainnet"
67+
```
68+
69+
### network.target_peers
70+
71+
The maximum number of peers you want to connect to, if `discover_peers` is turned on. Being connected to more peers does not increase security, but it does make syncing faster since it's parallelized. The default of 5 peers provides a good balance between system resources and syncing speed for small to medium sized wallets. However, you may want to increase this to something like 15 for larger wallets. Setting it to an excessive value may cause instability, drain battery, or use a lot of network bandwidth.
72+
73+
```toml
74+
[network]
75+
target_peers = 5
76+
```
77+
78+
### network.discover_peers
79+
80+
Whether or not to discover peers automatically. If this is enabled, the wallet will use various methods to find and connect to peers on the current network. If you're running your own full node, you likely want to disable this setting and add the node's ip address yourself.
81+
82+
```toml
83+
[network]
84+
discover_peers = true
85+
```
86+
87+
### rpc.enabled
88+
89+
Whether the RPC should be started automatically when the app is opened. This is not on by default, because the RPC gives full control over the wallet and should be used with caution.
90+
91+
```toml
92+
[rpc]
93+
enabled = false
94+
```
95+
96+
### rpc.port
97+
98+
The port that the RPC server should be served on.
99+
100+
```toml
101+
[rpc]
102+
port = 9257
103+
```
104+
105+
## networks.toml
106+
107+
This file provides a list of network objects, each prefixed with `[[networks]]`.
108+
109+
For example:
110+
111+
```toml
112+
[[networks]]
113+
name = "mainnet"
114+
ticker = "XCH"
115+
default_port = 8444
116+
genesis_challenge = "ccd5bb71183532bff220ba46c268991a3ff07eb358e8255a65c30a2dce0e5fbb"
117+
inherit = "mainnet"
118+
```
119+
120+
### name
121+
122+
A unique name for the network. For example, even though there may be multiple networks whose id is `mainnet`, they must be disambiguated with this name.
123+
124+
```toml
125+
[[networks]]
126+
name = "mainnet"
127+
```
128+
129+
### ticker
130+
131+
The currency symbol displayed after amounts.
132+
133+
```toml
134+
[[networks]]
135+
ticker = "XCH"
136+
```
137+
138+
### prefix
139+
140+
A bech32m prefix used for encoding puzzle hashes into addresses for display purposes. This is optional, and defaults to the ticker in lower case.
141+
142+
```toml
143+
[[networks]]
144+
prefix = "xch"
145+
```
146+
147+
### precision
148+
149+
The number of decimals of precision there are in formatted amounts, when measured in the currency of the network. This is optional, since it defaults to Chia's precision of 12.
150+
151+
```toml
152+
[[networks]]
153+
precision = 12
154+
```
155+
156+
### network_id
157+
158+
The network id used when handshaking to peers on this network. For example, `mainnet`, `testnet11`, or `simulator0`. Multiple networks may have the same network id, especially if you're connecting to a fork of Chia.
159+
160+
```toml
161+
[[networks]]
162+
network_id = "mainnet"
163+
```
164+
165+
### default_port
166+
167+
This is the port that will be used when connecting to peers, whether they are found by an introducer or received from an existing peer. It's possible for full nodes on the network to use a different port, although it's not common if they are exposed to the internet.
168+
169+
```toml
170+
[[networks]]
171+
default_port = 8444
172+
```
173+
174+
### genesis_challenge
175+
176+
This is a value used to represent the genesis of the chain, or the placeholder header hash before the first block. It's necessary when requesting coin information from a peer using the light wallet protocol.
177+
178+
```toml
179+
[[networks]]
180+
genesis_challenge = "ccd5bb71183532bff220ba46c268991a3ff07eb358e8255a65c30a2dce0e5fbb"
181+
```
182+
183+
### agg_sig_me
184+
185+
Signed messages usually use this value or a derivative of it as a way to prevent replay attacks across different networks running the same codebase but a different `agg_sig_me` value. This is optional and should almost always be omitted, as it defaults to the `genesis_challenge`. However, on `simulator0` the `agg_sig_me` differs from `genesis_challenge` and the following value is used instead.
186+
187+
```toml
188+
[[networks]]
189+
agg_sig_me = "ccd5bb71183532bff220ba46c268991a3ff07eb358e8255a65c30a2dce0e5fbb"
190+
```
191+
192+
### dns_introducers
193+
194+
A DNS introducer (also known as a seeder) provides the ability to perform a DNS host lookup to find a list of reliable full node peers to connect to with the light wallet protocol.
195+
196+
```toml
197+
[[networks]]
198+
dns_introducers = ["dns-introducer.chia.net"]
199+
```
200+
201+
### peer_introducers
202+
203+
With some DNS servers, the DNS introducers may be blocked or otherwise unreliable, so there's a backup introducer system provided where you can connect directly to a single peer and request other peers from it with the peer protocol.
204+
205+
```toml
206+
[[networks]]
207+
dns_introducers = ["introducer.chia.net"]
208+
```
209+
210+
### inherit
211+
212+
You can inherit from either `mainnet` or `testnet11`, which are the default networks provided by Sage. This will automatically manage `dns_introducers` and `peer_introducers` for you, so you don't have to specify them manually. Any items you add to the list will be appended to the defaults rather than replace them. If you wish you override the defaults, you can simply remove `inherit`.
213+
214+
```toml
215+
[[networks]]
216+
inherit = "mainnet"
217+
```
218+
219+
## wallets.toml
220+
221+
This file provides a list of wallet objects, each prefixed with `[[wallets]]`. There are also a few defaults, which are used unless overridden.
222+
223+
For example:
224+
225+
```toml
226+
[defaults.change]
227+
mode = "same"
228+
229+
[defaults.derivation]
230+
mode = "auto"
231+
derivation_batch_size = 1000
232+
233+
[[wallets]]
234+
name = "Main"
235+
fingerprint = 1239439275
236+
network = "mainnet"
237+
```
238+
239+
### defaults.change
240+
241+
The mode can be one of the following:
242+
243+
- `default` - is currently set to `same`, but may change in the future unless manually set
244+
- `same` - reuses the first address among coins you are spending as the change address
245+
- `new` - uses the next unused address to increase transaction privacy
246+
247+
```toml
248+
[defaults.change]
249+
mode = "same"
250+
```
251+
252+
### defaults.derivation
253+
254+
The mode can be one of the following:
255+
256+
- `default` - is currently set to `auto`, but may change in the future unless manually set
257+
- `auto` - when the number of unused unhardened addresses is running low, a new batch will be generated
258+
- `static` - only existing addresses will be used, no new ones will be generated automatically
259+
260+
```toml
261+
[defaults.derivation]
262+
mode = "auto"
263+
derivation_batch_size = 1000
264+
```
265+
266+
### name
267+
268+
The name is used for display purposes only.
269+
270+
```toml
271+
[[wallets]]
272+
name = "Main"
273+
```
274+
275+
### fingerprint
276+
277+
The process for calculating a fingerprint is as follows:
278+
279+
1. Convert the master public key to bytes
280+
2. Calculate the sha256 hash
281+
3. Convert the first 4 bytes of the hash to a 32 bit unsigned integer
282+
283+
This fingerprint is used for internal identification purposes, and is not considered sensitive information, nor enough to securely prove authenticity. The chance of a collision with this amount of entropy is low in practice but possible, especially by brute force.
284+
285+
```toml
286+
[[wallets]]
287+
fingerprint = 1239439275
288+
```
289+
290+
### change
291+
292+
The same as `defaults.change`, although it would take the following form (after the initial `[[wallets]]` settings):
293+
294+
```toml
295+
[wallets.change]
296+
mode = "same"
297+
```
298+
299+
### derivation
300+
301+
The same as `defaults.derivation`, although it would take the following form (after the initial `[[wallets]]` settings):
302+
303+
```toml
304+
[wallets.derivation]
305+
mode = "auto"
306+
derivation_batch_size = 1000
307+
```
308+
309+
### network
310+
311+
A network override, for when you want the wallet to use a different network than the `default_network` automatically. When you log into the wallet, the network you're connected to will switch, and when you log out it will switch back to the default. This is especially useful if you have a wallet that is dedicated to testing, but you want your other wallets to use mainnet.
312+
313+
```toml
314+
[[wallets]]
315+
network = "testnet11"
316+
```
Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1+
---
2+
slug: /files
3+
---
4+
15
import Tabs from '@theme/Tabs';
26
import TabItem from '@theme/TabItem';
37

4-
# Data Directory
8+
# Files
59

610
All files used by Sage are stored in a single location, inside of the system's default [data dir](https://docs.rs/dirs/latest/dirs/fn.data_dir.html).
711

@@ -17,13 +21,13 @@ The username `Alice` is a placeholder, and must be replaced by your actual usern
1721

1822
## Files
1923

20-
| Name | Description |
21-
| --------------- | ---------------------------------------------------------------- |
22-
| `config.toml` | The main configuration file used by the app. |
23-
| `keys.bin` | A binary encoding of all imported keys. |
24-
| `logs` | Logs emitted by the backend of the app. |
25-
| `networks.toml` | Information about blockchain networks (ie mainnet or testnet11). |
26-
| `peers` | Binary files that store previous peer connections. |
27-
| `ssl` | The SSL certificate used for full node connections and the RPC. |
28-
| `wallets` | SQLite databases for each network and key pair. |
29-
| `wallets.toml` | Configuration for each imported wallet. |
24+
| Name | Description |
25+
| --------------- | -------------------------------------------------------------------------------------------- |
26+
| `config.toml` | The main configuration file used by the app. See [Config](/docs/config). |
27+
| `keys.bin` | A binary encoding of all imported keys. |
28+
| `logs` | Logs emitted by the backend of the app. |
29+
| `networks.toml` | Information about blockchain networks (ie mainnet or testnet11). See [Config](/docs/config). |
30+
| `peers` | Binary files that store previous peer connections. |
31+
| `ssl` | The SSL certificate used for full node connections and the RPC. |
32+
| `wallets` | SQLite databases for each network and key pair. |
33+
| `wallets.toml` | Configuration for each imported wallet. See [Config](/docs/config). |

docs/sage/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import TabItem from '@theme/TabItem';
99

1010
The goal of this website is to provide documentation for Sage and the Wallet SDK it's built with. It will cover a wide range of topics, from configuring and using Sage and its RPCs to building your own applications that utilize the Wallet SDK library to connect to the Chia blockchain.
1111

12-
:::note
12+
:::info
1313
If you are looking for download instructions for the app, visit the [Sage Website](https://sagewallet.net).
1414
:::
1515

File renamed without changes.

docusaurus.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ const config: Config = {
104104
prism: {
105105
theme: prismThemes.github,
106106
darkTheme: prismThemes.dracula,
107+
additionalLanguages: ["toml"],
107108
},
108109
} satisfies Preset.ThemeConfig,
109110
};

sidebars.ts

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,9 @@ import type { SidebarsConfig } from "@docusaurus/plugin-content-docs";
33
const sidebars: SidebarsConfig = {
44
sageSidebar: [
55
{ type: "doc", id: "sage/index" },
6-
{ type: "doc", id: "sage/directory" },
7-
{
8-
type: "category",
9-
label: "RPC API",
10-
link: {
11-
type: "generated-index",
12-
description:
13-
"Explore the API provided by the Sage RPC, as well as instructions on how to set it up.",
14-
},
15-
items: ["sage/rpc/index"],
16-
},
6+
{ type: "doc", id: "sage/files" },
7+
{ type: "doc", id: "sage/config" },
8+
{ type: "doc", id: "sage/rpc" },
179
],
1810
sdkSidebar: ["sdk/index"],
1911
};

0 commit comments

Comments
 (0)