Skip to content

Commit

Permalink
doc: readme
Browse files Browse the repository at this point in the history
  • Loading branch information
MiniFrenchBread committed Jul 15, 2024
1 parent e0e9c7a commit 30cc334
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,20 @@ To generate a file for test purpose, especially with a fixed file size or random
```

**Upload file**

Use storage nodes urls directly:

```
./0g-storage-client upload --url <blockchain_rpc_endpoint> --contract <0g-storage_contract_address> --key <private_key> --node <storage_node_rpc_endpoint> --file <file_path>
```

The `--node` accept comma separated URLs, the client will submit the data segments to all these nodes according to their shard configurations.

Use indexer url to fetch storage nodes:
```
./0g-storage-client upload --url <blockchain_rpc_endpoint> --contract <0g-storage_contract_address> --key <private_key> --indexer <indexer_rpc_endpoint> --file <file_path>
```

**Download file**
```
./0g-storage-client download --node <storage_node_rpc_endpoint> --root <file_root_hash> --file <output_file_path>
Expand All @@ -38,3 +48,26 @@ To generate a file for test purpose, especially with a fixed file size or random
To download file from multiple storage nodes **in parallel**, `--node` option supports to specify multiple comma separated URLs, e.g. `url1,url2,url3`.

If you want to verify the **merkle proof** of downloaded segment, please specify `--proof` option.

**Write to KV**

By storage node urls:

```
./0g-storage-client kv-write --url <blockchain_rpc_endpoint> --contract <0g-storage_contract_address> --key <private_key> --node <storage_node_rpc_endpoint> --stream-id <stream_id> --stream-keys <stream_keys> --stream-values <stream_values>
```

By indexer:
```
./0g-storage-client kv-write --url <blockchain_rpc_endpoint> --contract <0g-storage_contract_address> --key <private_key> --indexer <indexer_rpc_endpoint> --stream-id <stream_id> --stream-keys <stream_keys> --stream-values <stream_values>
```

`--stream-keys` and `--stream-values` are comma separated string list and their length must be equal.

**Read from KV**

```
./0g-storage-client kv-read --node <kv_node_rpc_endpoint> --stream-id <stream_id> --stream-keys <stream_keys>
```

Please pay attention here `--node` is the url of a KV node, different from the command above.

0 comments on commit 30cc334

Please sign in to comment.