You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/documentation/soc-and-feeds.md
+36-8Lines changed: 36 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,11 +16,39 @@ Feeds are a unique feature of Swarm which simulate the publishing of mutable con
16
16
17
17
## Requirements
18
18
19
-
Interactions with SOC and feeds requires the following:
19
+
Interactions with SOC and feeds require the following:
20
20
21
-
* A fully initialized Bee light node running with fully synced postage batch data. (Running at `http://localhost:1633` by default)
21
+
* A fully initialized Bee light node running with fully synced postage batch data (running at `http://localhost:1633` by default).
22
22
* A valid postage batch ID.
23
-
* An Ethereum-compatible private key to sign updates. Using your node or blockchain account wallet's private key is strongly discouraged. Using a dedicated key for SOC / feeds is recommended.
23
+
* A dedicated Ethereum-compatible publisher private key to sign updates. Do **not** use the private key of your Bee node or any wallet that holds funds.
24
+
25
+
:::tip
26
+
You can use the `PrivateKey` class to generate a dedicated publisher key for signing SOC and feed updates:
Public address: 8d3766440f0d7b949a5e32995d09619a7f86e632
45
+
```
46
+
47
+
Store this key securely.
48
+
Anyone with access to it can publish to your feed or SOC.
49
+
50
+
*It is recommended to use a separate publishing key for each feed or SOC. This limits the damage if a key is ever exposed — a compromised key should only allow publishing to one resource, not all of them.*
51
+
:::
24
52
25
53
## Single Owner Chunks
26
54
@@ -48,7 +76,7 @@ When you are instantiating `Bee` class you can pass an Ethereum private key as t
48
76
:::
49
77
50
78
:::warning Your assets and/or privacy may be at risk
51
-
We suggest using ephemeral private keys (e.g. randomly generated) when writing to SOC or Feeds. Never use your real Ethereum private keys here (or in any web applications) directly because it will allow others to sign messages with your kay which may compromise your privacy or lead to the loss of funds stored by that account.
79
+
We recommend using dedicated publisher private keys when writing to SOCs or Feeds. Never use the private keys of your node or a wallet that holds funds, as this may allow others to sign messages on your behalf, compromise your privacy, or lead to the loss ofassets. Store your publisher keys securely, as anyone with access to them can publish updates to your feed.
-`privateKey` is used to initialize the writer as `socWriter` which is used to sign the SOC.
138
+
-`privateKey`(initialized using our [previously generated](#requirements) publisher key) is used to initialize the writer as `socWriter` which is used to sign the SOC.
111
139
-`NULL_IDENTIFIER` is the 32-byte value used as the identifier (can be replaced with any user-defined value).
112
140
-`socWriter.upload()` signs and uploads the data, returning a `reference` as confirmation.
113
141
@@ -155,7 +183,7 @@ readSOC()
155
183
```
156
184
157
185
In this example:
158
-
- The `owner` is the Ethereum address used to sign the SOC.
186
+
- The `owner` is the Ethereum address used to retrieve the SOC (derived from the private key [previously generated](#requirements)).
159
187
-`NULL_IDENTIFIER` is the same default identifier used in the earlier upload example.
160
188
- The returned payload is a `Bytes` object, and `.toUtf8()` converts it to a human-readable string.
161
189
@@ -171,7 +199,7 @@ Feeds are an abstraction built on top of Single Owner Chunks (SOCs) that **simul
171
199
172
200
Similar to how an SOC is defined by an `owner` and `identifier`, a feed is defined by:
173
201
174
-
*`owner`: an Ethereum-compatible address
202
+
*`owner`: an Ethereum-compatible address
175
203
*`topic`: a unique 32-byte identifier
176
204
177
205
### Concepts
@@ -199,7 +227,7 @@ Although it is possible to update feeds with an arbitrary data payload using `up
199
227
200
228
The script below performs the following steps:
201
229
202
-
1. Initializes the Bee client and derives the feed owner address from a private key.
230
+
1. Initializes the Bee client and derives the feed owner address from a privatekey (which we have [previously generated](#requirements)).
203
231
2. Uses the `uploadPayload()` method to upload a plain text string as a **payload update** to the feed with topic `"payload-update"`.
204
232
3. Uploads the same string as a file to Swarm and obtains a reference.
205
233
4. Uses the `upload()` method to upload the obtained reference as a **reference update** to the feed with topic `"reference-update"`.
0 commit comments