diff --git a/.gitignore b/.gitignore index e882916d5..182429f06 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .docusaurus +.claude node_modules .DS_Store build @@ -12,4 +13,4 @@ test *.zip *.csv # Tools -.claude \ No newline at end of file +.claude diff --git a/docs/concepts/DISC/erasure-coding.md b/docs/concepts/DISC/erasure-coding.md index 549cdd9d7..107d5ccac 100644 --- a/docs/concepts/DISC/erasure-coding.md +++ b/docs/concepts/DISC/erasure-coding.md @@ -20,11 +20,12 @@ For an 8KB image, if we set **m = 2** and **k = 1**, we create 3 chunks (2 origi ### Levels of Protection -In Swarm's implementation of erasure coding, there are four named levels of protection, Medium, Strong, Insane, and Paranoid. For each level, the **m** and **k** values have been adjusted in order to meet a certain level of data protection: +In Swarm's implementation of erasure coding, there are five levels of protection, None, Medium, Strong, Insane, and Paranoid. For each level, the **m** and **k** values have been adjusted in order to meet a certain level of data protection: ***Table A:*** | Redundancy Level Value | Level Name | Chunk Loss Tolerance | | ---------------- | --------- | ----------------------------------- | +| 0 | None | 0% | | 1 | Medium | 1% | | 2 | Strong | 5% | | 3 | Insane | 10% | @@ -40,17 +41,18 @@ For usage instructions, see the [erasure coding page in the "Develop" section](. ## Cost Calculation -In Swarm's implementation of erasure coding, there are four levels of protection: Medium, Strong, Insane, and Paranoid. Each level adds additional parity chunks for a corresponding increase in data protection (and also cost). +In Swarm's implementation of erasure coding, there are five levels of protection: None, Medium, Strong, Insane, and Paranoid. Each level adds additional parity chunks for a corresponding increase in data protection (and also cost). The table below shows the number of parities and data chunks for each level, as well as the percent increase in cost vs a non-erasure coded upload. ***Table B:*** | Redundancy | Parities | Data Chunks | Percent | Chunks Encrypted | Percent Encrypted | |----------|----------|--------|---------|------------------|-------------------| -| Medium | 9 | 119 | *7.6%* | 59 | 15% | -| Strong | 21 | 107 | *19.6%* | 53 | 40% | -| Insane | 31 | 97 | 32% | 48 | 65% | -| Paranoid | 90 | 38 | 240.5% | 18 | 494% | +| None | 0 | 128 | *0%* | 64 | 0% | +| Medium | 9 | 119 | *7.6%* | 59 | 15.3% | +| Strong | 21 | 107 | *19.6%* | 53 | 39.6% | +| Insane | 31 | 97 | 32% | 48 | 64.6% | +| Paranoid | 90 | 38 | 236.8% | 19 | 473.7% | For each redundancy level, there are **m + k** = 128 chunks, where **m** are the data chunks (shown in column "Data Chunks") and **k** are the parity chunks (shown in column "Parities"). The "Percent" and "Percent Encrypted" columns show percent of "parity overhead" cost increase from using erasure coding for normal and encrypted uploads respectively. @@ -152,6 +154,7 @@ To find the percent increase in cost for uploads of less than 128 chunks, refer | Paranoid | 86 | 35 | 245.7% | 17 | 505.9% | | Paranoid | 87 | 36 | 241.7% | 18 | 483.3% | | Paranoid | 89 | 37 | 240.5% | 18 | 494.4% | +| Paranoid | 90 | 38 | 236.8% | 19 | 473.7% | ### Example Cost Calculation diff --git a/docs/concepts/incentives/postage-stamps.md b/docs/concepts/incentives/postage-stamps.md index d69e08ceb..589e11889 100644 --- a/docs/concepts/incentives/postage-stamps.md +++ b/docs/concepts/incentives/postage-stamps.md @@ -177,7 +177,7 @@ The implications of this behaviour are that even a small change to the data of a ### Implications for Swarm Users -Due to the nature of batch utilisation described above, batches are often fully utilised before reaching their theoretical maximum storage amount. However as the batch depth increases, the chance of a postage batch becoming fully utilised early decreases. At batch depth 24, there is a 0.1% chance that a batch will be fully utilised/start replacing old chunks before reaching 64.33% of its theoretical maximum. +Due to the nature of batch utilisation described above, batches are often fully utilised before reaching their theoretical maximum storage amount. However as the batch depth increases, the chance of a postage batch becoming fully utilised early decreases. At batch depth 24 (unencrypted, no erasure coding), there is a 0.1% chance that a batch will be fully utilised/start replacing old chunks before reaching 68.48% of its theoretical maximum. Let's look at an example to make it clearer. Using the method of calculating the theoretical maximum storage amount [outlined above](./postage-stamps.md#batch-depth), we can see that for a batch depth of 24, the theoretical maximum amount which can be stored is 68.72 gb: @@ -185,12 +185,14 @@ $$ 2^{24+12} = \text{68,719,476,736 bytes} = \text{68.72 gb} $$ -Therefore we should use 64.33% the effective rate of usage for the stamp batch: +Therefore we should use 68.48% the effective rate of usage for the stamp batch: $$ -\text{68.72 gb} \times{0.6433} = \text{44.21 gb } +\text{68.72 gb} \times{0.6848} = \text{47.06 gb } $$ +Note that the effective volume also depends on the encryption and erasure coding settings used. The example above assumes unencrypted data with no erasure coding. See the [effective utilisation tables below](#effective-utilisation-tables) for the full set of effective volumes. + ## Effective Utilisation Tables @@ -199,9 +201,8 @@ When a user buys a batch of stamps they may make the naive assumption that they Columns: * **Theoretical Volume:** The theoretical maximum volume which can be reached if the batch is completely utilized. -* **Effective Volume:** The actual volume which a batch can be expected to store based with a failure rate of less than or equal to 0.1% (1 in 1000) +* **Effective Volume:** The actual volume which a batch can be expected to store with a failure rate of less than or equal to 0.1% (1 in 1000). * **Batch Depth:** The batch depth value. -* **Utilization Rate:** The percentage of the theoretical volume which can be expected to be used according to the effective volume. :::info The title of each table below states whether it is for encrypted or unencrypted uploads along with the erasure coding level. @@ -217,300 +218,300 @@ The title of each table below states whether it is for encrypted or unencrypted ### Unencrypted - NONE -| Theoretical Volume | Effective Volume | Batch Depth | Utilization Rate | -| ------------- | ------------- | ------------- | ------------- | -| 536.87 MB | 44.70 kB | 17 | 0.01% | -| 1.07 GB | 6.66 MB | 18 | 0.61% | -| 2.15 GB | 112.06 MB | 19 | 5.09% | -| 4.29 GB | 687.62 MB | 20 | 15.65% | -| 8.59 GB | 2.60 GB | 21 | 30.27% | -| 17.18 GB | 7.73 GB | 22 | 44.99% | -| 34.36 GB | 19.94 GB | 23 | 58.03% | -| 68.72 GB | 47.06 GB | 24 | 68.48% | -| 137.44 GB | 105.51 GB | 25 | 76.77% | -| 274.88 GB | 227.98 GB | 26 | 82.94% | -| 549.76 GB | 476.68 GB | 27 | 86.71% | -| 1.10 TB | 993.65 GB | 28 | 88.37% | -| 2.20 TB | 2.04 TB | 29 | 92.88% | -| 4.40 TB | 4.17 TB | 30 | 94.81% | -| 8.80 TB | 8.45 TB | 31 | 96.06% | -| 17.59 TB | 17.07 TB | 32 | 97.01% | -| 35.18 TB | 34.36 TB | 33 | 97.65% | -| 70.37 TB | 69.04 TB | 34 | 98.11% | -| 140.74 TB | 138.54 TB | 35 | 98.44% | -| 281.47 TB | 277.72 TB | 36 | 98.67% | -| 562.95 TB | 556.35 TB | 37 | 98.83% | -| 1.13 PB | 1.11 PB | 38 | 98.91% | -| 2.25 PB | 2.23 PB | 39 | 98.96% | -| 4.50 PB | 4.46 PB | 40 | 98.98% | -| 9.01 PB | 8.93 PB | 41 | 99.11% | +| Theoretical Volume | Effective Volume | Batch Depth | +| ------------- | ------------- | ------------- | +| 536.87 MB | 44.70 kB | 17 | +| 1.07 GB | 6.66 MB | 18 | +| 2.15 GB | 112.06 MB | 19 | +| 4.29 GB | 687.62 MB | 20 | +| 8.59 GB | 2.60 GB | 21 | +| 17.18 GB | 7.73 GB | 22 | +| 34.36 GB | 19.94 GB | 23 | +| 68.72 GB | 47.06 GB | 24 | +| 137.44 GB | 105.51 GB | 25 | +| 274.88 GB | 227.98 GB | 26 | +| 549.76 GB | 476.68 GB | 27 | +| 1.10 TB | 993.65 GB | 28 | +| 2.20 TB | 2.04 TB | 29 | +| 4.40 TB | 4.17 TB | 30 | +| 8.80 TB | 8.45 TB | 31 | +| 17.59 TB | 17.07 TB | 32 | +| 35.18 TB | 34.36 TB | 33 | +| 70.37 TB | 69.04 TB | 34 | +| 140.74 TB | 138.54 TB | 35 | +| 281.47 TB | 277.72 TB | 36 | +| 562.95 TB | 556.35 TB | 37 | +| 1.13 PB | 1.11 PB | 38 | +| 2.25 PB | 2.23 PB | 39 | +| 4.50 PB | 4.46 PB | 40 | +| 9.01 PB | 8.93 PB | 41 | ### Unencrypted - MEDIUM -| Theoretical Volume | Effective Volume | Batch Depth | Utilization Rate | -| ------------- | ------------- | ------------- | ------------- | -| 536.87 MB | 41.56 kB | 17 | 0.01% | -| 1.07 GB | 6.19 MB | 18 | 0.57% | -| 2.15 GB | 104.18 MB | 19 | 4.73% | -| 4.29 GB | 639.27 MB | 20 | 14.54% | -| 8.59 GB | 2.41 GB | 21 | 28.11% | -| 17.18 GB | 7.18 GB | 22 | 41.79% | -| 34.36 GB | 18.54 GB | 23 | 53.95% | -| 68.72 GB | 43.75 GB | 24 | 63.66% | -| 137.44 GB | 98.09 GB | 25 | 71.37% | -| 274.88 GB | 211.95 GB | 26 | 77.11% | -| 549.76 GB | 443.16 GB | 27 | 80.61% | -| 1.10 TB | 923.78 GB | 28 | 82.16% | -| 2.20 TB | 1.90 TB | 29 | 86.30% | -| 4.40 TB | 3.88 TB | 30 | 88.14% | -| 8.80 TB | 7.86 TB | 31 | 89.26% | -| 17.59 TB | 15.87 TB | 32 | 90.21% | -| 35.18 TB | 31.94 TB | 33 | 90.77% | -| 70.37 TB | 64.19 TB | 34 | 91.22% | -| 140.74 TB | 128.80 TB | 35 | 91.52% | -| 281.47 TB | 258.19 TB | 36 | 91.73% | -| 562.95 TB | 517.23 TB | 37 | 91.88% | -| 1.13 PB | 1.04 PB | 38 | 91.95% | -| 2.25 PB | 2.07 PB | 39 | 92.00% | -| 4.50 PB | 4.15 PB | 40 | 92.15% | -| 9.01 PB | 8.30 PB | 41 | 92.14% | +| Theoretical Volume | Effective Volume | Batch Depth | +| ------------- | ------------- | ------------- | +| 536.87 MB | 41.56 kB | 17 | +| 1.07 GB | 6.19 MB | 18 | +| 2.15 GB | 104.18 MB | 19 | +| 4.29 GB | 639.27 MB | 20 | +| 8.59 GB | 2.41 GB | 21 | +| 17.18 GB | 7.18 GB | 22 | +| 34.36 GB | 18.54 GB | 23 | +| 68.72 GB | 43.75 GB | 24 | +| 137.44 GB | 98.09 GB | 25 | +| 274.88 GB | 211.95 GB | 26 | +| 549.76 GB | 443.16 GB | 27 | +| 1.10 TB | 923.78 GB | 28 | +| 2.20 TB | 1.90 TB | 29 | +| 4.40 TB | 3.88 TB | 30 | +| 8.80 TB | 7.86 TB | 31 | +| 17.59 TB | 15.87 TB | 32 | +| 35.18 TB | 31.94 TB | 33 | +| 70.37 TB | 64.19 TB | 34 | +| 140.74 TB | 128.80 TB | 35 | +| 281.47 TB | 258.19 TB | 36 | +| 562.95 TB | 517.23 TB | 37 | +| 1.13 PB | 1.04 PB | 38 | +| 2.25 PB | 2.07 PB | 39 | +| 4.50 PB | 4.15 PB | 40 | +| 9.01 PB | 8.30 PB | 41 | ### Unencrypted - STRONG -| Theoretical Volume | Effective Volume | Batch Depth | Utilization Rate | -| ------------- | ------------- | ------------- | ------------- | -| 536.87 MB | 37.37 kB | 17 | 0.01% | -| 1.07 GB | 5.57 MB | 18 | 0.51% | -| 2.15 GB | 93.68 MB | 19 | 4.25% | -| 4.29 GB | 574.81 MB | 20 | 13.07% | -| 8.59 GB | 2.17 GB | 21 | 25.26% | -| 17.18 GB | 6.46 GB | 22 | 37.58% | -| 34.36 GB | 16.67 GB | 23 | 48.50% | -| 68.72 GB | 39.34 GB | 24 | 57.24% | -| 137.44 GB | 88.20 GB | 25 | 64.17% | -| 274.88 GB | 190.58 GB | 26 | 69.33% | -| 549.76 GB | 398.47 GB | 27 | 72.48% | -| 1.10 TB | 830.63 GB | 28 | 73.85% | -| 2.20 TB | 1.71 TB | 29 | 77.59% | -| 4.40 TB | 3.49 TB | 30 | 79.27% | -| 8.80 TB | 7.07 TB | 31 | 80.34% | -| 17.59 TB | 14.27 TB | 32 | 81.12% | -| 35.18 TB | 28.72 TB | 33 | 81.63% | -| 70.37 TB | 57.71 TB | 34 | 82.01% | -| 140.74 TB | 115.81 TB | 35 | 82.29% | -| 281.47 TB | 232.16 TB | 36 | 82.48% | -| 562.95 TB | 465.07 TB | 37 | 82.61% | -| 1.13 PB | 931.23 TB | 38 | 82.67% | -| 2.25 PB | 1.86 PB | 39 | 82.71% | -| 4.50 PB | 3.73 PB | 40 | 82.78% | -| 9.01 PB | 7.46 PB | 41 | 82.79% | +| Theoretical Volume | Effective Volume | Batch Depth | +| ------------- | ------------- | ------------- | +| 536.87 MB | 37.37 kB | 17 | +| 1.07 GB | 5.57 MB | 18 | +| 2.15 GB | 93.68 MB | 19 | +| 4.29 GB | 574.81 MB | 20 | +| 8.59 GB | 2.17 GB | 21 | +| 17.18 GB | 6.46 GB | 22 | +| 34.36 GB | 16.67 GB | 23 | +| 68.72 GB | 39.34 GB | 24 | +| 137.44 GB | 88.20 GB | 25 | +| 274.88 GB | 190.58 GB | 26 | +| 549.76 GB | 398.47 GB | 27 | +| 1.10 TB | 830.63 GB | 28 | +| 2.20 TB | 1.71 TB | 29 | +| 4.40 TB | 3.49 TB | 30 | +| 8.80 TB | 7.07 TB | 31 | +| 17.59 TB | 14.27 TB | 32 | +| 35.18 TB | 28.72 TB | 33 | +| 70.37 TB | 57.71 TB | 34 | +| 140.74 TB | 115.81 TB | 35 | +| 281.47 TB | 232.16 TB | 36 | +| 562.95 TB | 465.07 TB | 37 | +| 1.13 PB | 931.23 TB | 38 | +| 2.25 PB | 1.86 PB | 39 | +| 4.50 PB | 3.73 PB | 40 | +| 9.01 PB | 7.46 PB | 41 | ### Unencrypted - INSANE -| Theoretical Volume | Effective Volume | Batch Depth | Utilization Rate | -| ------------- | ------------- | ------------- | ------------- | -| 536.87 MB | 33.88 kB | 17 | 0.01% | -| 1.07 GB | 5.05 MB | 18 | 0.46% | -| 2.15 GB | 84.92 MB | 19 | 3.86% | -| 4.29 GB | 521.09 MB | 20 | 11.85% | -| 8.59 GB | 1.97 GB | 21 | 22.90% | -| 17.18 GB | 5.86 GB | 22 | 34.09% | -| 34.36 GB | 15.11 GB | 23 | 43.97% | -| 68.72 GB | 35.66 GB | 24 | 51.90% | -| 137.44 GB | 79.96 GB | 25 | 58.18% | -| 274.88 GB | 172.77 GB | 26 | 62.85% | -| 549.76 GB | 361.23 GB | 27 | 65.70% | -| 1.10 TB | 753.00 GB | 28 | 66.95% | -| 2.20 TB | 1.55 TB | 29 | 70.38% | -| 4.40 TB | 3.16 TB | 30 | 71.92% | -| 8.80 TB | 6.41 TB | 31 | 72.85% | -| 17.59 TB | 12.93 TB | 32 | 73.53% | -| 35.18 TB | 26.04 TB | 33 | 74.01% | -| 70.37 TB | 52.32 TB | 34 | 74.35% | -| 140.74 TB | 104.99 TB | 35 | 74.60% | -| 281.47 TB | 210.46 TB | 36 | 74.77% | -| 562.95 TB | 421.61 TB | 37 | 74.89% | -| 1.13 PB | 844.20 TB | 38 | 74.94% | -| 2.25 PB | 1.69 PB | 39 | 74.98% | -| 4.50 PB | 3.38 PB | 40 | 75.03% | -| 9.01 PB | 6.77 PB | 41 | 75.10% | +| Theoretical Volume | Effective Volume | Batch Depth | +| ------------- | ------------- | ------------- | +| 536.87 MB | 33.88 kB | 17 | +| 1.07 GB | 5.05 MB | 18 | +| 2.15 GB | 84.92 MB | 19 | +| 4.29 GB | 521.09 MB | 20 | +| 8.59 GB | 1.97 GB | 21 | +| 17.18 GB | 5.86 GB | 22 | +| 34.36 GB | 15.11 GB | 23 | +| 68.72 GB | 35.66 GB | 24 | +| 137.44 GB | 79.96 GB | 25 | +| 274.88 GB | 172.77 GB | 26 | +| 549.76 GB | 361.23 GB | 27 | +| 1.10 TB | 753.00 GB | 28 | +| 2.20 TB | 1.55 TB | 29 | +| 4.40 TB | 3.16 TB | 30 | +| 8.80 TB | 6.41 TB | 31 | +| 17.59 TB | 12.93 TB | 32 | +| 35.18 TB | 26.04 TB | 33 | +| 70.37 TB | 52.32 TB | 34 | +| 140.74 TB | 104.99 TB | 35 | +| 281.47 TB | 210.46 TB | 36 | +| 562.95 TB | 421.61 TB | 37 | +| 1.13 PB | 844.20 TB | 38 | +| 2.25 PB | 1.69 PB | 39 | +| 4.50 PB | 3.38 PB | 40 | +| 9.01 PB | 6.77 PB | 41 | ### Unencrypted - PARANOID -| Theoretical Volume | Effective Volume | Batch Depth | Utilization Rate | -| ------------- | ------------- | ------------- | ------------- | -| 536.87 MB | 13.27 kB | 17 | 0.00% | -| 1.07 GB | 1.98 MB | 18 | 0.18% | -| 2.15 GB | 33.27 MB | 19 | 1.51% | -| 4.29 GB | 204.14 MB | 20 | 4.64% | -| 8.59 GB | 771.13 MB | 21 | 8.75% | -| 17.18 GB | 2.29 GB | 22 | 13.34% | -| 34.36 GB | 5.92 GB | 23 | 17.22% | -| 68.72 GB | 13.97 GB | 24 | 20.33% | -| 137.44 GB | 31.32 GB | 25 | 22.79% | -| 274.88 GB | 67.68 GB | 26 | 24.62% | -| 549.76 GB | 141.51 GB | 27 | 25.74% | -| 1.10 TB | 294.99 GB | 28 | 26.23% | -| 2.20 TB | 606.90 GB | 29 | 27.56% | -| 4.40 TB | 1.24 TB | 30 | 28.15% | -| 8.80 TB | 2.51 TB | 31 | 28.54% | -| 17.59 TB | 5.07 TB | 32 | 28.82% | -| 35.18 TB | 10.20 TB | 33 | 28.99% | -| 70.37 TB | 20.50 TB | 34 | 29.13% | -| 140.74 TB | 41.13 TB | 35 | 29.22% | -| 281.47 TB | 82.45 TB | 36 | 29.29% | -| 562.95 TB | 165.17 TB | 37 | 29.34% | -| 1.13 PB | 330.72 TB | 38 | 29.37% | -| 2.25 PB | 661.97 TB | 39 | 29.39% | -| 4.50 PB | 1.32 PB | 40 | 29.41% | -| 9.01 PB | 2.65 PB | 41 | 29.43% | +| Theoretical Volume | Effective Volume | Batch Depth | +| ------------- | ------------- | ------------- | +| 536.87 MB | 13.27 kB | 17 | +| 1.07 GB | 1.98 MB | 18 | +| 2.15 GB | 33.27 MB | 19 | +| 4.29 GB | 204.14 MB | 20 | +| 8.59 GB | 771.13 MB | 21 | +| 17.18 GB | 2.29 GB | 22 | +| 34.36 GB | 5.92 GB | 23 | +| 68.72 GB | 13.97 GB | 24 | +| 137.44 GB | 31.32 GB | 25 | +| 274.88 GB | 67.68 GB | 26 | +| 549.76 GB | 141.51 GB | 27 | +| 1.10 TB | 294.99 GB | 28 | +| 2.20 TB | 606.90 GB | 29 | +| 4.40 TB | 1.24 TB | 30 | +| 8.80 TB | 2.51 TB | 31 | +| 17.59 TB | 5.07 TB | 32 | +| 35.18 TB | 10.20 TB | 33 | +| 70.37 TB | 20.50 TB | 34 | +| 140.74 TB | 41.13 TB | 35 | +| 281.47 TB | 82.45 TB | 36 | +| 562.95 TB | 165.17 TB | 37 | +| 1.13 PB | 330.72 TB | 38 | +| 2.25 PB | 661.97 TB | 39 | +| 4.50 PB | 1.32 PB | 40 | +| 9.01 PB | 2.65 PB | 41 | ### Encrypted - NONE -| Theoretical Volume | Effective Volume | Batch Depth | Utilization Rate | -| ------------- | ------------- | ------------- | ------------- | -| 536.87 MB | 44.35 kB | 17 | 0.01% | -| 1.07 GB | 6.61 MB | 18 | 0.60% | -| 2.15 GB | 111.18 MB | 19 | 5.05% | -| 4.29 GB | 682.21 MB | 20 | 15.52% | -| 8.59 GB | 2.58 GB | 21 | 30.04% | -| 17.18 GB | 7.67 GB | 22 | 44.62% | -| 34.36 GB | 19.78 GB | 23 | 57.56% | -| 68.72 GB | 46.69 GB | 24 | 67.93% | -| 137.44 GB | 104.68 GB | 25 | 76.16% | -| 274.88 GB | 226.19 GB | 26 | 82.29% | -| 549.76 GB | 472.93 GB | 27 | 86.02% | -| 1.10 TB | 985.83 GB | 28 | 87.66% | -| 2.20 TB | 2.03 TB | 29 | 92.25% | -| 4.40 TB | 4.14 TB | 30 | 94.21% | -| 8.80 TB | 8.39 TB | 31 | 95.37% | -| 17.59 TB | 16.93 TB | 32 | 96.22% | -| 35.18 TB | 34.09 TB | 33 | 96.88% | -| 70.37 TB | 68.50 TB | 34 | 97.34% | -| 140.74 TB | 137.45 TB | 35 | 97.67% | -| 281.47 TB | 275.53 TB | 36 | 97.89% | -| 562.95 TB | 551.97 TB | 37 | 98.05% | -| 1.13 PB | 1.11 PB | 38 | 98.13% | -| 2.25 PB | 2.21 PB | 39 | 98.18% | -| 4.50 PB | 4.43 PB | 40 | 98.36% | -| 9.01 PB | 8.86 PB | 41 | 98.37% | +| Theoretical Volume | Effective Volume | Batch Depth | +| ------------- | ------------- | ------------- | +| 536.87 MB | 44.35 kB | 17 | +| 1.07 GB | 6.61 MB | 18 | +| 2.15 GB | 111.18 MB | 19 | +| 4.29 GB | 682.21 MB | 20 | +| 8.59 GB | 2.58 GB | 21 | +| 17.18 GB | 7.67 GB | 22 | +| 34.36 GB | 19.78 GB | 23 | +| 68.72 GB | 46.69 GB | 24 | +| 137.44 GB | 104.68 GB | 25 | +| 274.88 GB | 226.19 GB | 26 | +| 549.76 GB | 472.93 GB | 27 | +| 1.10 TB | 985.83 GB | 28 | +| 2.20 TB | 2.03 TB | 29 | +| 4.40 TB | 4.14 TB | 30 | +| 8.80 TB | 8.39 TB | 31 | +| 17.59 TB | 16.93 TB | 32 | +| 35.18 TB | 34.09 TB | 33 | +| 70.37 TB | 68.50 TB | 34 | +| 140.74 TB | 137.45 TB | 35 | +| 281.47 TB | 275.53 TB | 36 | +| 562.95 TB | 551.97 TB | 37 | +| 1.13 PB | 1.11 PB | 38 | +| 2.25 PB | 2.21 PB | 39 | +| 4.50 PB | 4.43 PB | 40 | +| 9.01 PB | 8.86 PB | 41 | ### Encrypted - MEDIUM -| Theoretical Volume | Effective Volume | Batch Depth | Utilization Rate | -| ------------- | ------------- | ------------- | ------------- | -| 536.87 MB | 40.89 kB | 17 | 0.01% | -| 1.07 GB | 6.09 MB | 18 | 0.56% | -| 2.15 GB | 102.49 MB | 19 | 4.65% | -| 4.29 GB | 628.91 MB | 20 | 14.30% | -| 8.59 GB | 2.38 GB | 21 | 27.68% | -| 17.18 GB | 7.07 GB | 22 | 41.15% | -| 34.36 GB | 18.24 GB | 23 | 53.09% | -| 68.72 GB | 43.04 GB | 24 | 62.63% | -| 137.44 GB | 96.50 GB | 25 | 70.21% | -| 274.88 GB | 208.52 GB | 26 | 75.86% | -| 549.76 GB | 435.98 GB | 27 | 79.30% | -| 1.10 TB | 908.81 GB | 28 | 80.82% | -| 2.20 TB | 1.87 TB | 29 | 84.98% | -| 4.40 TB | 3.81 TB | 30 | 86.67% | -| 8.80 TB | 7.73 TB | 31 | 87.84% | -| 17.59 TB | 15.61 TB | 32 | 88.74% | -| 35.18 TB | 31.43 TB | 33 | 89.34% | -| 70.37 TB | 63.15 TB | 34 | 89.74% | -| 140.74 TB | 126.71 TB | 35 | 90.03% | -| 281.47 TB | 254.01 TB | 36 | 90.24% | -| 562.95 TB | 508.85 TB | 37 | 90.39% | -| 1.13 PB | 1.02 PB | 38 | 90.47% | -| 2.25 PB | 2.04 PB | 39 | 90.51% | -| 4.50 PB | 4.08 PB | 40 | 90.64% | -| 9.01 PB | 8.17 PB | 41 | 90.65% | +| Theoretical Volume | Effective Volume | Batch Depth | +| ------------- | ------------- | ------------- | +| 536.87 MB | 40.89 kB | 17 | +| 1.07 GB | 6.09 MB | 18 | +| 2.15 GB | 102.49 MB | 19 | +| 4.29 GB | 628.91 MB | 20 | +| 8.59 GB | 2.38 GB | 21 | +| 17.18 GB | 7.07 GB | 22 | +| 34.36 GB | 18.24 GB | 23 | +| 68.72 GB | 43.04 GB | 24 | +| 137.44 GB | 96.50 GB | 25 | +| 274.88 GB | 208.52 GB | 26 | +| 549.76 GB | 435.98 GB | 27 | +| 1.10 TB | 908.81 GB | 28 | +| 2.20 TB | 1.87 TB | 29 | +| 4.40 TB | 3.81 TB | 30 | +| 8.80 TB | 7.73 TB | 31 | +| 17.59 TB | 15.61 TB | 32 | +| 35.18 TB | 31.43 TB | 33 | +| 70.37 TB | 63.15 TB | 34 | +| 140.74 TB | 126.71 TB | 35 | +| 281.47 TB | 254.01 TB | 36 | +| 562.95 TB | 508.85 TB | 37 | +| 1.13 PB | 1.02 PB | 38 | +| 2.25 PB | 2.04 PB | 39 | +| 4.50 PB | 4.08 PB | 40 | +| 9.01 PB | 8.17 PB | 41 | ### Encrypted - STRONG -| Theoretical Volume | Effective Volume | Batch Depth | Utilization Rate | -| ------------- | ------------- | ------------- | ------------- | -| 536.87 MB | 36.73 kB | 17 | 0.01% | -| 1.07 GB | 5.47 MB | 18 | 0.50% | -| 2.15 GB | 92.07 MB | 19 | 4.18% | -| 4.29 GB | 564.95 MB | 20 | 12.85% | -| 8.59 GB | 2.13 GB | 21 | 24.86% | -| 17.18 GB | 6.35 GB | 22 | 36.97% | -| 34.36 GB | 16.38 GB | 23 | 47.67% | -| 68.72 GB | 38.66 GB | 24 | 56.26% | -| 137.44 GB | 86.69 GB | 25 | 63.07% | -| 274.88 GB | 187.31 GB | 26 | 68.14% | -| 549.76 GB | 391.64 GB | 27 | 71.24% | -| 1.10 TB | 816.39 GB | 28 | 72.59% | -| 2.20 TB | 1.68 TB | 29 | 76.34% | -| 4.40 TB | 3.43 TB | 30 | 77.89% | -| 8.80 TB | 6.94 TB | 31 | 78.86% | -| 17.59 TB | 14.02 TB | 32 | 79.71% | -| 35.18 TB | 28.23 TB | 33 | 80.23% | -| 70.37 TB | 56.72 TB | 34 | 80.60% | -| 140.74 TB | 113.82 TB | 35 | 80.88% | -| 281.47 TB | 228.18 TB | 36 | 81.06% | -| 562.95 TB | 457.10 TB | 37 | 81.20% | -| 1.13 PB | 915.26 TB | 38 | 81.26% | -| 2.25 PB | 1.83 PB | 39 | 81.30% | -| 4.50 PB | 3.67 PB | 40 | 81.43% | -| 9.01 PB | 7.34 PB | 41 | 81.45% | +| Theoretical Volume | Effective Volume | Batch Depth | +| ------------- | ------------- | ------------- | +| 536.87 MB | 36.73 kB | 17 | +| 1.07 GB | 5.47 MB | 18 | +| 2.15 GB | 92.07 MB | 19 | +| 4.29 GB | 564.95 MB | 20 | +| 8.59 GB | 2.13 GB | 21 | +| 17.18 GB | 6.35 GB | 22 | +| 34.36 GB | 16.38 GB | 23 | +| 68.72 GB | 38.66 GB | 24 | +| 137.44 GB | 86.69 GB | 25 | +| 274.88 GB | 187.31 GB | 26 | +| 549.76 GB | 391.64 GB | 27 | +| 1.10 TB | 816.39 GB | 28 | +| 2.20 TB | 1.68 TB | 29 | +| 4.40 TB | 3.43 TB | 30 | +| 8.80 TB | 6.94 TB | 31 | +| 17.59 TB | 14.02 TB | 32 | +| 35.18 TB | 28.23 TB | 33 | +| 70.37 TB | 56.72 TB | 34 | +| 140.74 TB | 113.82 TB | 35 | +| 281.47 TB | 228.18 TB | 36 | +| 562.95 TB | 457.10 TB | 37 | +| 1.13 PB | 915.26 TB | 38 | +| 2.25 PB | 1.83 PB | 39 | +| 4.50 PB | 3.67 PB | 40 | +| 9.01 PB | 7.34 PB | 41 | ### Encrypted - INSANE -| Theoretical Volume | Effective Volume | Batch Depth | Utilization Rate | -| ------------- | ------------- | ------------- | ------------- | -| 536.87 MB | 33.26 kB | 17 | 0.01% | -| 1.07 GB | 4.96 MB | 18 | 0.45% | -| 2.15 GB | 83.38 MB | 19 | 3.79% | -| 4.29 GB | 511.65 MB | 20 | 11.64% | -| 8.59 GB | 1.93 GB | 21 | 22.52% | -| 17.18 GB | 5.75 GB | 22 | 33.50% | -| 34.36 GB | 14.84 GB | 23 | 43.19% | -| 68.72 GB | 35.02 GB | 24 | 50.96% | -| 137.44 GB | 78.51 GB | 25 | 57.12% | -| 274.88 GB | 169.64 GB | 26 | 61.71% | -| 549.76 GB | 354.69 GB | 27 | 64.52% | -| 1.10 TB | 739.37 GB | 28 | 65.74% | -| 2.20 TB | 1.52 TB | 29 | 69.15% | -| 4.40 TB | 3.10 TB | 30 | 70.56% | -| 8.80 TB | 6.29 TB | 31 | 71.48% | -| 17.59 TB | 12.70 TB | 32 | 72.18% | -| 35.18 TB | 25.57 TB | 33 | 72.67% | -| 70.37 TB | 51.37 TB | 34 | 73.00% | -| 140.74 TB | 103.08 TB | 35 | 73.24% | -| 281.47 TB | 206.65 TB | 36 | 73.42% | -| 562.95 TB | 413.98 TB | 37 | 73.54% | -| 1.13 PB | 828.91 TB | 38 | 73.59% | -| 2.25 PB | 1.66 PB | 39 | 73.62% | -| 4.50 PB | 3.32 PB | 40 | 73.72% | -| 9.01 PB | 6.64 PB | 41 | 73.74% | +| Theoretical Volume | Effective Volume | Batch Depth | +| ------------- | ------------- | ------------- | +| 536.87 MB | 33.26 kB | 17 | +| 1.07 GB | 4.96 MB | 18 | +| 2.15 GB | 83.38 MB | 19 | +| 4.29 GB | 511.65 MB | 20 | +| 8.59 GB | 1.93 GB | 21 | +| 17.18 GB | 5.75 GB | 22 | +| 34.36 GB | 14.84 GB | 23 | +| 68.72 GB | 35.02 GB | 24 | +| 137.44 GB | 78.51 GB | 25 | +| 274.88 GB | 169.64 GB | 26 | +| 549.76 GB | 354.69 GB | 27 | +| 1.10 TB | 739.37 GB | 28 | +| 2.20 TB | 1.52 TB | 29 | +| 4.40 TB | 3.10 TB | 30 | +| 8.80 TB | 6.29 TB | 31 | +| 17.59 TB | 12.70 TB | 32 | +| 35.18 TB | 25.57 TB | 33 | +| 70.37 TB | 51.37 TB | 34 | +| 140.74 TB | 103.08 TB | 35 | +| 281.47 TB | 206.65 TB | 36 | +| 562.95 TB | 413.98 TB | 37 | +| 1.13 PB | 828.91 TB | 38 | +| 2.25 PB | 1.66 PB | 39 | +| 4.50 PB | 3.32 PB | 40 | +| 9.01 PB | 6.64 PB | 41 | ### Encrypted - PARANOID -| Theoretical Volume | Effective Volume | Batch Depth | Utilization Rate | -| ------------- | ------------- | ------------- | ------------- | -| 536.87 MB | 13.17 kB | 17 | 0.00% | -| 1.07 GB | 1.96 MB | 18 | 0.18% | -| 2.15 GB | 33.01 MB | 19 | 1.50% | -| 4.29 GB | 202.53 MB | 20 | 4.61% | -| 8.59 GB | 765.05 MB | 21 | 8.68% | -| 17.18 GB | 2.28 GB | 22 | 13.27% | -| 34.36 GB | 5.87 GB | 23 | 17.08% | -| 68.72 GB | 13.86 GB | 24 | 20.17% | -| 137.44 GB | 31.08 GB | 25 | 22.61% | -| 274.88 GB | 67.15 GB | 26 | 24.43% | -| 549.76 GB | 140.40 GB | 27 | 25.54% | -| 1.10 TB | 292.67 GB | 28 | 26.03% | -| 2.20 TB | 602.12 GB | 29 | 27.35% | -| 4.40 TB | 1.23 TB | 30 | 27.94% | -| 8.80 TB | 2.49 TB | 31 | 28.32% | -| 17.59 TB | 5.03 TB | 32 | 28.60% | -| 35.18 TB | 10.12 TB | 33 | 28.77% | -| 70.37 TB | 20.34 TB | 34 | 28.91% | -| 140.74 TB | 40.80 TB | 35 | 29.00% | -| 281.47 TB | 81.80 TB | 36 | 29.06% | -| 562.95 TB | 163.87 TB | 37 | 29.11% | -| 1.13 PB | 328.11 TB | 38 | 29.14% | -| 2.25 PB | 656.76 TB | 39 | 29.16% | -| 4.50 PB | 1.31 PB | 40 | 29.18% | -| 9.01 PB | 2.63 PB | 41 | 29.19% | \ No newline at end of file +| Theoretical Volume | Effective Volume | Batch Depth | +| ------------- | ------------- | ------------- | +| 536.87 MB | 13.17 kB | 17 | +| 1.07 GB | 1.96 MB | 18 | +| 2.15 GB | 33.01 MB | 19 | +| 4.29 GB | 202.53 MB | 20 | +| 8.59 GB | 765.05 MB | 21 | +| 17.18 GB | 2.28 GB | 22 | +| 34.36 GB | 5.87 GB | 23 | +| 68.72 GB | 13.86 GB | 24 | +| 137.44 GB | 31.08 GB | 25 | +| 274.88 GB | 67.15 GB | 26 | +| 549.76 GB | 140.40 GB | 27 | +| 1.10 TB | 292.67 GB | 28 | +| 2.20 TB | 602.12 GB | 29 | +| 4.40 TB | 1.23 TB | 30 | +| 8.80 TB | 2.49 TB | 31 | +| 17.59 TB | 5.03 TB | 32 | +| 35.18 TB | 10.12 TB | 33 | +| 70.37 TB | 20.34 TB | 34 | +| 140.74 TB | 40.80 TB | 35 | +| 281.47 TB | 81.80 TB | 36 | +| 562.95 TB | 163.87 TB | 37 | +| 1.13 PB | 328.11 TB | 38 | +| 2.25 PB | 656.76 TB | 39 | +| 4.50 PB | 1.31 PB | 40 | +| 9.01 PB | 2.63 PB | 41 | \ No newline at end of file diff --git a/docs/develop/tools-and-features/buy-a-stamp-batch.md b/docs/develop/tools-and-features/buy-a-stamp-batch.md index b59541fed..be51797c9 100644 --- a/docs/develop/tools-and-features/buy-a-stamp-batch.md +++ b/docs/develop/tools-and-features/buy-a-stamp-batch.md @@ -20,7 +20,7 @@ A postage batch is required to upload data to Swarm. Postage stamp batches repre **Storage volume and `depth`:** - When purchasing stamp batches for larger volumes of data (by increasing the `depth` value), the amount of data which can be stored becomes increasingly more predictable. For example, at `depth` 22 a batch can store between 4.93 GB and 17.18 GB, while at `depth` 28, a batch can store between 1.0 and 1.1 TB of data, and at higher depths the difference between the minimum and maximum storage volumes approach the same value. + When purchasing stamp batches for larger volumes of data (by increasing the `depth` value), the amount of data which can be stored becomes increasingly more predictable. For example, at `depth` 22 a batch can store between 2.28 GB (encrypted, paranoid erasure coding) and 17.18 GB (theoretical max), while at `depth` 28, a batch can store between 292.67 GB and 1.1 TB of data, and at higher depths the difference between the minimum and maximum storage volumes approach the same value. The effective volume also depends on the encryption and erasure coding settings used. See the [effective utilisation tables](./../../concepts/incentives/postage-stamps.md#effective-utilisation-tables) for the full details. **Storage duration and `amount`:** @@ -158,7 +158,7 @@ Depending on the use case, uploaders may desire to use mutable or immutable batc The following postage batch calculators allow you to conveniently find the depth and amount values for a given storage duration and storage volume, or to find the storage duration and storage volume for a given depth and amount. The results will display the cost in xBZZ for the postage batch. The current pricing information is sourced from the Swarmscan API and will vary over time. :::info -The 'effective volume' is the volume of data that can safely stored for each storage depth. The 'theoretical max volume' is significantly lower than the effective volume at lower depths and the two values trend towards the same value at higher depths. The lowest depth with an effective volume above zero is 22, with an effective depth of 4.93 GB. Lower depth values can be used for smaller uploads but do not come with the same storage guarantees. [Learn more here](./../../concepts/incentives/postage-stamps.md#effective-utilisation-tables). +The 'effective volume' is the volume of data that can be safely stored for each batch depth, with a failure rate of less than 0.1%. The 'theoretical max volume' is significantly higher than the effective volume at lower depths, and the two values trend towards the same value at higher depths. Effective volumes are available for all depths from 17 to 41, and depend on the encryption and erasure coding settings selected. For example, at depth 17, the effective volume ranges from 13.17 kB (encrypted, paranoid) to 44.70 kB (unencrypted, no erasure coding). [Learn more here](./../../concepts/incentives/postage-stamps.md#effective-utilisation-tables). ::: ### Depth & Amount to Time & Volume Calculator diff --git a/src/components.zip b/src/components.zip deleted file mode 100644 index 9e860f5c0..000000000 Binary files a/src/components.zip and /dev/null differ diff --git a/src/components/AmountAndDepthCalc.js b/src/components/AmountAndDepthCalc.js index e04910ab9..479efc2ad 100644 --- a/src/components/AmountAndDepthCalc.js +++ b/src/components/AmountAndDepthCalc.js @@ -6,6 +6,8 @@ function FetchPriceComponent() { const [timeUnit, setTimeUnit] = useState('hours'); const [volume, setVolume] = useState(''); const [volumeUnit, setVolumeUnit] = useState('GB'); + const [isEncrypted, setIsEncrypted] = useState(false); + const [erasureLevel, setErasureLevel] = useState('none'); const [convertedTime, setConvertedTime] = useState(null); const [minimumDepth, setMinimumDepth] = useState(null); const [depth, setDepth] = useState(null); @@ -16,53 +18,303 @@ function FetchPriceComponent() { const [timeError, setTimeError] = useState(''); const [volumeError, setVolumeError] = useState(''); - // Volume in GB - const volumeToDepth = { - "4.93" : 22, - "17.03": 23, - "44.21": 24, - "102.78": 25, - "225.86": 26, - "480.43": 27, - "1024.00": 28, - "2109.44": 29, - "4300.80": 30, - "8724.48": 31, - "17612.80": 32, - "35461.12": 33, - "71249.92": 34, - "142981.12": 35, - "286627.84": 36, - "574187.52": 37, - "1174405.12": 38, - "2359296.00": 39, - "4718592.00": 40, - "9437184.00": 41 + // Effective volume tables from Gyuri's simulations (ν=16, logBucketSize 1-25, i.e. depth 17-41) + // These account for batch utilization (0.1% failure quantile), PAC overhead, and erasure coding overhead. + // label: human-readable effective volume, gb: value in GB for comparison + const depthToEffectiveVolume = { + unencrypted: { + none: { + 17: { label: "44.70 kB", gb: 0.000043 }, + 18: { label: "6.66 MB", gb: 0.006504 }, + 19: { label: "112.06 MB", gb: 0.109434 }, + 20: { label: "687.62 MB", gb: 0.671504 }, + 21: { label: "2.60 GB", gb: 2.60 }, + 22: { label: "7.73 GB", gb: 7.73 }, + 23: { label: "19.94 GB", gb: 19.94 }, + 24: { label: "47.06 GB", gb: 47.06 }, + 25: { label: "105.51 GB", gb: 105.51 }, + 26: { label: "227.98 GB", gb: 227.98 }, + 27: { label: "476.68 GB", gb: 476.68 }, + 28: { label: "993.65 GB", gb: 993.65 }, + 29: { label: "2.04 TB", gb: 2088.96 }, + 30: { label: "4.17 TB", gb: 4270.08 }, + 31: { label: "8.45 TB", gb: 8652.80 }, + 32: { label: "17.07 TB", gb: 17479.68 }, + 33: { label: "34.36 TB", gb: 35184.64 }, + 34: { label: "69.04 TB", gb: 70696.96 }, + 35: { label: "138.54 TB", gb: 141864.96 }, + 36: { label: "277.72 TB", gb: 284385.28 }, + 37: { label: "556.35 TB", gb: 569702.40 }, + 38: { label: "1.11 PB", gb: 1163919.36 }, + 39: { label: "2.23 PB", gb: 2338324.48 }, + 40: { label: "4.46 PB", gb: 4676648.96 }, + 41: { label: "8.93 PB", gb: 9363783.68 }, + }, + medium: { + 17: { label: "41.56 kB", gb: 0.000040 }, + 18: { label: "6.19 MB", gb: 0.006045 }, + 19: { label: "104.18 MB", gb: 0.101738 }, + 20: { label: "639.27 MB", gb: 0.624287 }, + 21: { label: "2.41 GB", gb: 2.41 }, + 22: { label: "7.18 GB", gb: 7.18 }, + 23: { label: "18.54 GB", gb: 18.54 }, + 24: { label: "43.75 GB", gb: 43.75 }, + 25: { label: "98.09 GB", gb: 98.09 }, + 26: { label: "211.95 GB", gb: 211.95 }, + 27: { label: "443.16 GB", gb: 443.16 }, + 28: { label: "923.78 GB", gb: 923.78 }, + 29: { label: "1.90 TB", gb: 1945.60 }, + 30: { label: "3.88 TB", gb: 3973.12 }, + 31: { label: "7.86 TB", gb: 8048.64 }, + 32: { label: "15.87 TB", gb: 16250.88 }, + 33: { label: "31.94 TB", gb: 32706.56 }, + 34: { label: "64.19 TB", gb: 65730.56 }, + 35: { label: "128.80 TB", gb: 131891.20 }, + 36: { label: "258.19 TB", gb: 264386.56 }, + 37: { label: "517.23 TB", gb: 529643.52 }, + 38: { label: "1.04 PB", gb: 1090519.04 }, + 39: { label: "2.07 PB", gb: 2170552.32 }, + 40: { label: "4.15 PB", gb: 4351590.40 }, + 41: { label: "8.30 PB", gb: 8703180.80 }, + }, + strong: { + 17: { label: "37.37 kB", gb: 0.000036 }, + 18: { label: "5.57 MB", gb: 0.005439 }, + 19: { label: "93.68 MB", gb: 0.091484 }, + 20: { label: "574.81 MB", gb: 0.561338 }, + 21: { label: "2.17 GB", gb: 2.17 }, + 22: { label: "6.46 GB", gb: 6.46 }, + 23: { label: "16.67 GB", gb: 16.67 }, + 24: { label: "39.34 GB", gb: 39.34 }, + 25: { label: "88.20 GB", gb: 88.20 }, + 26: { label: "190.58 GB", gb: 190.58 }, + 27: { label: "398.47 GB", gb: 398.47 }, + 28: { label: "830.63 GB", gb: 830.63 }, + 29: { label: "1.71 TB", gb: 1751.04 }, + 30: { label: "3.49 TB", gb: 3573.76 }, + 31: { label: "7.07 TB", gb: 7239.68 }, + 32: { label: "14.27 TB", gb: 14612.48 }, + 33: { label: "28.72 TB", gb: 29409.28 }, + 34: { label: "57.71 TB", gb: 59095.04 }, + 35: { label: "115.81 TB", gb: 118589.44 }, + 36: { label: "232.16 TB", gb: 237731.84 }, + 37: { label: "465.07 TB", gb: 476231.68 }, + 38: { label: "931.23 TB", gb: 953579.52 }, + 39: { label: "1.86 PB", gb: 1950351.36 }, + 40: { label: "3.73 PB", gb: 3911188.48 }, + 41: { label: "7.46 PB", gb: 7822376.96 }, + }, + insane: { + 17: { label: "33.88 kB", gb: 0.000032 }, + 18: { label: "5.05 MB", gb: 0.004932 }, + 19: { label: "84.92 MB", gb: 0.082930 }, + 20: { label: "521.09 MB", gb: 0.508877 }, + 21: { label: "1.97 GB", gb: 1.97 }, + 22: { label: "5.86 GB", gb: 5.86 }, + 23: { label: "15.11 GB", gb: 15.11 }, + 24: { label: "35.66 GB", gb: 35.66 }, + 25: { label: "79.96 GB", gb: 79.96 }, + 26: { label: "172.77 GB", gb: 172.77 }, + 27: { label: "361.23 GB", gb: 361.23 }, + 28: { label: "753.00 GB", gb: 753.00 }, + 29: { label: "1.55 TB", gb: 1587.20 }, + 30: { label: "3.16 TB", gb: 3235.84 }, + 31: { label: "6.41 TB", gb: 6563.84 }, + 32: { label: "12.93 TB", gb: 13240.32 }, + 33: { label: "26.04 TB", gb: 26664.96 }, + 34: { label: "52.32 TB", gb: 53575.68 }, + 35: { label: "104.99 TB", gb: 107509.76 }, + 36: { label: "210.46 TB", gb: 215511.04 }, + 37: { label: "421.61 TB", gb: 431728.64 }, + 38: { label: "844.20 TB", gb: 864460.80 }, + 39: { label: "1.69 PB", gb: 1772093.44 }, + 40: { label: "3.38 PB", gb: 3544186.88 }, + 41: { label: "6.77 PB", gb: 7098859.52 }, + }, + paranoid: { + 17: { label: "13.27 kB", gb: 0.000013 }, + 18: { label: "1.98 MB", gb: 0.001934 }, + 19: { label: "33.27 MB", gb: 0.032490 }, + 20: { label: "204.14 MB", gb: 0.199355 }, + 21: { label: "771.13 MB", gb: 0.753057 }, + 22: { label: "2.29 GB", gb: 2.29 }, + 23: { label: "5.92 GB", gb: 5.92 }, + 24: { label: "13.97 GB", gb: 13.97 }, + 25: { label: "31.32 GB", gb: 31.32 }, + 26: { label: "67.68 GB", gb: 67.68 }, + 27: { label: "141.51 GB", gb: 141.51 }, + 28: { label: "294.99 GB", gb: 294.99 }, + 29: { label: "606.90 GB", gb: 606.90 }, + 30: { label: "1.24 TB", gb: 1269.76 }, + 31: { label: "2.51 TB", gb: 2570.24 }, + 32: { label: "5.07 TB", gb: 5191.68 }, + 33: { label: "10.20 TB", gb: 10444.80 }, + 34: { label: "20.50 TB", gb: 20992.00 }, + 35: { label: "41.13 TB", gb: 42117.12 }, + 36: { label: "82.45 TB", gb: 84428.80 }, + 37: { label: "165.17 TB", gb: 169134.08 }, + 38: { label: "330.72 TB", gb: 338657.28 }, + 39: { label: "661.97 TB", gb: 677857.28 }, + 40: { label: "1.32 PB", gb: 1384120.32 }, + 41: { label: "2.65 PB", gb: 2778726.40 }, + }, + }, + encrypted: { + none: { + 17: { label: "44.35 kB", gb: 0.000042 }, + 18: { label: "6.61 MB", gb: 0.006455 }, + 19: { label: "111.18 MB", gb: 0.108574 }, + 20: { label: "682.21 MB", gb: 0.666221 }, + 21: { label: "2.58 GB", gb: 2.58 }, + 22: { label: "7.67 GB", gb: 7.67 }, + 23: { label: "19.78 GB", gb: 19.78 }, + 24: { label: "46.69 GB", gb: 46.69 }, + 25: { label: "104.68 GB", gb: 104.68 }, + 26: { label: "226.19 GB", gb: 226.19 }, + 27: { label: "472.93 GB", gb: 472.93 }, + 28: { label: "985.83 GB", gb: 985.83 }, + 29: { label: "2.03 TB", gb: 2078.72 }, + 30: { label: "4.14 TB", gb: 4239.36 }, + 31: { label: "8.39 TB", gb: 8591.36 }, + 32: { label: "16.93 TB", gb: 17336.32 }, + 33: { label: "34.09 TB", gb: 34908.16 }, + 34: { label: "68.50 TB", gb: 70144.00 }, + 35: { label: "137.45 TB", gb: 140748.80 }, + 36: { label: "275.53 TB", gb: 282142.72 }, + 37: { label: "551.97 TB", gb: 565217.28 }, + 38: { label: "1.11 PB", gb: 1163919.36 }, + 39: { label: "2.21 PB", gb: 2317352.96 }, + 40: { label: "4.43 PB", gb: 4645191.68 }, + 41: { label: "8.86 PB", gb: 9290383.36 }, + }, + medium: { + 17: { label: "40.89 kB", gb: 0.000039 }, + 18: { label: "6.09 MB", gb: 0.005947 }, + 19: { label: "102.49 MB", gb: 0.100088 }, + 20: { label: "628.91 MB", gb: 0.614170 }, + 21: { label: "2.38 GB", gb: 2.38 }, + 22: { label: "7.07 GB", gb: 7.07 }, + 23: { label: "18.24 GB", gb: 18.24 }, + 24: { label: "43.04 GB", gb: 43.04 }, + 25: { label: "96.50 GB", gb: 96.50 }, + 26: { label: "208.52 GB", gb: 208.52 }, + 27: { label: "435.98 GB", gb: 435.98 }, + 28: { label: "908.81 GB", gb: 908.81 }, + 29: { label: "1.87 TB", gb: 1914.88 }, + 30: { label: "3.81 TB", gb: 3901.44 }, + 31: { label: "7.73 TB", gb: 7915.52 }, + 32: { label: "15.61 TB", gb: 15984.64 }, + 33: { label: "31.43 TB", gb: 32184.32 }, + 34: { label: "63.15 TB", gb: 64665.60 }, + 35: { label: "126.71 TB", gb: 129751.04 }, + 36: { label: "254.01 TB", gb: 260106.24 }, + 37: { label: "508.85 TB", gb: 521062.40 }, + 38: { label: "1.02 PB", gb: 1069547.52 }, + 39: { label: "2.04 PB", gb: 2139095.04 }, + 40: { label: "4.08 PB", gb: 4278190.08 }, + 41: { label: "8.17 PB", gb: 8566865.92 }, + }, + strong: { + 17: { label: "36.73 kB", gb: 0.000035 }, + 18: { label: "5.47 MB", gb: 0.005342 }, + 19: { label: "92.07 MB", gb: 0.089912 }, + 20: { label: "564.95 MB", gb: 0.551709 }, + 21: { label: "2.13 GB", gb: 2.13 }, + 22: { label: "6.35 GB", gb: 6.35 }, + 23: { label: "16.38 GB", gb: 16.38 }, + 24: { label: "38.66 GB", gb: 38.66 }, + 25: { label: "86.69 GB", gb: 86.69 }, + 26: { label: "187.31 GB", gb: 187.31 }, + 27: { label: "391.64 GB", gb: 391.64 }, + 28: { label: "816.39 GB", gb: 816.39 }, + 29: { label: "1.68 TB", gb: 1720.32 }, + 30: { label: "3.43 TB", gb: 3512.32 }, + 31: { label: "6.94 TB", gb: 7106.56 }, + 32: { label: "14.02 TB", gb: 14356.48 }, + 33: { label: "28.23 TB", gb: 28907.52 }, + 34: { label: "56.72 TB", gb: 58081.28 }, + 35: { label: "113.82 TB", gb: 116551.68 }, + 36: { label: "228.18 TB", gb: 233656.32 }, + 37: { label: "457.10 TB", gb: 468070.40 }, + 38: { label: "915.26 TB", gb: 937226.24 }, + 39: { label: "1.83 PB", gb: 1918894.08 }, + 40: { label: "3.67 PB", gb: 3848273.92 }, + 41: { label: "7.34 PB", gb: 7696547.84 }, + }, + insane: { + 17: { label: "33.26 kB", gb: 0.000032 }, + 18: { label: "4.96 MB", gb: 0.004844 }, + 19: { label: "83.38 MB", gb: 0.081426 }, + 20: { label: "511.65 MB", gb: 0.499658 }, + 21: { label: "1.93 GB", gb: 1.93 }, + 22: { label: "5.75 GB", gb: 5.75 }, + 23: { label: "14.84 GB", gb: 14.84 }, + 24: { label: "35.02 GB", gb: 35.02 }, + 25: { label: "78.51 GB", gb: 78.51 }, + 26: { label: "169.64 GB", gb: 169.64 }, + 27: { label: "354.69 GB", gb: 354.69 }, + 28: { label: "739.37 GB", gb: 739.37 }, + 29: { label: "1.52 TB", gb: 1556.48 }, + 30: { label: "3.10 TB", gb: 3174.40 }, + 31: { label: "6.29 TB", gb: 6440.96 }, + 32: { label: "12.70 TB", gb: 13004.80 }, + 33: { label: "25.57 TB", gb: 26183.68 }, + 34: { label: "51.37 TB", gb: 52602.88 }, + 35: { label: "103.08 TB", gb: 105553.92 }, + 36: { label: "206.65 TB", gb: 211609.60 }, + 37: { label: "413.98 TB", gb: 423915.52 }, + 38: { label: "828.91 TB", gb: 848803.84 }, + 39: { label: "1.66 PB", gb: 1740636.16 }, + 40: { label: "3.32 PB", gb: 3481272.32 }, + 41: { label: "6.64 PB", gb: 6962544.64 }, + }, + paranoid: { + 17: { label: "13.17 kB", gb: 0.000013 }, + 18: { label: "1.96 MB", gb: 0.001914 }, + 19: { label: "33.01 MB", gb: 0.032236 }, + 20: { label: "202.53 MB", gb: 0.197783 }, + 21: { label: "765.05 MB", gb: 0.747119 }, + 22: { label: "2.28 GB", gb: 2.28 }, + 23: { label: "5.87 GB", gb: 5.87 }, + 24: { label: "13.86 GB", gb: 13.86 }, + 25: { label: "31.08 GB", gb: 31.08 }, + 26: { label: "67.15 GB", gb: 67.15 }, + 27: { label: "140.40 GB", gb: 140.40 }, + 28: { label: "292.67 GB", gb: 292.67 }, + 29: { label: "602.12 GB", gb: 602.12 }, + 30: { label: "1.23 TB", gb: 1259.52 }, + 31: { label: "2.49 TB", gb: 2549.76 }, + 32: { label: "5.03 TB", gb: 5150.72 }, + 33: { label: "10.12 TB", gb: 10362.88 }, + 34: { label: "20.34 TB", gb: 20828.16 }, + 35: { label: "40.80 TB", gb: 41779.20 }, + 36: { label: "81.80 TB", gb: 83763.20 }, + 37: { label: "163.87 TB", gb: 167802.88 }, + 38: { label: "328.11 TB", gb: 335984.64 }, + 39: { label: "656.76 TB", gb: 672522.24 }, + 40: { label: "1.31 PB", gb: 1373634.56 }, + 41: { label: "2.63 PB", gb: 2757754.88 }, + }, + }, }; - const depthToVolume = { - 22: "4.93 GB", - 23: "17.03 GB", - 24: "44.21 GB", - 25: "102.78 GB", - 26: "225.86 GB", - 27: "480.43 GB", - 28: "1.00 TB", - 29: "2.06 TB", - 30: "4.20 TB", - 31: "8.52 TB", - 32: "17.20 TB", - 33: "34.63 TB", - 34: "69.58 TB", - 35: "139.63 TB", - 36: "279.91 TB", - 37: "560.73 TB", - 38: "1.12 PB", - 39: "2.25 PB", - 40: "4.50 PB", - 41: "9.00 PB", - }; + function formatBytes(bytes) { + const KB = 1000; + const MB = KB ** 2; + const GB = KB ** 3; + const TB = KB ** 4; + const PB = KB ** 5; + if (bytes < GB) { + return (bytes / MB).toFixed(2) + ' MB'; + } else if (bytes < TB) { + return (bytes / GB).toFixed(2) + ' GB'; + } else if (bytes < PB) { + return (bytes / TB).toFixed(2) + ' TB'; + } else { + return (bytes / PB).toFixed(2) + ' PB'; + } + } useEffect(() => { fetchPrice(); @@ -75,7 +327,7 @@ function FetchPriceComponent() { if (minimumDepth !== null && amount !== null) { calculateMinimumDepthStorageCost(); } - }, [depth, amount, minimumDepth]); + }, [depth, amount, minimumDepth]); const fetchPrice = async () => { try { @@ -92,6 +344,10 @@ function FetchPriceComponent() { } }; + const getEffectiveVolumeTable = () => { + const encKey = isEncrypted ? 'encrypted' : 'unencrypted'; + return depthToEffectiveVolume[encKey][erasureLevel]; + }; const handleCalculate = () => { if (!price) { @@ -102,53 +358,63 @@ function FetchPriceComponent() { setShowResults(false); setTimeError(''); setVolumeError(''); - + const hours = convertTimeToHours(time, timeUnit); const gigabytes = convertVolumeToGB(volume, volumeUnit); - - if (!hours || !gigabytes) return; - + + if (!hours || !gigabytes) return; + setConvertedTime(hours); - calculateDepth(gigabytes); - setMinimumDepth(calculateMinimumDepth(gigabytes)); - calculateAmount(hours * 3600 / 5); - setShowResults(true); - }; - + const table = getEffectiveVolumeTable(); + + // Find the smallest depth whose effective volume (in GB) >= requested volume + let foundDepth = null; + for (let d = 17; d <= 41; d++) { + if (table[d] && table[d].gb >= gigabytes) { + foundDepth = d; + break; + } + } - const calculateDepth = (gigabytes) => { - const keys = Object.keys(volumeToDepth).map(key => parseFloat(key)).sort((a, b) => a - b); - let foundKey = keys.find(key => key >= gigabytes); - setDepth(foundKey ? volumeToDepth[foundKey.toFixed(2)] : 'No suitable depth found'); + if (!foundDepth) { + setVolumeError('Requested volume exceeds maximum available effective volume for the selected settings.'); + return; + } + + setDepth(foundDepth); + + // Minimum depth: based on theoretical max volume (2^(depth+12) bytes), ignoring utilization + const minDepth = calculateMinimumDepth(gigabytes); + setMinimumDepth(minDepth); + + // Amount: blocks * price + const blocks = hours * 3600 / 5; + const totalAmount = blocks * price; + setAmount(totalAmount); + + setShowResults(true); }; const calculateMinimumDepth = (gigabytes) => { - for (let depth = 17; depth <= 41; depth++) { - if (gigabytes <= Math.pow(2, 12 + depth) / (1024 ** 3)) { - return depth; + for (let d = 17; d <= 41; d++) { + if (gigabytes <= Math.pow(2, 12 + d) / (1024 ** 3)) { + return d; } } return null; }; - const calculateAmount = (blocks) => { - if (price !== null) { - const totalAmount = blocks * price; - setAmount(totalAmount); - } - }; - const calculateStorageCost = () => { if (depth !== null && amount !== null) { - const cost = ((2**depth) * amount) / 1e16; + const cost = ((2 ** depth) * amount) / 1e16; setStorageCost(cost.toFixed(4)); } }; const calculateMinimumDepthStorageCost = () => { if (minimumDepth !== null && amount !== null) { - const cost = ((2**minimumDepth) * amount) / 1e16; + const cost = ((2 ** minimumDepth) * amount) / 1e16; setMinimumDepthStorageCost(cost.toFixed(4)); } }; @@ -166,7 +432,6 @@ function FetchPriceComponent() { } return hours; }; - const convertVolumeToGB = (volume, unit) => { const num = parseFloat(volume); @@ -174,118 +439,173 @@ function FetchPriceComponent() { setVolumeError('Volume must be a positive number.'); return 0; } - const gigabytes = num * (unit === 'TB' ? 1024 : unit === 'PB' ? 1048576 : unit === 'MB' ? 1/1024 : 1); - if (gigabytes <= 0 || gigabytes > 9437184) { - setVolumeError('Volume must be greater than 0 and less than 9 PB.'); + const gigabytes = num * (unit === 'TB' ? 1024 : unit === 'PB' ? 1048576 : unit === 'MB' ? 1 / 1024 : unit === 'kB' ? 1 / (1024 * 1024) : 1); + if (gigabytes <= 0) { + setVolumeError('Volume must be greater than 0.'); + return 0; + } + + // Check against max effective volume for the selected settings + const table = getEffectiveVolumeTable(); + const maxGb = table[41].gb; + if (gigabytes > maxGb) { + setVolumeError(`Volume exceeds maximum effective volume (${table[41].label}) for the selected encryption and erasure settings.`); return 0; } return gigabytes; }; - - + + const getEffectiveVolumeLabel = (d) => { + const table = getEffectiveVolumeTable(); + return table[d] ? table[d].label : "N/A"; + }; + + const erasureLevelLabels = { + none: "None", + medium: "Medium", + strong: "Strong", + insane: "Insane", + paranoid: "Paranoid", + }; return ( -
{timeError}
}{volumeError}
} +{volumeError}
} -| Field | +Value | +
|---|---|
| Time | +{convertedTime} hours | +
| Volume | +{`${volume} ${volumeUnit}`} | +
| Encryption | +{isEncrypted ? 'Yes' : 'No'} | +
| Erasure Coding | +{erasureLevelLabels[erasureLevel]} | +
| Suggested Minimum Amount | +{amount + 10} PLUR | +
| Suggested Safe Depth | +{`${depth} (for an `}effective volume{` of ${getEffectiveVolumeLabel(depth)})`} | +
| Suggested Minimum Depth | +{minimumDepth} (see batch utilisation - may require dilution) | +
| Batch Cost for Safe Depth | +{storageCost} xBZZ | +
| Batch Cost for Minimum Depth | +{minimumDepthStorageCost} xBZZ | +
| Field | -Value | -
|---|---|
| Time | -{convertedTime} hours | -
| Volume | -{`${volume} ${volumeUnit}`} | -
| Suggested Minimum Amount | -{amount +10} PLUR | -
| Suggested Safe Depth | -{`${depth} (for an `}effective volume{` of ${depthToVolume[depth]})`} | -
| Suggested Minimum Depth | -{minimumDepth} (see batch utilisation - may require dilution) | -
| Batch Cost for Safe Depth | -{storageCost} xBZZ | -
| Batch Cost for Minimum Depth | -{minimumDepthStorageCost} xBZZ | -