Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: node.store usage updates for celestia-node #1532

Merged
merged 9 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions developers/celestia-node-key.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ Further flags you can use to customize your key are the following:

- `--node.store`: Specifies a different directory you can use to
save your node data and configurations. Expects a path to a directory.
The defaults are `$HOME/.celestia-<node-type>` for Mainnet Beta
and `$HOME/.celestia-<node-type>-<chain-id>` for Mocha and Arabica.
- `--p2p.network`: Specifies which network you want the key for. Values
are `arabica` and `mocha`. Please note the default network will be `mocha`.

Expand Down
85 changes: 41 additions & 44 deletions developers/node-tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -462,8 +462,14 @@ Where:
For example, to submit a blob to Celestia, you can use this command
once your node store is set:

:::note
Previously, the `node.store` flag had to be specified manually for each
request. This has changed in v0.14.0+ and you can
[read more about the implementation in celestia-node troubleshooting](../nodes/celestia-node-troubleshooting.md#changing-the-location-of-your-node-store).
:::

Comment on lines +248 to +253
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clarification and link addition needed for node.store flag change.

While the note mentions the change in the usage of the node.store flag, it would be beneficial for users if a direct link to the section discussing this change in detail is provided.

```bash
celestia blob submit 0x42690c204d39600fddd3 'gm' --node.store $NODE_STORE
celestia blob submit 0x42690c204d39600fddd3 'gm'
```

Alternatively, you could use the `--token` flag to set your auth token:
Expand All @@ -479,7 +485,8 @@ and how to use the node store to set it.
### Basic flags

All RPC CLI commands have basic flags that can be used to
interact with the API.
interact with the API; however, none are necessary using
default configurations.
Comment on lines +271 to +272
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simplify language to enhance clarity.

- All RPC CLI commands have basic flags that can be used to interact with the API; however, none are necessary using default configurations.
+ All RPC CLI commands have basic flags, but they are optional with default configurations.
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
interact with the API; however, none are necessary using
default configurations.
All RPC CLI commands have basic flags, but they are optional with default configurations.


These include:

Expand Down Expand Up @@ -528,12 +535,13 @@ In order to interact with the API using RPC CLI,
you can also use your node store to set your auth token. This will
allow you to interact with the API without
setting an authentication token directly.
This is only required if you are using a non-default node store path.

To set your node store for a light node on {{constants.mochaChainId}},
To set a custom node store for a light node on {{constants.mochaChainId}},
you can use the following command:

```bash-vue
export NODE_STORE=$HOME/.celestia-light-{{constants.mochaChainId}}
export NODE_STORE=$HOME/your-custom-path/celestia-light-{{constants.mochaChainId}}
Comment on lines +321 to +327
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clarify the need for custom node store paths.

The instructions for setting a custom node store path are clear, but adding a brief explanation of why a user might need or want to use a custom path can provide better context and help users make informed decisions.

```

Then, set the `--node.store` flag to the `$NODE_STORE` variable
Expand All @@ -548,12 +556,12 @@ celestia <module> <method> [args...] --node.store $NODE_STORE
This section is for users who are using a `CELESTIA_CUSTOM` or private network.

:::tip
If you are using a private and custom network, you will **need to set
the location of the node store in your auth command.**
If you are using a private and custom network with a custom node store path,
you will **need to set the location of the node store in your auth command.**
:::

```bash
--node.store $HOME/.celestia-light-private)
--node.store $HOME/your-custom-path/.celestia-light-private
Comment on lines +342 to +347
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Emphasize the necessity of setting the node store location in custom networks.

The tip about needing to set the node store location for custom and private networks is crucial and should be highlighted or made more prominent to ensure users do not overlook this requirement.

```

The above is an example from the following custom network set up with:
Expand All @@ -576,7 +584,7 @@ CELESTIA_CUSTOM=robusta-22 celestia light init

# Set auth token
export AUTH_TOKEN=$(celestia light auth admin --p2p.network private \
--node.store $HOME/.celestia-light-robusta-22)
--node.store $HOME/your-custom-path/.celestia-light-robusta-22)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure consistency in custom network setup instructions.

The instructions for setting up a custom network and the associated auth token use different node store paths. This inconsistency could confuse users. It would be helpful to standardize the node store path across these instructions.

```

### Submitting data
Expand All @@ -602,14 +610,13 @@ Here is an example of the format of the `blob.Submit` transaction:

```bash
celestia blob submit <hex-encoded namespace> <hex-encoded data> \
[optional: fee] [optional: gasLimit] [node store | auth token]
[optional: fee] [optional: gasLimit] [optional: node store | auth token]
```

We run the following to submit a blob to the network in hexadecimal format:

```bash
celestia blob submit 0x42690c204d39600fddd3 0x676d \
--node.store $NODE_STORE
```

We get the following output:
Expand All @@ -634,7 +641,7 @@ celestia blob submit <hex-encoded namespace> <'data'> \
And an example to submit "gm" as the plain-text data:

```bash
celestia blob submit 0x42690c204d39600fddd3 'gm' --node.store $HOME/.celestia-light-mocha-4/
celestia blob submit 0x42690c204d39600fddd3 'gm'
```

Output:
Expand Down Expand Up @@ -680,8 +687,7 @@ Here is an example command to retrieve the data from above, on `{{constants.arab
<!-- markdownlint-disable MD013 -->

```bash
celestia blob get 252614 0x42690c204d39600fddd3 IXg+08HV5RsPF3Lle8PH+B2TUGsGUsBiseflxh6wB5E= \
--node.store $NODE_STORE
celestia blob get 252614 0x42690c204d39600fddd3 IXg+08HV5RsPF3Lle8PH+B2TUGsGUsBiseflxh6wB5E=
```

Will generate the following output:
Expand All @@ -704,7 +710,7 @@ To see the base64 response, use the `--base64` flag set to `TRUE`

```bash
celestia blob get 252614 0x42690c204d39600fddd3 IXg+08HV5RsPF3Lle8PH+B2TUGsGUsBiseflxh6wB5E= \
--base64=TRUE --node.store $NODE_STORE
--base64=TRUE
```

<!-- markdownlint-enable MD013 -->
Expand All @@ -726,8 +732,7 @@ To get all blobs in the namespace at the block height, use `get-all` instead
of `get`:

```bash
celestia blob get-all 252614 0x42690c204d39600fddd3 \
--node.store $NODE_STORE
celestia blob get-all 252614 0x42690c204d39600fddd3
```

This will return the following:
Expand All @@ -749,7 +754,7 @@ To display the response in base64, use:

```bash
celestia blob get-all 252614 0x42690c204d39600fddd3 \
--base64=TRUE --node.store $NODE_STORE
--base64=TRUE
```

Which will return:
Expand Down Expand Up @@ -783,8 +788,7 @@ Learn [more about gas fees and limits](../developers/submit-data.md).
To set a higher gas price of 0.004 utia, use the `--gas.price 0.004` flag:

```bash
celestia blob submit 0x42690c204d39600fddd3 'gm' --gas.price 0.004 \
--node.store $NODE_STORE
celestia blob submit 0x42690c204d39600fddd3 'gm' --gas.price 0.004
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clarify the usage of the --gas.price flag.

The introduction of the --gas.price flag in the context of submitting blobs should be accompanied by clear documentation on its usage and implications on transaction costs.

```

You will receive the height and commitment of the block in which the
Expand All @@ -808,7 +812,7 @@ Let's query our node for the balance of its default account
key we generated above):

```bash
celestia state balance --node.store $NODE_STORE
celestia state balance
```

The response will look similar to:
Expand All @@ -829,17 +833,15 @@ The response will look similar to:
Here is an example of the format of the `balance-for-address` command:

```bash
celestia state balance-for-address <address> \
--node.store $NODE_STORE
celestia state balance-for-address <address>
```

Let's query our node for the balance of another address:

<!-- markdownlint-disable MD013 -->

```bash
celestia state balance-for-address celestia10rtd9lhel2cuh6c659l25yncl6atcyt37umard \
--node.store $NODE_STORE
celestia state balance-for-address celestia10rtd9lhel2cuh6c659l25yncl6atcyt37umard
```

The response will be the balance of the address you queried:
Expand All @@ -860,7 +862,7 @@ The response will be the balance of the address you queried:
This is an RPC call in order to get your node's peerId information:

```bash
celestia p2p info --node.store $NODE_STORE
celestia p2p info
```

The node ID is in the `ID` value from the response:
Expand Down Expand Up @@ -888,7 +890,7 @@ The node ID is in the `ID` value from the response:
This is an RPC call in order to get your node's account address:

```bash
celestia state account-address --node.store $NODE_STORE
celestia state account-address
```

Response:
Expand All @@ -906,17 +908,16 @@ Response:
Here is an example of the format of the `GetByHeight` command:

```bash
celestia header get-by-height <height> \
--node.store $NODE_STORE
celestia header get-by-height <height>
```

Now, let's get the block header information.

Here we will get the header from Block 1:

````bash
celestia header get-by-height 1 \
--node.store $NODE_STORE```
celestia header get-by-height 1
```

It will output something like this:

Expand Down Expand Up @@ -1010,15 +1011,13 @@ It will output something like this:
#### Combined commands

```bash
celestia share get-by-namespace "$(celestia header get-by-height 147105 \
--node.store $NODE_STORE | jq '.result.dah' -r)" 0x42690c204d39600fddd3 \
--node.store $NODE_STORE
celestia share get-by-namespace "$(celestia header get-by-height 147105 | jq '.result.dah' -r)" 0x42690c204d39600fddd3
```

#### Get data availability sampler stats

```bash
celestia das sampling-stats --node.store $NODE_STORE
celestia das sampling-stats
```

#### Transfer balance of utia to another account
Expand All @@ -1034,29 +1033,27 @@ recipient's address, gas fee, and gasLimit. This is what the format will
look like:

```bash
celestia state transfer $ADDRESS <amount in utia> <gas fee in utia> <gas fee in utia> \
--node.store $NODE_STORE
celestia state transfer $ADDRESS <amount in utia> <gas fee in utia> <gas fee in utia>
```

Here is an example, sending 0.1 TIA, with a gas fee of 0.008 TIA, and a gas limit of 0.08:

```bash
celestia state transfer $ADDRESS 100000 8000 80000 \
--node.store $NODE_STORE
celestia state transfer $ADDRESS 100000 8000 80000
```

If you'd just like to return the transaction hash, you can use jq:

```bash
celestia state transfer $ADDRESS 100000 8000 80000 --node.store $NODE_STORE | jq .result.txhash
celestia state transfer $ADDRESS 100000 8000 80000 | jq .result.txhash
```

#### API version

To query your node's API version, you can use the following command:

```bash
celestia node info --node.store $NODE_STORE
celestia node info
```

#### Help
Expand All @@ -1067,10 +1064,10 @@ To get help and view the CLI menu, use the following command:
celestia --help
```

To view help menu for a specific method, use the following command:
To view the help menu for a specific method, use the following command:

```bash
celestia <module> <method> --node.store $NODE_STORE --help
celestia <module> <method> --help
```

### Advanced example
Expand All @@ -1081,8 +1078,8 @@ used in `celestia share get-by-namespace`:

```bash
celestia share get-by-namespace \
"$(celestia header get-by-height 252614 --node.store $NODE_STORE | jq '.result.dah' -r)" \
0x42690c204d39600fddd3 --node.store $NODE_STORE
"$(celestia header get-by-height 252614 | jq '.result.dah' -r)" \
0x42690c204d39600fddd3
```

## Additional resources
Expand Down
78 changes: 78 additions & 0 deletions nodes/celestia-node-troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,33 @@ If you would like to use them anyway, you can

## Changing the location of your node store

### Background

An [enhancement has been made in v0.14.0+](https://github.com/celestiaorg/celestia-node/pull/3246)
to automate the detection of the running node, eliminating the need to
manually specify the `--node.store` flag for each RPC request.

**Assumptions:**

- The presence of a lock signifies a running node.
jcstein marked this conversation as resolved.
Show resolved Hide resolved
- Networks are ordered as Mainnet, Mocha, Arabica, private, custom.
- Node types are ordered as bridge, full, and light.
- Each network has only one running node type.
- Multiple nodes of the same network and type are prohibited
(resulting in an `Error: node: store is in use`).

Comment on lines +89 to +95
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revise the assumptions section for clarity and accuracy.

The assumptions listed about the ordering of networks and node types, as well as the prohibition of multiple nodes of the same network and type, are crucial for understanding the operational constraints. Consider expanding on why these assumptions are necessary and how they impact the node's operation to provide clearer guidance to users.

**Key Points:**

- Authentication token and other flags maintain their previous behavior
and take precedence.
- Address and port details are fetched from the configuration.
- `skipAuth` allows bypassing authentication for trusted setups and follows
jcstein marked this conversation as resolved.
Show resolved Hide resolved
Unix daemon conventions.
- Non-default node store and cel-key configurations still require specific
flags in the configuration settings.
Comment on lines +101 to +104
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure the skipAuth feature is clearly documented.

The skipAuth feature allows bypassing authentication in trusted setups, which is a significant configuration option. It might be helpful to provide a warning or note about the security implications of using this feature, especially in production environments. Would you like me to draft a security advisory note for this feature?


### Demonstration

In this section, we'll guide you through starting your node using a
node store in a different location than you originally started with.

Expand Down Expand Up @@ -113,6 +140,57 @@ To show the keys you should add `--keyring-dir` like this example:
--keyring-dir /home/user/celestia-<node-type>-location/keys/
```

### Examples

#### Mainnet Beta full and Mocha light

This example uses a Mainnet Beta full node and a Mocha light node. When
making the request:

```bash
❯ celestia blob get 1318129 0x42690c204d39600fddd3 0MFhYKQUi2BU+U1jxPzG7QY2BVV1lb3kiU+zAK7nUiY=
{
"result": "RPC client error: sendRequest failed: http status 401 Unauthorized unmarshaling response: EOF"
}
```

The request will go to the Mainnet Beta node, and a 401 will show in
this node's logs. Note that a 401 is expected because this blob was
posted to Mocha and neither the namespace nor the blob exist on Mainnet.

#### Mocha full and Arabica light

This example uses a Mocha full node and an Arabica light node. When
making the request:

```bash
❯ celestia blob get 1318129 0x42690c204d39600fddd3 0MFhYKQUi2BU+U1jxPzG7QY2BVV1lb3kiU+zAK7nUiY=
{
"result": {
"namespace": "AAAAAAAAAAAAAAAAAAAAAAAAAEJpDCBNOWAP3dM=",
"data": "0x676d",
"share_version": 0,
"commitment": "0MFhYKQUi2BU+U1jxPzG7QY2BVV1lb3kiU+zAK7nUiY=",
"index": 23
}
}
```

The request will go to the Mocha full node, and result shown as expected.

#### Using a custom rpc.config address

When using a custom RPC config address `0.0.0.1` and port `25231`,
the CLI accurately routes to the custom address and port, where no
node is running. It fails as expected:

```bash
❯ celestia blob get 1318129 0x42690c204d39600fddd3 0MFhYKQUi2BU+U1jxPzG7QY2BVV1lb3kiU+zAK7nUiY=
{
"result": "RPC client error: sendRequest failed: Post \"http://0.0.0.1:25231\": dial tcp 0.0.0.1:25231: connect: no route to host"
}
```
Comment on lines +143 to +192
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enhance the examples section with more detailed outcomes.

The examples provided for different node setups and their expected results are very useful. To enhance understanding, consider adding more context about why certain results are expected, such as the 401 Unauthorized error, and how users can resolve or investigate these issues further.

Tools
LanguageTool

[uncategorized] ~179-~179: You might be missing the article “the” here. (AI_EN_LECTOR_MISSING_DETERMINER_THE)
Context: ...est will go to the Mocha full node, and result shown as expected. #### Using a custom...


## Resetting your config

If you an encounter an error, it is likely that an old config file is present:
Expand Down
Loading