Skip to content

Commit

Permalink
Merge pull request #534 from Chia-Network/dl_rpc_230
Browse files Browse the repository at this point in the history
Update DataLayer RPC and CLI commands for 2.3.0
  • Loading branch information
danieljperry authored Apr 12, 2024
2 parents 33269c4 + 3ba1e37 commit ae42d31
Show file tree
Hide file tree
Showing 2 changed files with 109 additions and 18 deletions.
32 changes: 32 additions & 0 deletions docs/cli-reference/datalayer.md
Original file line number Diff line number Diff line change
Expand Up @@ -391,8 +391,18 @@ Options:
| -r | --root_hash | TEXT | False | The hexadecimal root hash |
| -dp | --data-rpc-port | INTEGER | False | Set the port where the DataLayer is hosting the RPC interface. See rpc_port under data_layer in config.yaml |
| -f | --fingerprint | INTEGER | False | Set the fingerprint to specify which wallet to use |
| -p | --page | INTEGER | False | Enables pagination of the output and requests a specific page |
| | --max-page-size | INTEGER | False | Set how many bytes to be included in a page, if pagination is enabled [Default: 40 MB] |
| -h | --help | None | False | Show a help message and exit |

:::info

Pagination is disabled by default. If it is enabled (by using the `page` flag), then the JSON response will include `total_pages` and `total_bytes`, in addition to the data.

If an item is larger than `max-page-size`, an error will be thrown.

:::

<details>
<summary>Example</summary>

Expand Down Expand Up @@ -430,8 +440,18 @@ Options:
| -r | --root_hash | TEXT | False | The hexadecimal root hash |
| -dp | --data-rpc-port | INTEGER | False | Set the port where the DataLayer is hosting the RPC interface. See rpc_port under data_layer in config.yaml |
| -f | --fingerprint | INTEGER | False | Set the fingerprint to specify which wallet to use |
| -p | --page | INTEGER | False | Enables pagination of the output and requests a specific page |
| | --max-page-size | INTEGER | False | Set how many bytes to be included in a page, if pagination is enabled [Default: 40 MB] |
| -h | --help | None | False | Show a help message and exit |

:::info

Pagination is disabled by default. If it is enabled (by using the `page` flag), then the JSON response will include `total_pages` and `total_bytes`, in addition to the data.

If an item is larger than `max-page-size`, an error will be thrown.

:::

<details>
<summary>Example</summary>

Expand Down Expand Up @@ -480,8 +500,18 @@ Options:
| -hash_2 | --hash_2 | TEXT | True | The second hash to compare |
| -dp | --data-rpc-port | INTEGER | False | Set the port where the DataLayer is hosting the RPC interface. See rpc_port under data_layer in config.yaml |
| -f | --fingerprint | INTEGER | False | Set the fingerprint to specify which wallet to use |
| -p | --page | INTEGER | False | Enables pagination of the output and requests a specific page |
| | --max-page-size | INTEGER | False | Set how many bytes to be included in a page, if pagination is enabled [Default: 40 MB] |
| -h | --help | None | False | Show a help message and exit |

:::info

Pagination is disabled by default. If it is enabled (by using the `page` flag), then the JSON response will include `total_pages` and `total_bytes`, in addition to the data.

If an item is larger than `max-page-size`, an error will be thrown.

:::

<details>
<summary>Example</summary>

Expand Down Expand Up @@ -1091,6 +1121,8 @@ Options:
| -dp | --data-rpc-port | INTEGER | False | Set the port where the DataLayer is hosting the RPC interface. See rpc_port under wallet in config.yaml |
| -m | --fee | TEXT | False | Set the fees for the transaction, in XCH |
| -f | --fingerprint | INTEGER | False | Set the fingerprint to specify which wallet to use |
| | --submit | None | False | Set to submit the result on chain [Default: don't submit] |
| | --no-submit | None | False | Set to explicitly specify not to submit the result on chain [Default: don't submit] |
| -h | --help | None | False | Show a help message and exit |

A few notes on the `-d` / `--changelist` option:
Expand Down
95 changes: 77 additions & 18 deletions docs/rpc-reference/datalayer.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,18 @@ Options:

Request Parameters:

| Flag | Type | Required | Description |
| :--------- | :--- | :------- | :---------------------------------------- |
| id | TEXT | True | The hexadecimal store ID |
| changelist | TEXT | True | A string representing the changelist |
| fee | TEXT | False | Set the fee for the transaction, in mojos |
| Flag | Type | Required | Description |
| :-------------- | :------ | :------- | :-------------------------------------------------------------------------------------------------------------------------------------------- |
| id | TEXT | True | The hexadecimal store ID |
| changelist | TEXT | True | A string representing the changelist |
| submit_on_chain | BOOLEAN | False | Specify whether to submit the update to the blockchain (`True`), or to store it locally (`False`). Default: `True` (See info box for details) |
| fee | TEXT | False | Set the fee for the transaction, in mojos |

:::info

The `submit_on_chain` flag was added in Chia version 2.3.0. In order to support the new functionality (submit an update off-chain), the schema for your `root` table will be upgraded automatically upon starting the DataLayer service. This upgrade takes about three minutes to complete.

:::

A few notes on the `changelist` option:

Expand Down Expand Up @@ -845,10 +852,12 @@ Options:

Request Parameters:

| Flag | Type | Required | Description |
| :-------- | :--- | :------- | :-------------------------------------- |
| id | TEXT | True | The hexadecimal store ID |
| root_hash | TEXT | False | The root hash from which to obtain data |
| Flag | Type | Required | Description |
| :------------ | :----- | :------- | :------------------------------------------------------------------------------------------------ |
| id | TEXT | True | The hexadecimal store ID |
| root_hash | TEXT | False | The root hash from which to obtain data |
| page | NUMBER | False | Enables pagination of the output and requests a specific page |
| max_page_size | NUMBER | False | Set how many bytes to be included in a page. Only used if pagination is enabled. Default is 40 MB |

:::info

Expand All @@ -859,6 +868,14 @@ This parameter is obtainable by calling the [get_root](#get_root) RPC.

:::

:::info

Pagination is disabled by default. If it is enabled (by using the `page` flag), then the JSON response will include `total_pages` and `total_bytes`, in addition to the data.

If an item is larger than `max_page_size`, an error will be thrown.

:::

<details>
<summary>Example</summary>

Expand Down Expand Up @@ -894,10 +911,12 @@ Options:

Request Parameters:

| Flag | Type | Required | Description |
| :-------: | :--: | :------: | :-------------------------------------- |
| id | TEXT | True | The hexadecimal store ID |
| root_hash | TEXT | False | The root hash from which to obtain data |
| Flag | Type | Required | Description |
| :-----------: | :----: | :------: | :------------------------------------------------------------------------------------------------ |
| id | TEXT | True | The hexadecimal store ID |
| root_hash | TEXT | False | The root hash from which to obtain data |
| page | NUMBER | False | Enables pagination of the output and requests a specific page |
| max_page_size | NUMBER | False | Set how many bytes to be included in a page. Only used if pagination is enabled. Default is 40 MB |

:::info

Expand All @@ -908,6 +927,14 @@ This parameter is obtainable by calling the [get_root](#get_root) RPC.

:::

:::info

Pagination is disabled by default. If it is enabled (by using the `page` flag), then the JSON response will include `total_pages` and `total_bytes`, in addition to the data.

If an item is larger than `max_page_size`, an error will be thrown.

:::

<details>
<summary>Example</summary>

Expand Down Expand Up @@ -1013,11 +1040,21 @@ Options:

Request Parameters:

| Flag | Type | Required | Description |
| :----- | :--- | :------- | :------------------------- |
| id | TEXT | True | The hexadecimal store ID |
| hash_1 | TEXT | True | The first hash to compare |
| hash_2 | TEXT | True | The second hash to compare |
| Flag | Type | Required | Description |
| :------------ | :----- | :------- | :------------------------------------------------------------------------------------------------ |
| id | TEXT | True | The hexadecimal store ID |
| hash_1 | TEXT | True | The first hash to compare |
| hash_2 | TEXT | True | The second hash to compare |
| page | NUMBER | False | Enables pagination of the output and requests a specific page |
| max_page_size | NUMBER | False | Set how many bytes to be included in a page. Only used if pagination is enabled. Default is 40 MB |

:::info

Pagination is disabled by default. If it is enabled (by using the `page` flag), then the JSON response will include `total_pages` and `total_bytes`, in addition to the data.

If an item is larger than `max_page_size`, an error will be thrown.

:::

<details>
<summary>Example</summary>
Expand Down Expand Up @@ -1461,6 +1498,7 @@ Response:
"/create_data_store",
"/get_owned_stores",
"/batch_update",
"/submit_pending_root",
"/get_value",
"/get_keys",
"/get_keys_values",
Expand Down Expand Up @@ -1911,6 +1949,27 @@ Response:

---

### `submit_pending_root`

Functionality: Publish the root from all pending batch updates

Usage: chia rpc data_layer [OPTIONS] submit_pending_root [REQUEST]

Options:

| Short Command | Long Command | Type | Required | Description |
| :------------ | :----------- | :------- | :------- | :------------------------------------------------------------------------------------ |
| -j | --json-file | FILENAME | False | Optionally instead of REQUEST you can provide a json file containing the request data |
| -h | --help | None | False | Show a help message and exit |

Request Parameters:

| Flag | Type | Required | Description |
| :--- | :--- | :------- | :----------------------- |
| id | TEXT | True | The hexadecimal store ID |

---

### `subscribe`

Functionality: Subscribe to a store ID
Expand Down

0 comments on commit ae42d31

Please sign in to comment.