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/act.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,10 +10,10 @@ ACT, or Access Control Trie, is a decentralized permission system built into the
10
10
11
11
When you upload data to Swarm using ACT, only the original uploader and users with public keys listed in an associated grantee list are able to retrieve and decrypt that data. The grantee list is published separately and cryptographically referenced during upload and download operations.
12
12
13
-
ACT is ideal for use cases such as the serialized release of content like a podcast or newsletter where the publisher wishes to limit access to subscribers only.
13
+
ACT is ideal for use cases such as the serialized release of content like a podcast or newsletter, where the publisher wishes to limit access to subscribers only.
14
14
15
15
:::warning
16
-
Once a file is uploaded with ACT, any node whose public key is on the ACT grantees list referenced during the upload ***will have permanent access to that file*** as long as the file reference and history reference returned from the upload has been shared with them.
16
+
Once a file is uploaded with ACT, any node whose public key is on the ACT grantees list referenced during the upload ***will have permanent access to that file*** as long as the file reference and history reference returned from the upload have been shared with them.
17
17
18
18
Updating the grantees list to remove a public key ***will not revoke access*** to the content retroactively.
19
19
@@ -23,7 +23,7 @@ Likewise, re-uploading the content using the new grantees list will also ***not
23
23
## Requirements
24
24
The use of ACT requires the following:
25
25
26
-
* A Bee light node running on with synced postage batch data. (Running at `http://localhost:1633` by default)
26
+
* A Bee light node running with synced postage batch data. (Running at `http://localhost:1633` by default)
27
27
* A valid postage batch ID. [Buy one](./buying-storage.md#purchasing-storage) if needed.
28
28
* Public keys of the nodes you want to grant access to.
29
29
* The **public key of the publishing node**. This can be obtained using the [`bee.connectivity.getNodeAddresses()` method](./status.md#3-get-node-addresses).
@@ -89,7 +89,7 @@ The second reference 32 byte (64 hex digit) `History Reference` (`historyref`) i
89
89
## Update Grantees List
90
90
91
91
:::info
92
-
Although we refer to this operation as an "update", due to Swarm's immutable nature, the original list is not modified by this operation. Rather a new list is created with the specified grantee keys added or removed from the original list. This operation ***DOES NOT*** retroactively add or remove access to content uploaded with the original ACT list.
92
+
Although we refer to this operation as an "update", due to Swarm's immutable nature, the original list is not modified by this operation. Rather, a new list is created with the specified grantee keys added to or removed from the original list. This operation ***DOES NOT*** retroactively add or remove access to content uploaded with the original ACT list.
93
93
:::
94
94
95
95
To update a grantees list, call the `bee.grantee.patch()` method with the following arguments:
@@ -181,7 +181,7 @@ The grantee list is encrypted, and only the owner can view the grantee list, mak
181
181
The example script below performs the following operations:
182
182
183
183
1. Initializes a Bee client.
184
-
2. Defines two existing grantee list 64 byte `ref` copied from the results of our previous example scripts.
184
+
2. Defines the 64 byte `ref` of two existing grantee lists, copied from the results of our previous example scripts.
185
185
3. Calls `bee.grantee.get()` for each `ref` to retrieve the corresponding grantee list.
186
186
4. Logs the status, status text, and list of grantee public keys in compressed hex format.
187
187
@@ -239,11 +239,11 @@ Grantees: [
239
239
]
240
240
```
241
241
242
-
The first list of grantees contains the first public key we gave access to when we created the list, while the second one contains both the first and the second one we added when we created our second list based on the first one.
242
+
The first list of grantees contains the public key we gave access to when we created the list, while the second contains that key plus the one we added when we created the second list.
243
243
244
244
## Upload With ACT
245
245
246
-
We can upload our content with either of the two lists we created depending on which set of users we wish to give access too. In the example below, we use both lists.
246
+
We can upload our content with either of the two lists we created, depending on which set of users we wish to give access to. In the example below, we use both lists.
247
247
248
248
#### Example Script:
249
249
@@ -368,6 +368,6 @@ Example terminal output:
368
368
Content: This is a sample string that will be uploaded securely using ACT.
369
369
```
370
370
371
-
In the example above, we used the history reference from the file uploaded using the grantees list with only one public key included (`027d0c4759f689ea3dd3eb79222870671c492cb99f3fade275bcbf0ea39cd0ef6e`), and so it will only be able to be retrieved and decrypted by the node with that public key.
371
+
In the example above, we used the history reference from the file uploaded using the grantees list with only one public key included (`027d0c4759f689ea3dd3eb79222870671c492cb99f3fade275bcbf0ea39cd0ef6e`), so only the node with that public key can retrieve and decrypt it.
372
372
373
373
If any other node attempts to download this content then a 404 error will be returned.
Copy file name to clipboardExpand all lines: docs/documentation/buying-storage.md
+24-26Lines changed: 24 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,7 +26,7 @@ Mutable batches are a flexible tool which can be used to power use cases such as
26
26
27
27
-->
28
28
29
-
Storage on Swarm is rented by purchasing "postage stamp batches". Each batch entitles its owner to store a certain amount of storage space on Swarm for the lifetime of the batch. The cost of the batch increases with the storage size and duration.
29
+
Storage on Swarm is rented by purchasing "postage stamp batches". Each batch reserves a certain amount of storage space on Swarm for the lifetime of the batch. The cost of the batch increases with the storage size and duration.
30
30
31
31
### Requirements
32
32
@@ -39,9 +39,9 @@ To use the example scripts below, you need:
39
39
We can use the `bee.storage.getCost` method along with our desired storage `Size` (amount of data to upload) and `Duration` (the batch lifetime) to get an estimated storage cost:
40
40
41
41
:::tip
42
-
The perbyte storage cost decreases as the storage `Size` of the batch increases, so it is more cost effective to purchase a single large batch rather than multiple smaller ones.
42
+
The per-byte storage cost decreases as the storage `Size` of the batch increases, so it is more cost effective to purchase a single large batch rather than multiple smaller ones.
43
43
44
-
Costs remain constant with respect to changes in total `Duration`, however, so there is no discount for purchasing batches with longer lifetime.
44
+
Costs remain constant with respect to changes in total `Duration`, however, so there is no discount for purchasing batches with a longer lifetime.
45
45
:::
46
46
47
47
```javascript
@@ -96,9 +96,9 @@ Just as with buying storage, since storage comes only in [***discrete sizes***](
96
96
If we need to upload more data, then we can extend a batch's storage size using the `bee.storage.extendSize` method. Note that in order to increase the batch size using the `bee.storage.extendSize` method, you must choose a size which is above the current [batch's size breakpoint](./buying-storage.md#batch-size-breakpoints).
97
97
98
98
:::tip
99
-
As mentioned [above](./buying-storage.md#batch-size-breakpoints), the perbyte cost decreases as the storage size of a batch increases, so it's more cost effective to increase the storage size an existing batch rather than buying a new, smaller batch.
99
+
As mentioned [below](./buying-storage.md#batch-size-breakpoints), the per-byte cost decreases as the storage size of a batch increases, so it's more cost effective to increase the storage size of an existing batch than to buy a new, smaller one.
100
100
101
-
The exception to this rule is if we no longer wish to store the previously uploaded data. In that case we SHOULD buy an all new postage batch, as extending the size of an existing batch would require us to continue paying for the already uploaded data which we no longer need.
101
+
The exception to this rule is if we no longer wish to store the previously uploaded data. In that case we should buy a new postage batch, since extending the size of an existing batch would mean continuing to pay for the already uploaded data which we no longer need.
102
102
:::
103
103
104
104
First we estimate the cost to extend the storage size with the `bee.storage.getSizeExtensionCost` method:
// Select the batch ID of the first batch in the list
228
228
constbatchId= batches[0].batchID
229
229
230
-
// Create a Duration instance for 0.1 additional days
230
+
// Create a Duration instance for 0.01 additional days
231
231
constadditionalDuration=Duration.fromDays(.01)
232
232
233
233
// Extend the duration of the batch
@@ -355,23 +355,21 @@ The results printed to the terminal will include all the currently valid postage
355
355
We can disregard many of these values since they are only needed for advanced usage. There are several values we do need to pay attention to however:
356
356
357
357
- `usable` - it takes a short timefor a batch to become usable (usually less than a minute) after purchase. Once usable, `usable` will change from `false` to `true`.
358
-
- `usage` - indicates how much of the batch has been used as a value between `1` and `0`.
358
+
- `usage` - indicates how much of the batch has been used as a value between `0` and `1`.
359
359
- `usageText` - converts the `usage` value to a percentage value rounded to the nearest whole number which is then converted to text.
360
360
- `size` - the amount of data in bytes which the batch can safely store.
361
-
- `remainingSize` - the amount of datein bytes remaining from `size` which is still available to be used.
361
+
- `remainingSize` - the amount of datain bytes remaining from `size` which is still available to be used.
362
362
- `duration` - an estimate of the remaining batch lifetime in seconds.
363
363
364
-
For an explanation of the remaining values, refer to the "Advanced" section below.
365
-
366
364
:::tip
367
-
Note that although 1 GB was specified as input forthe `bee.storage.buy`, the `size` value is ~2.38 GB. Refer to the [section about batch sizes](./buying-storage.md#batch-size-breakpoints) above to understand why.
365
+
Note that although 1 GB was specified as input for`bee.storage.buy`, the `size` value is ~2.38 GB. Refer to the [section about batch sizes](./buying-storage.md#batch-size-breakpoints) below to understand why.
368
366
:::
369
367
370
368
### Selecting a Batch
371
369
372
-
Any method in`bee-js` which writes data to Swarm requires the batch id of a valid, usable postage batch with remaining space to upload data.
370
+
Any method in`bee-js` which writes data to Swarm requires the batch ID of a valid, usable postage batch with remaining space to upload data.
373
371
374
-
The example script below exports a functionwhich looks for the first usable postage batch with remaining space and returns the id of the batch.
372
+
The example script below exports a functionwhich looks for the first usable postage batch with remaining space and returns the ID of the batch.
375
373
376
374
:::tip notice
377
375
This functionis used throughout the examples here in the docs.
@@ -394,7 +392,7 @@ export async function getBatch(bee, criteriaFn) {
394
392
}
395
393
```
396
394
397
-
To use it, save the script to a file called `getBatch.js` so we can import the it in our other scripts.
395
+
To use it, save the script to a file called `getBatch.js` so we can import it in our other scripts.
398
396
399
397
```javascript
400
398
import { Bee } from '@ethersphere/bee-js'
@@ -407,18 +405,18 @@ function isUsableWithFreeSpace(batch) {
If you need a batch with specific characteristics (such as a batch with at least 10 GB remaining space or a mutable batch), then you should [inspect](./buying-storage.md#checking-batch-status) your postage batches' status using `bee.stamp.getAll` in order to check if a batch with your desired characteristics exists and return its id.
411
+
If you need a batch with specific characteristics (such as a batch with at least 10 GB remaining space or a mutable batch), then you should [inspect](./buying-storage.md#checking-batch-status) your postage batches' status using `bee.stamp.getAll` in order to check if a batch with your desired characteristics exists and return its ID.
414
412
415
413
### Batch Size Breakpoints
416
414
417
415
Batches are bought in discrete size intervals. Each interval corresponds to a batch *depth*, and each depth doubles the theoretical volume of the batch.
418
416
419
417
Only part of a batch's theoretical volume can be filled in practice, because chunks are distributed unevenly across the batch's buckets. The share that can be used is the *effective volume*, and it grows with depth: a depth 17 batch can only use a hundredth of a percent of its theoretical volume, while a depth 34 batch can use almost 90% of it. This is why the per-byte cost of storage falls sharply as batches get bigger.
420
418
421
-
*The table below reflects the breakpoints `bee-js` uses by default, which are optimised for encrypted uploads with medium erasure coding. Pass the `encryption` and `erasureCodeLevel` arguments to `bee.storage.buy` and `bee.storage.getCost` to use the exact table for a different combination.*
419
+
*The table below reflects the breakpoints `bee-js` uses by default, which are optimized for encrypted uploads with medium erasure coding. Pass the `encryption` and `erasureCodeLevel` arguments to `bee.storage.buy` and `bee.storage.getCost` to use the exact table for a different combination.*
@@ -443,9 +441,9 @@ Only part of a batch's theoretical volume can be filled in practice, because chu
443
441
444
442
The last column is the cost of one effective gigabyte relative to the cheapest depth in the table. It is derived from the volumes rather than from any particular BZZ price, so it holds regardless of what storage currently costs. Use `bee.storage.getCost` for actual prices.
445
443
446
-
When purchasing a batch / estimating batch price, `bee-js` will round up to the nearest effective volume.
444
+
When purchasing a batch or estimating its price, `bee-js` will round up to the nearest effective volume.
447
445
448
-
For example, if the `bee.storage.buy` method is used to buy a batch with 1 GB as input, `bee-js` will round up to depth 21 and buy a batch with 2.38 GB effective volume. If 5 GB is used as input, `bee-js` will round up to depth 22 and its 7.07 GB, because 5 GB does not fit into the 2.38 GB that depth 21 offers.
446
+
For example, if the `bee.storage.buy` method is used to buy a batch with 1 GB as input, `bee-js` will round up to depth 21 and buy a batch with 2.38 GB effective volume. If 5 GB is used as input, `bee-js` will round up to depth 22 and its 7.07 GB, since 5 GB does not fit into the 2.38 GB that depth 21 offers.
449
447
450
448
Refer to the [Bee documentation](https://docs.ethswarm.org/docs/concepts/incentives/postage-stamps#effective-utilisation-table) for a more in-depth understanding of batch utilization.
The `Duration` class represents a length of time in **seconds**, with helper methods for creating and converting durations in various common time units.
506
504
507
505
:::tip
508
-
All of the helper methods for `Duration` take numbers as input except for `toEndDate` `fromEndDate` which both take a [`Date`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) object as input.
506
+
All of the helper methods for `Duration` take numbers as input except for `toEndDate` and `fromEndDate`, which both take a [`Date`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) object as input.
description: Describes how to fund and manage the chequebook used for bandwidth payments when downloading data from Swarm.
7
7
---
8
8
9
-
On Swarm, when downloading data from the network, nodes pay each other for forwarding data in the form of cheques. If you will be downloading a significant amount of data from the network, it is important that you fund your chequebook with BZZ so your node can issue and then pay for cheques.
9
+
On Swarm, when downloading data from the network, nodes pay each other for forwarding data in the form of cheques. If you plan to download a significant amount of data from the network, it is important that you fund your chequebook with BZZ so your node can issue and then pay for cheques.
10
10
11
-
You can also fund your chequebook by running a full node and getting paid in BZZ for forwarding chunks to other nodes, however this may not be enough depending on your download volume.
11
+
You can also fund your chequebook by running a full node and getting paid in BZZ for forwarding chunks to other nodes, though this may not be enough depending on your download volume.
12
12
13
13
:::tip
14
14
If using your node for downloads, it's recommended to actively monitor your node's chequebook balance and top it up once the balance begins to run low.
@@ -131,7 +131,7 @@ Last cheques for peer 10f68a7f7fe8b85e04ae0c869c02852f1b568b145c7f59179feef0601d
131
131
132
132
Cash out a cheque for a specific peer. This method allows you to retrieve funds from a cheque that has been issued to you by a peer.
0 commit comments