Skip to content

Commit

Permalink
Update crustbags
Browse files Browse the repository at this point in the history
  • Loading branch information
gavfu committed Aug 19, 2024
1 parent a6746cb commit e78cce5
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 50 deletions.
Binary file added docs/assets/build/crustbags-user-flow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/assets/build/tonbags-user-flow.png
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/ton-applications.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sidebar_label: TON applications

## I. Telegram Mini Apps

We have built a [Telegram Mini Apps](https://core.telegram.org/bots/webapps) for users to directly upload and store files to TONBags in telegram.
We have built a [Telegram Mini Apps](https://core.telegram.org/bots/webapps) for users to directly upload and store files to CrustBags in telegram.

1. In telegram, search and add TonBagsBot(Test)

Expand Down
22 changes: 11 additions & 11 deletions docs/ton-build-101.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sidebar_label: Build With TON 101

## I. Description

This article will describe how to use TON storage smart contract to place order.
This article will describe how to use CrustBags storage smart contract to place order.

## II. Storage smart contract

Expand All @@ -15,37 +15,37 @@ This article will describe how to use TON storage smart contract to place order.

## III. SDK & Example

Developers could use [tonbags-sdk](https://www.npmjs.com/package/@crustnetwork/tonbags-sdk) to place storage orders.
Developers could use [crustbags-sdk](https://www.npmjs.com/package/@crustnetwork/crustbags-sdk) to place storage orders.

**Installation**

```sh
$ npm install @crustnetwork/tonbags-sdk @ton/ton @ton/core @ton/crypto
$ npm install @crustnetwork/crustbags-sdk @ton/ton @ton/core @ton/crypto
```

**Usage**

```javascript
import tonbagssdk from '@crustnetwork/tonbags-sdk'
import { default_storage_period } from "@crustnetwork/tonbags-sdk/src/TonBags";
import crustbagssdk from '@crustnetwork/crustbags-sdk'
import { default_storage_period } from "@crustnetwork/crustbags-sdk/src/CrustBags";
import { Address, toNano } from "@ton/core";
import { mnemonicToPrivateKey } from "@ton/crypto";
import { TonClient, WalletContractV4 } from "@ton/ton";

const tc = new TonClient({
endpoint: "https://testnet.toncenter.com/api/v2/jsonRPC",
});
const tonbagsAddress = Address.parse(
const crustbagsAddress = Address.parse(
"EQBOOMNqG0rvNm6vFGfR4qZl48BTDw_gYefVI4DQ70t9GoPC"
);
const tonBags = tonbagssdk.TonBags.createFromAddress(tonbagsAddress);
const crustBags = crustbagssdk.CrustBags.createFromAddress(crustbagsAddress);

const openTonBags = tc.open(tonBags);
const openCrustBags = tc.open(crustBags);
const keyPair = await mnemonicToPrivateKey(["your", "mnemonic"]);
const wallet = tc.open(
WalletContractV4.create({ workchain: 0, publicKey: keyPair.publicKey })
);
await openTonBags.sendPlaceStorageOrder(
await openCrustBags.sendPlaceStorageOrder(
wallet.sender(keyPair.secretKey),
tonrrentHash, // torrentHash or bagId
1024n, // fileSize
Expand All @@ -55,10 +55,10 @@ await openTonBags.sendPlaceStorageOrder(
);
```

Before placing order, the file need be encoded into a merkle tree, and the root hash need be passed to TONBag storage contract. Below is the code example:
Before placing order, the file need be encoded into a merkle tree, and the root hash need be passed to CrustBags storage contract. Below is the code example:

```javascript
import { merkle } from '@crustnetwork/tonbags-sdk'
import { merkle } from '@crustnetwork/crustbags-sdk'

const readAsBlob = async (file: string) => {
return new Promise<Blob>((resolve, reject) => {
Expand Down
26 changes: 13 additions & 13 deletions docs/ton-build-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,39 @@ title: Overview
sidebar_label: Overview
---

## I. Crust Network TONBags storage
## I. CrustBags storage

Crust Network stands as one of the world’s largest decentralized storage networks. Over the past two years, we’ve successfully launched our Mainnet, boasting an impressive 600PB of storage across 1500+ nodes. Our network has facilitated storage for over 2 million orders, serving a diverse user base of 100,000+ individuals and establishing partnerships with more than 150 businesses. To further enhance Crust Network’s storage capabilities, we’ve already developed storage protocols for both the EVM and Algorand ecosystems.


**Introducing TONBags: On-Chain TONStorage Marketplace**
**Introducing CrustBags: On-Chain TONStorage Marketplace**

TONStorage is a fundamental component of the TON ecosystem. It enables users to store and distribute files of any size on a decentralized TON network. While it’s currently open and available for use, there are some limitations. Specifically, TONStorage users must manually identify reliable storage providers and create redundancy strategies to ensure better availability and failover. This process can be cumbersome.

Enter TONBags—an innovative solution. TONBags serves as an on-chain marketplace, simplifying storage discovery for users. With TONBags, everyone gains direct and effective access to TONStorage, making decentralized storage more accessible and user-friendly.
Enter CrustBags —an innovative solution. CrustBags serves as an on-chain marketplace, simplifying storage discovery for users. With CrustBags, everyone gains direct and effective access to TONStorage, making decentralized storage more accessible and user-friendly.

## II. TONBags storage protocol
## II. CrustBags storage protocol

### User flow

TONBags provides a unified storage interface via TONBags storage contract. And storage providers are incentivized to participate in the TON network by leveraging the [TON storage daemon](https://docs.ton.org/participate/ton-storage/storage-daemon).
CrustBags provides a unified storage interface via CrustBags storage contract. And storage providers are incentivized to participate in the TON network by leveraging the [TON storage daemon](https://docs.ton.org/participate/ton-storage/storage-daemon).

The user flow within TONBags is straightforward:
The user flow within CrustBags is straightforward:

1. Users call the TONBags storage contract, and pay a storage fee in $TON to place storage orders for their TONStorage files (referred to as bags).
2. Storage providers monitor these orders and store replicas of the files. To receive storage fees, providers periodically submit work reports (also known as storage proofs) to the TONBags storage contract.
1. Users call the CrustBags storage contract, and pay a storage fee in $TON to place storage orders for their TONStorage files (referred to as bags).
2. Storage providers monitor these orders and store replicas of the files. To receive storage fees, providers periodically submit work reports (also known as storage proofs) to the CrustBags storage contract.

![Pic](assets/build/tonbags-user-flow.png)
![Pic](assets/build/crustbags-user-flow.png)


### TONBags storage contract
### CrustBags storage contract

[TONBags storage contract](https://github.com/crustio/tonbags-contract) is a suite of open-source TON smart contracts developed and deployed by Crust Network. It provides interface for users to place storage orders for their files (*bags*), and for storage providers to monitor and discover orders for storage. It also consists of a Work Report Verifier to verify ZK storage proofs submitted by storage providers, and a Reward Pool to distribute storage fees to storage providers in a linearly and fairly manner.
[CrustBags storage contract](https://github.com/crustio/crustbags-contract) is a suite of open-source TON smart contracts developed and deployed by Crust Network. It provides interface for users to place storage orders for their files (*bags*), and for storage providers to monitor and discover orders for storage. It also consists of a Work Report Verifier to verify ZK storage proofs submitted by storage providers, and a Reward Pool to distribute storage fees to storage providers in a linearly and fairly manner.

![Pic](assets/build/tonbags-smart-contract.png)
![Pic](assets/build/crustbags-smart-contract.png)

### Storage providers

To participate as storage providers:
- Run the [TONBags manager](https://github.com/crustio/tonbags-manager) to handle storage orders and submit work reports.
- Run the [CrustBags manager](https://github.com/crustio/crustbags-manager) to handle storage orders and submit work reports.
- Maintain a local [TON storage daemon](https://docs.ton.org/participate/ton-storage/storage-daemon) node for efficient data propagation across the TON network.
2 changes: 1 addition & 1 deletion website/translated_docs/zh-CN/ton-applications.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sidebar_label: TON applications

## I. Telegram Mini Apps

We have built a [Telegram Mini Apps](https://core.telegram.org/bots/webapps) for users to directly upload and store files to TONBags in telegram.
We have built a [Telegram Mini Apps](https://core.telegram.org/bots/webapps) for users to directly upload and store files to CrustBags in telegram.

1. In telegram, search and add TonBagsBot(Test)

Expand Down
22 changes: 11 additions & 11 deletions website/translated_docs/zh-CN/ton-build-101.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sidebar_label: Build With TON 101

## I. Description

This article will describe how to use TON storage smart contract to place order.
This article will describe how to use CrustBags storage smart contract to place order.

## II. Storage smart contract

Expand All @@ -15,37 +15,37 @@ This article will describe how to use TON storage smart contract to place order.

## III. SDK & Example

Developers could use [tonbags-sdk](https://www.npmjs.com/package/@crustnetwork/tonbags-sdk) to place storage orders.
Developers could use [crustbags-sdk](https://www.npmjs.com/package/@crustnetwork/crustbags-sdk) to place storage orders.

**Installation**

```sh
$ npm install @crustnetwork/tonbags-sdk @ton/ton @ton/core @ton/crypto
$ npm install @crustnetwork/crustbags-sdk @ton/ton @ton/core @ton/crypto
```

**Usage**

```javascript
import tonbagssdk from '@crustnetwork/tonbags-sdk'
import { default_storage_period } from "@crustnetwork/tonbags-sdk/src/TonBags";
import crustbagssdk from '@crustnetwork/crustbags-sdk'
import { default_storage_period } from "@crustnetwork/crustbags-sdk/src/CrustBags";
import { Address, toNano } from "@ton/core";
import { mnemonicToPrivateKey } from "@ton/crypto";
import { TonClient, WalletContractV4 } from "@ton/ton";

const tc = new TonClient({
endpoint: "https://testnet.toncenter.com/api/v2/jsonRPC",
});
const tonbagsAddress = Address.parse(
const crustbagsAddress = Address.parse(
"EQBOOMNqG0rvNm6vFGfR4qZl48BTDw_gYefVI4DQ70t9GoPC"
);
const tonBags = tonbagssdk.TonBags.createFromAddress(tonbagsAddress);
const crustBags = crustbagssdk.CrustBags.createFromAddress(crustbagsAddress);

const openTonBags = tc.open(tonBags);
const openCrustBags = tc.open(crustBags);
const keyPair = await mnemonicToPrivateKey(["your", "mnemonic"]);
const wallet = tc.open(
WalletContractV4.create({ workchain: 0, publicKey: keyPair.publicKey })
);
await openTonBags.sendPlaceStorageOrder(
await openCrustBags.sendPlaceStorageOrder(
wallet.sender(keyPair.secretKey),
tonrrentHash, // torrentHash or bagId
1024n, // fileSize
Expand All @@ -55,10 +55,10 @@ await openTonBags.sendPlaceStorageOrder(
);
```

Before placing order, the file need be encoded into a merkle tree, and the root hash need be passed to TONBag storage contract. Below is the code example:
Before placing order, the file need be encoded into a merkle tree, and the root hash need be passed to CrustBags storage contract. Below is the code example:

```javascript
import { merkle } from '@crustnetwork/tonbags-sdk'
import { merkle } from '@crustnetwork/crustbags-sdk'

const readAsBlob = async (file: string) => {
return new Promise<Blob>((resolve, reject) => {
Expand Down
26 changes: 13 additions & 13 deletions website/translated_docs/zh-CN/ton-build-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,39 @@ title: Overview
sidebar_label: Overview
---

## I. Crust Network TONBags storage
## I. CrustBags storage

Crust Network stands as one of the world’s largest decentralized storage networks. Over the past two years, we’ve successfully launched our Mainnet, boasting an impressive 600PB of storage across 1500+ nodes. Our network has facilitated storage for over 2 million orders, serving a diverse user base of 100,000+ individuals and establishing partnerships with more than 150 businesses. To further enhance Crust Network’s storage capabilities, we’ve already developed storage protocols for both the EVM and Algorand ecosystems.


**Introducing TONBags: On-Chain TONStorage Marketplace**
**Introducing CrustBags: On-Chain TONStorage Marketplace**

TONStorage is a fundamental component of the TON ecosystem. It enables users to store and distribute files of any size on a decentralized TON network. While it’s currently open and available for use, there are some limitations. Specifically, TONStorage users must manually identify reliable storage providers and create redundancy strategies to ensure better availability and failover. This process can be cumbersome.

Enter TONBags—an innovative solution. TONBags serves as an on-chain marketplace, simplifying storage discovery for users. With TONBags, everyone gains direct and effective access to TONStorage, making decentralized storage more accessible and user-friendly.
Enter CrustBags —an innovative solution. CrustBags serves as an on-chain marketplace, simplifying storage discovery for users. With CrustBags, everyone gains direct and effective access to TONStorage, making decentralized storage more accessible and user-friendly.

## II. TONBags storage protocol
## II. CrustBags storage protocol

### User flow

TONBags provides a unified storage interface via TONBags storage contract. And storage providers are incentivized to participate in the TON network by leveraging the [TON storage daemon](https://docs.ton.org/participate/ton-storage/storage-daemon).
CrustBags provides a unified storage interface via CrustBags storage contract. And storage providers are incentivized to participate in the TON network by leveraging the [TON storage daemon](https://docs.ton.org/participate/ton-storage/storage-daemon).

The user flow within TONBags is straightforward:
The user flow within CrustBags is straightforward:

1. Users call the TONBags storage contract, and pay a storage fee in $TON to place storage orders for their TONStorage files (referred to as bags).
2. Storage providers monitor these orders and store replicas of the files. To receive storage fees, providers periodically submit work reports (also known as storage proofs) to the TONBags storage contract.
1. Users call the CrustBags storage contract, and pay a storage fee in $TON to place storage orders for their TONStorage files (referred to as bags).
2. Storage providers monitor these orders and store replicas of the files. To receive storage fees, providers periodically submit work reports (also known as storage proofs) to the CrustBags storage contract.

![Pic](assets/build/tonbags-user-flow.png)
![Pic](assets/build/crustbags-user-flow.png)


### TONBags storage contract
### CrustBags storage contract

[TONBags storage contract](https://github.com/crustio/tonbags-contract) is a suite of open-source TON smart contracts developed and deployed by Crust Network. It provides interface for users to place storage orders for their files (*bags*), and for storage providers to monitor and discover orders for storage. It also consists of a Work Report Verifier to verify ZK storage proofs submitted by storage providers, and a Reward Pool to distribute storage fees to storage providers in a linearly and fairly manner.
[CrustBags storage contract](https://github.com/crustio/crustbags-contract) is a suite of open-source TON smart contracts developed and deployed by Crust Network. It provides interface for users to place storage orders for their files (*bags*), and for storage providers to monitor and discover orders for storage. It also consists of a Work Report Verifier to verify ZK storage proofs submitted by storage providers, and a Reward Pool to distribute storage fees to storage providers in a linearly and fairly manner.

![Pic](assets/build/tonbags-smart-contract.png)
![Pic](assets/build/crustbags-smart-contract.png)

### Storage providers

To participate as storage providers:
- Run the [TONBags manager](https://github.com/crustio/tonbags-manager) to handle storage orders and submit work reports.
- Run the [CrustBags manager](https://github.com/crustio/crustbags-manager) to handle storage orders and submit work reports.
- Maintain a local [TON storage daemon](https://docs.ton.org/participate/ton-storage/storage-daemon) node for efficient data propagation across the TON network.

0 comments on commit e78cce5

Please sign in to comment.