diff --git a/.vitepress/config.ts b/.vitepress/config.ts index 78c65a20de8..7708abfc248 100644 --- a/.vitepress/config.ts +++ b/.vitepress/config.ts @@ -255,14 +255,15 @@ function nav() { text: "Join the network", items: [ { text: "Learn", link: "/learn/how-celestia-works/overview" }, + { text: "Quick start", link: "/how-to-guides/quick-start" }, { text: "Build whatever", link: "/how-to-guides/build-whatever" }, - { text: "Node API", link: "/tutorials/node-api" }, - { text: "Discord", link: "https://discord.gg/celestiacommunity" }, { - text: "Quick start", + text: "Resources", items: [ - { text: "Run a node", link: "/how-to-guides/nodes-overview" }, - { text: "Blob tutorial", link: "/tutorials/node-tutorial" }, + { + text: "Celestia Improvement Proposals (CIPs)", + link: "https://cips.celestia.org/", + }, { text: "celestia-app specs", link: "https://celestiaorg.github.io/celestia-app/", @@ -380,14 +381,20 @@ function sidebarHome() { items: [ { text: "Run a node", - link: "/how-to-guides/nodes-overview", collapsed: true, items: [ { - text: "Quick start", - link: "/how-to-guides/quick-start", + text: "Overview", + link: "/how-to-guides/nodes-overview", + }, + { + text: "Getting started", collapsed: true, items: [ + { + text: "Quick start", + link: "/how-to-guides/quick-start", + }, { text: "Deciding which node to run", link: "/how-to-guides/decide-node", @@ -552,9 +559,12 @@ function sidebarHome() { }, { text: "Build whatever", - link: "/how-to-guides/build-whatever", collapsed: true, items: [ + { + text: "Overview", + link: "/how-to-guides/build-whatever", + }, { text: "EVM", collapsed: true, @@ -807,9 +817,12 @@ function sidebarHome() { items: [ { text: "Node API Tutorials", - link: "/tutorials/node-api", collapsed: true, items: [ + { + text: "Overview", + link: "/tutorials/node-api", + }, { text: "CLI tutorial", link: "/tutorials/node-tutorial", diff --git a/how-to-guides/celestia-app.md b/how-to-guides/celestia-app.md index 6219d59a444..6c0e4a9860f 100644 --- a/how-to-guides/celestia-app.md +++ b/how-to-guides/celestia-app.md @@ -17,6 +17,9 @@ This tutorial will guide you through installing celestia-app, both [from source](#building-binary-from-source) and with [a pre-built binary](#installing-a-pre-built-binary) +Celestia-app is the software that allows you to run +validator nodes and provide RPC endpoints. + ## Building binary from source This section of the tutorial presumes you completed the steps in diff --git a/how-to-guides/celestia-node-trusted-hash.md b/how-to-guides/celestia-node-trusted-hash.md index 31d3820a2da..0d38032b714 100644 --- a/how-to-guides/celestia-node-trusted-hash.md +++ b/how-to-guides/celestia-node-trusted-hash.md @@ -12,7 +12,7 @@ accordingly for Mocha, Arabica, or a custom network. Syncing to a trusted hash means that you will not sample the entire chain. This adds a trust assumption that you trust the history of the chain up to that point and that you trust the entity where you get the hash from. In this example, the trusted entity is a consensus endpoint or -Celenium +Celenium. ::: 1. Get trusted height & hash from a consensus endpoint or [Celenium](https://celenium.io). @@ -23,7 +23,7 @@ Celenium ``` 1. Set the trusted height & hash - 1. Open your config.toml at `.celestia-light/config.toml` (or `.celestia-light-/config.toml`) + 1. Open your `config.toml` at `.celestia-light/config.toml` (or `.celestia-light-/config.toml`) 1. Set `DASer.SampleFrom` to the trusted height (e.g. `SampleFrom = 123456`) 1. Run the node with the hash and flag: diff --git a/how-to-guides/celestia-node.md b/how-to-guides/celestia-node.md index e9b3b066fc7..17cc75fec6a 100644 --- a/how-to-guides/celestia-node.md +++ b/how-to-guides/celestia-node.md @@ -96,36 +96,51 @@ commit hash, build date, system version, and Golang version. ## Installing a pre-built binary -Installing a pre-built binary is the fastest way to get started with your -Celestia data availability node. Releases after celestia-node v0.13.3 should have -these binaries available. +Installing a pre-built binary is the fastest way to get started with your Celestia data availability node. Releases after celestia-node v0.13.3 have these binaries available. -The steps below will download a binary file named `celestia`. -Depending on the setup that you choose during installation, the `celestia` -binary will be available at either: - -- `$HOME/celestia-node-temp/celestia` +The installation script will download a binary file named `celestia`. Depending on your chosen installation option, the `celestia` binary will be available at one of these locations: +- `$GOPATH/bin/celestia` (if Go is installed) - `/usr/local/bin/celestia` +- `$HOME/celestia-node-temp/celestia` Pre-built binaries are available for: - - Operating systems: Darwin (Apple), Linux - Architectures: x86_64 (amd64), arm64 -To install the latest pre-built binary you can run this command in your -terminal: +### Installation Options -```bash +You can install the latest version or specify a particular version: + +```bash-vue +# Install latest version bash -c "$(curl -sL https://docs.celestia.org/celestia-node.sh)" + +# Install specific version +bash -c "$(curl -sL https://docs.celestia.org/celestia-node.sh)" -- -v {{mainnetVersions['node-latest-tag']}} ``` -Follow the instructions in the terminal output to choose your installation -preferences. +The script will: +1. Detect your system's operating system and architecture +2. Download the appropriate binary +3. Verify the checksum for security +4. Provide installation location options based on your environment: + - If Go is installed: + - Go bin directory (`$GOPATH/bin`) + - System bin directory (`/usr/local/bin`) + - Keep in current directory + - If Go is not installed: + - System bin directory (`/usr/local/bin`) + - Keep in current directory + +Follow the instructions in the terminal output to choose your installation preferences. After installation, you can verify the setup by checking the version: + +```bash +celestia version && celestia --help +``` -You will see an output with the menu for `celestia`. +View [the script](https://github.com/celestiaorg/docs/tree/main/public/celestia-node.sh) to learn more about what it is doing. -View [the script](https://github.com/celestiaorg/docs/tree/main/public/celestia-node.sh) -to learn more about what it is doing. +> **Note**: The script maintains a log file at `$HOME/celestia-node-temp/logfile.log` for troubleshooting purposes. ## Next steps diff --git a/how-to-guides/quick-start.md b/how-to-guides/quick-start.md index 9f24124f0eb..d4fd9e1d2cf 100644 --- a/how-to-guides/quick-start.md +++ b/how-to-guides/quick-start.md @@ -1,55 +1,282 @@ --- -description: Learn how to get started and run your first node on Celestia. +description: Learn how to get started and post your first blob to Celestia. --- -# Quick start guide +# Quick-start guide -In this section, we show you how to get started -with installing the needed libraries and packages -in Celestia to help you run a node on Celestia. + + -## Celestia Node +Welcome to Celestia's quick-start guide! In this guide, we'll learn how to run a Celestia data availability sampling (DAS) light node to post and retrieve data blobs on Celestia's [Mocha testnet](./mocha-testnet.md). -[Install celestia-node](./celestia-node.md) allows you to get started with -running a light node and do data availability sampling. +A blob (a.k.a. [BLOB](https://en.wikipedia.org/wiki/Object_storage#Origins)) is a Binary Large OBject. In other words, a blob is arbitrary data. In this case, it's data that you want to post and make available on Celestia's data availability (DA) layer. -Light nodes are the best nodes to test out initially if -you are new to participating in Celestia. +Your light node will allow you to post data, and then use DAS to sample and retrieve it from the DA network. Let's get started! -celestia-node client also allows you to run other types -of data availability (DA) nodes like bridge and full DA storage -nodes, which will be covered in later sections. +## Run a light node -## Celestia App +First we'll need to install the `celestia` binary to run our DAS light node. Use the following command to install a pre-built binary of [celestia-node](https://github.com/celestiaorg/celestia-node), for the latest release for Mocha testnet: -[Install celestia-app](./celestia-app.md) allows you to get started -running a consensus node. +> For this guide, select either your Go bin or system bin directory when prompted. If you're curious what [the script](https://github.com/celestiaorg/docs/tree/main/public/celestia-node.sh) is doing, check out [the celestia-node page](./celestia-node.md#installing-a-pre-built-binary). -celestia-app is the software that allows you to run -validator nodes and also provide RPC endpoints. +```bash-vue +bash -c "$(curl -sL https://docs.celestia.org/celestia-node.sh)" -- -v {{mochaVersions['node-latest-tag']}} +``` -celestia-app covers the consensus layer, while celestia-node -covers the DA layer. +Once you've installed `celestia`, double-check that you're using the right version by running: -## Getting started +```bash +celestia version +``` -As covered in the previous section, Celestia offers -two different test networks, [Arabica devnet](./arabica-devnet.md) -and [Mocha testnet](./mocha-testnet.md). +You should see the version of the binary that you just installed. Use `celestia --help` to see the CLI menu. -If you are planning to run a light node, it is recommended -to use Arabica, which you will find options to connecting to -in the later sections. +### Initialize the light node -If you plan on running a validator, your only option is to run -your node on Mocha. +Initializing your light node will set up configuration files and create a keypair for your node. -In this quick start guide, we will go over installing both of -the software clients: celestia-node and celestia-app. +The `p2p.network` flag is used to specify the network you want to connect to. Use `mocha` for Mocha testnet. + +> The chain ID `{{ constants.mochaChainId }}` is also an accepted alias. + +```bash +celestia light init --p2p.network mocha +``` + +Once you've run this command, you'll see a new keypair that's created in your terminal. Be sure to save your mnemonic somewhere safe for future use! + +```bash-vue +INFO node nodebuilder/init.go:31 Initializing Light Node Store over '/Users/js/.celestia-light-{{ constants.mochaChainId }}' +INFO node nodebuilder/init.go:64 Saved config {"path": "/Users/js/.celestia-light-{{ constants.mochaChainId }}/config.toml"} +INFO node nodebuilder/init.go:66 Accessing keyring... +WARN node nodebuilder/init.go:196 Detected plaintext keyring backend. For elevated security properties, consider using the `file` keyring backend. +INFO node nodebuilder/init.go:211 NO KEY FOUND IN STORE, GENERATING NEW KEY... {"path": "/Users/js/.celestia-light-{{ constants.mochaChainId }}/keys"} +INFO node nodebuilder/init.go:216 NEW KEY GENERATED... + +NAME: my_celes_key +ADDRESS: celestia1lgvzg4ek9v499pl5vvsvqpquhwfg0jznpwd92m +MNEMONIC (save this somewhere safe!!!): +never gonna give you up never gonna let you down never gonna run around and desert you never gonna make you cry never gonna + +INFO node nodebuilder/init.go:73 Node Store initialized +``` + +You'll also see in this example, using the Mocha testnet and setting up a light node, our node store will be at: `~/.celestia-light-{{ constants.mochaChainId }}`. + +> Logs above have the timestamps removed for brevity. And yes, that's a Rickroll mnemonic. 😜 + +#### Set the trusted hash + +Setting and syncing to a trusted hash and height means your light node will not sample the entire chain. This is useful when you want to sync your light node quickly. However, it's important to note that this adds the trust assumption that you trust the entity where you get the hash and height from, in this case, the [P-OPS](https://pops.one) team's consensus endpoint. + +Let's set the trusted hash! + +1. Get trusted height & hash from the P-OPS consensus endpoint: + + ```bash + export TRUSTED_HEIGHT=$(curl -s "https://rpc-mocha.pops.one/header" | jq -r '.result.header.height') && export TRUSTED_HASH=$(curl -s "https://rpc-mocha.pops.one/header" | jq -r '.result.header.last_block_id.hash') && echo "Height: $TRUSTED_HEIGHT" && echo "Hash: $TRUSTED_HASH" + ``` + +1. Set the trusted height & hash + 1. Open your `config.toml` at `.celestia-light-{{ constants.mochaChainId }}/config.toml` + 1. Set `DASer.SampleFrom` to the trusted height (e.g. `SampleFrom = 123456`) + +> If you dont do this, when trying to retrieve data in a few minutes, you'll see a response saying `"result": "header: syncing in progress: localHeadHeight: 94721, requestedHeight: 2983850"`. You'll either need to let the node sync to the `requestedHeight`, or use quick sync with trusted hash to do this. +Learn more in [the trusted hash quick sync guide](./celestia-node-trusted-hash.md). + +### Start the light node + +Run the following command to start your light node: + +In the same terminal you initialized the node store and set the variable for `TRUSTED_HASH`, start the node with the hash and flag: + +```bash +celestia light start --headers.trusted-hash $TRUSTED_HASH \ + --p2p.network mocha --core.ip rpc-mocha.pops.one +``` + +The `core.ip` flag is used to specify the consensus RPC endpoints you want to connect to, this is the same one we got the trusted height and hash from. We'll use `rpc-mocha.pops.one` from the P-OPS team for Mocha testnet. The `headers.trusted-hash` flag will set the trusted hash from the previous section. + +Once you see this in the logs, you're ready to start posting and retrieving data! + +```bash-vue +/_____/ /_____/ /_____/ /_____/ /_____/ + +Started celestia DA node +node version: {{mochaVersions['node-latest-tag'].slice(1)}} +node type: light +network: {{ constants.mochaChainId }} + +/_____/ /_____/ /_____/ /_____/ /_____/ +``` + +:::tip +If you want to see that your node is synced, use the `celestia das sampling-stats` command to check it in another terminal: + +```bash +{ + "result": { + "head_of_sampled_chain": 2990507, + "head_of_catchup": 2990507, + "network_head_height": 2990507, + "concurrency": 0, + "catch_up_done": true, + "is_running": true + } +} +``` -:::tip NOTE -If you just want to run a light node, you don't need to -install celestia-app and can skip that part. ::: -Proceed to the next section in order to get started. +## Post and retrieve data with your light node + +### Funding your light node + +Now, we're almost ready to start posting data! + +Open a second terminal instance for the remainder of this guide. Let's find our address for the node we have running by running: + +```bash +celestia state account-address +``` + +Take this account address and head over to the [Discord](https://discord.gg/celestiacommunity) and request tokens from the `#mocha-faucet` channel. + +Once you've requested tokens, can check the balance of your running node using: + +```bash +celestia state balance +``` + +### Posting data + +Now that you have tokens in your account, you can post data to the network. Let's break down the arguments you'll provide to the CLI: + +```bash +celestia blob submit [namespace] [blobData] +``` + +The `[namespace]` is a permissionless way to categorize your data on Celestia. In other words, it's a channel for you to post your data. For example, this could be the name of your project or a category for the type of blob. In this example, we'll use `0x71756f746573` as the namespace, which is the hex encoding of "quotes". See the ["quotes" namespace on Celenium](https://mocha.celenium.io/namespace/0000000000000000000000000000000000000000000071756f746573?tab=Blobs). + +> Learn more about namespaces in [the celestia-app documentation](https://celestiaorg.github.io/celestia-app/namespace.html). + +The `[blobData]` is the blob data you want to post to the network. In this example, we'll use a quote from Leonardo da Vinci: + +:::tip +Feeling creative? Post your favorite quote and [share it on Twitter](https://x.com/JoshCStein/status/1849553273470263636)! +::: + +```bash +celestia blob submit 0x71756f746573 '"Simplicity is the ultimate sophistication." -Leonardo da Vinci' +``` + +Once you run this command, you'll see a height and data committment in the response. This means your data has been successfully posted to the network! + +```bash +{ + "result": { + "height": 2990556, + "commitments": [ + "0x715ab246772c923104c556dc28d5d4fcfca0398b0a252bcd19dd5705495756ac" + ] + } +} +``` + +### Retrieving data + +To retrieve the data you posted, use the following command: + +```bash +celestia blob get [height] [namespace] [committment] +``` + +In this example, you'll use the height and commitment from the response above: + +```bash +celestia blob get 2990556 0x71756f746573 0x715ab246772c923104c556dc28d5d4fcfca0398b0a252bcd19dd5705495756ac +``` + +In response, you'll see the data you posted: + +```bash +{ + "result": { + "namespace": "0x71756f746573", + "data": "\"Simplicity is the ultimate sophistication.\" -Leonardo da Vinci", + "share_version": 0, + "commitment": "0x715ab246772c923104c556dc28d5d4fcfca0398b0a252bcd19dd5705495756ac", + "index": 29 + } +} +``` + +Let's break it down: + +- `namespace`: The [namespace](https://celestiaorg.github.io/celestia-app/namespace.html) you used to categorize your data. +- `data`: The data blob you posted to the network. +- `share_version`: The version of the [share](https://celestiaorg.github.io/celestia-app/shares.html). A share is a fixed-size data chunk that is associated with exactly one namespace. +- `commitment`: The commitment of the data (see [Blob Share Commitment Rules](https://celestiaorg.github.io/celestia-app/data_square_layout.html#blob-share-commitment-rules)). +- `index`: The [index](https://celestiaorg.github.io/celestia-app/shares.html#overview) of the data share in the square. + +Congratulations! You've successfully learned how to run a light node to post and retrieve data from Celestia's Mocha testnet. + +## Diving deeper into the stack + +This section covers some more in-depth topics that you may find useful when working with your Celestia light node. + +### Get your auth token + +Your auth token may be useful when you want to interact with your Celestia light node from a client application. You can get your auth token by running: + +```bash +celestia light auth admin --p2p.network mocha +``` + +Use `celestia light auth --help` to learn more about the available options. + +### Key management with cel-key + +In the first part of this guide, we generated a key when we initialized the light node. + +An advanced option for key management is using the `cel-key` utility, which is a separate tool from the `celestia` binary. `cel-key` is a key management tool that allows you to create, import, and manage keys for your Celestia DA node. + +If you're using the quickstart script above, you will have to build `cel-key` separately from source. You can find the instructions for building `cel-key` in the [celestia-node](./celestia-node.md) documentation. + +### Rust client tutorial + +If you're interested in writing a Rust program to interact with your Celestia light node, check out the [Rust client tutorial](../tutorials/rust-client-tutorial.md). + +### Golang client tutorial + +If you're interested in writing a Golang program to interact with your Celestia light node, check out the [Golang client tutorial](../tutorials/golang-client-tutorial.md). + +### Node store contents + +As described in the [initialize the light node section](#initialize-the-light-node) above, the node store is created in the `~/.celestia--` directory. + +In this guide, the node store for `~/.celestia-light-{{ constants.mochaChainId }}` contains the following directories and file types: + +- `config.toml`: Node configuration settings +- `data/`: Contains database files + - `.vlog` files: Value log files storing actual data + - `.sst` files: Static sorted tables containing indexed data + - System files: `DISCARD`, `KEYREGISTRY`, and `MANIFEST` for database management +- `keys/`: Stores node identity and account keys + - Contains encoded node identifiers + - `keyring-test/`: Test keyring directory + - `.address` files: Account addresses + - `.info` files: Key metadata and information + +## Troubleshooting + +If you run into issues, check out the [troubleshooting](./celestia-node-troubleshooting.md) page for common problems and solutions. + +## Next steps + +Check out the [build whatever page](./build-whatever.md) to get started learning about ways to build with Celestia underneath. + +Head to the next page to learn about different node types for the consensus and DA networks. diff --git a/index.md b/index.md index 63c55c20fe2..1049b2bb075 100644 --- a/index.md +++ b/index.md @@ -12,8 +12,8 @@ hero: alt: Celestia actions: - theme: brand - text: Build whatever - link: /how-to-guides/build-whatever + text: Quick start + link: /how-to-guides/quick-start - theme: alt text: Introduction link: /learn/how-celestia-works/overview @@ -25,7 +25,7 @@ features: icon: 🏗️ - title: How-to guides details: Explore step-by-step guides for running a node, posting data blobs, building applications and sovereign rollups on Celestia. - link: /how-to-guides/nodes-overview + link: /how-to-guides/quick-start icon: 📈 - title: Tutorials details: Access tutorials for interacting with Celestia, starting with celestia-node through the node API. diff --git a/public/celestia-node.sh b/public/celestia-node.sh index 336424cfdfe..16889af4c79 100644 --- a/public/celestia-node.sh +++ b/public/celestia-node.sh @@ -11,6 +11,19 @@ echo " " LOGFILE="$HOME/celestia-node-temp/logfile.log" TEMP_DIR="$HOME/celestia-node-temp" +# Parse command line arguments +while getopts "v:" opt; do + case $opt in + v) USER_VERSION="$OPTARG" + ;; + \?) echo "Invalid option -$OPTARG" >&2 + echo "Usage: $0 [-v version]" + echo "Example: $0 -v v0.11.0" + exit 1 + ;; + esac +done + # Check if the directory exists if [ -d "$TEMP_DIR" ]; then read -p "Directory $TEMP_DIR exists. Do you want to clear it out? (y/n) " -n 1 -r @@ -33,17 +46,28 @@ echo "Log file is located at: $LOGFILE" | tee -a "$LOGFILE" cd "$TEMP_DIR" || exit 1 echo "Working from temporary directory: $TEMP_DIR" | tee -a "$LOGFILE" -# Fetch the latest release tag from GitHub -VERSION=$(curl -s "https://api.github.com/repos/celestiaorg/celestia-node/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') +# Set VERSION based on user input or fetch latest +if [ -n "$USER_VERSION" ]; then + VERSION="$USER_VERSION" + echo "Using specified version: $VERSION" | tee -a "$LOGFILE" +else + # Fetch the latest release tag from GitHub + VERSION=$(curl -s "https://api.github.com/repos/celestiaorg/celestia-node/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') -# Check if VERSION is empty -if [ -z "$VERSION" ]; then - echo "Failed to fetch the latest version. Exiting." | tee -a "$LOGFILE" - exit 1 + # Check if VERSION is empty + if [ -z "$VERSION" ]; then + echo "Failed to fetch the latest version. Exiting." | tee -a "$LOGFILE" + exit 1 + fi + echo "Using latest version: $VERSION" | tee -a "$LOGFILE" fi -# Log and print a message -echo "Latest version detected: $VERSION" | tee -a "$LOGFILE" +# Validate version format +if [[ ! $VERSION =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-.*)?$ ]]; then + echo "Invalid version format: $VERSION" | tee -a "$LOGFILE" + echo "Version should be in the format vX.X.X (e.g., v0.11.0)" | tee -a "$LOGFILE" + exit 1 +fi # Detect the operating system and architecture OS=$(uname -s) @@ -127,33 +151,133 @@ echo "Binary extracted to: $TEMP_DIR" | tee -a "$LOGFILE" # Remove the tarball to clean up rm "celestia-node_$PLATFORM.tar.gz" +rm "checksums.txt" # Log and print a message echo "Temporary files cleaned up." | tee -a "$LOGFILE" -# Ask the user if they want to move the binary to /usr/local/bin -read -p "Do you want to move the binary to /usr/local/bin? This will require sudo access. (y/n) " -n 1 -r +# Check if Go is installed +if command -v go >/dev/null 2>&1; then + GOPATH=${GOPATH:-$(go env GOPATH)} + GOBIN="$GOPATH/bin" + HAS_GO=true +else + HAS_GO=false +fi + +# Ask the user where to install the binary +echo "" +if [ "$HAS_GO" = true ]; then + echo "Where would you like to install the celestia binary?" + echo "1) Go bin directory ($GOBIN) [Recommended]" + echo "2) System bin directory (/usr/local/bin)" + echo "3) Keep in current directory ($TEMP_DIR)" +else + echo "Go is not installed. Where would you like to install the celestia binary?" + echo "1) System bin directory (/usr/local/bin) [Recommended]" + echo "2) Keep in current directory ($TEMP_DIR)" +fi + +read -p "Enter your choice: " -n 1 -r echo # move to a new line -if [[ $REPLY =~ ^[Yy]$ ]] -then - sudo mv "$TEMP_DIR/celestia" /usr/local/bin/ - echo "Binary moved to /usr/local/bin" | tee -a "$LOGFILE" - # Create a symbolic link in the temporary directory - ln -s /usr/local/bin/celestia "$TEMP_DIR/celestia" - echo "Symbolic link created in $TEMP_DIR" | tee -a "$LOGFILE" - echo "" - echo "You can now run celestia from anywhere." | tee -a "$LOGFILE" - echo "" - echo "To check its version and see the menu, execute the following command:" | tee -a "$LOGFILE" - echo "" - echo "celestia version && celestia --help" | tee -a "$LOGFILE" + +if [ "$HAS_GO" = true ]; then + case $REPLY in + 1) + # Install to GOBIN + mkdir -p "$GOBIN" + mv "$TEMP_DIR/celestia" "$GOBIN/" + chmod +x "$GOBIN/celestia" + echo "Binary moved to $GOBIN" | tee -a "$LOGFILE" + # Create a symbolic link in the temporary directory + ln -s "$GOBIN/celestia" "$TEMP_DIR/celestia" + echo "Symbolic link created in $TEMP_DIR" | tee -a "$LOGFILE" + echo "" + # Check if GOBIN is in PATH + if [[ ":$PATH:" != *":$GOBIN:"* ]]; then + echo "NOTE: $GOBIN is not in your PATH. You may want to add it by adding this line to your ~/.bashrc or ~/.zshrc:" + echo "export PATH=\$PATH:$GOBIN" + echo "" + fi + echo "You can now run celestia from anywhere (if $GOBIN is in your PATH)." | tee -a "$LOGFILE" + ;; + 2) + # Install to /usr/local/bin + sudo mv "$TEMP_DIR/celestia" /usr/local/bin/ + echo "Binary moved to /usr/local/bin" | tee -a "$LOGFILE" + # Create a symbolic link in the temporary directory + ln -s /usr/local/bin/celestia "$TEMP_DIR/celestia" + echo "Symbolic link created in $TEMP_DIR" | tee -a "$LOGFILE" + echo "" + echo "You can now run celestia from anywhere." | tee -a "$LOGFILE" + ;; + 3) + # Keep in current directory + chmod +x "$TEMP_DIR/celestia" + echo "Binary kept in $TEMP_DIR" | tee -a "$LOGFILE" + echo "You can run celestia from this directory using ./celestia" | tee -a "$LOGFILE" + ;; + *) + echo "" + echo "Invalid choice. The binary remains in $TEMP_DIR" | tee -a "$LOGFILE" + chmod +x "$TEMP_DIR/celestia" + echo "You can run celestia from this directory using ./celestia" | tee -a "$LOGFILE" + ;; + esac +else + case $REPLY in + 1) + # Install to /usr/local/bin + sudo mv "$TEMP_DIR/celestia" /usr/local/bin/ + echo "Binary moved to /usr/local/bin" | tee -a "$LOGFILE" + # Create a symbolic link in the temporary directory + ln -s /usr/local/bin/celestia "$TEMP_DIR/celestia" + echo "Symbolic link created in $TEMP_DIR" | tee -a "$LOGFILE" + echo "" + echo "You can now run celestia from anywhere." | tee -a "$LOGFILE" + ;; + 2) + # Keep in current directory + chmod +x "$TEMP_DIR/celestia" + echo "Binary kept in $TEMP_DIR" | tee -a "$LOGFILE" + echo "You can run celestia from this directory using ./celestia" | tee -a "$LOGFILE" + ;; + *) + echo "" + echo "Invalid choice. The binary remains in $TEMP_DIR" | tee -a "$LOGFILE" + chmod +x "$TEMP_DIR/celestia" + echo "You can run celestia from this directory using ./celestia" | tee -a "$LOGFILE" + ;; + esac +fi + +echo "" +echo "To check its version and see the menu, execute the following command:" | tee -a "$LOGFILE" +if [ "$HAS_GO" = true ]; then + case $REPLY in + 1) # Go bin installation + echo "celestia version && celestia --help" | tee -a "$LOGFILE" + ;; + 2) # System bin installation + echo "celestia version && celestia --help" | tee -a "$LOGFILE" + ;; + 3) # Current directory + echo "$TEMP_DIR/celestia version && $TEMP_DIR/celestia --help" | tee -a "$LOGFILE" + ;; + *) # Invalid choice (kept in temp dir) + echo "$TEMP_DIR/celestia version && $TEMP_DIR/celestia --help" | tee -a "$LOGFILE" + ;; + esac else - echo "" - echo "You can navigate to $TEMP_DIR to find and run celestia." | tee -a "$LOGFILE" - echo "" - echo "To check its version and see the menu, execute the following commands:" | tee -a "$LOGFILE" - echo "" - echo "cd $TEMP_DIR" | tee -a "$LOGFILE" - echo "chmod +x celestia" | tee -a "$LOGFILE" - echo "./celestia version && ./celestia --help" | tee -a "$LOGFILE" + case $REPLY in + 1) # System bin installation + echo "celestia version && celestia --help" | tee -a "$LOGFILE" + ;; + 2) # Current directory + echo "$TEMP_DIR/celestia version && $TEMP_DIR/celestia --help" | tee -a "$LOGFILE" + ;; + *) # Invalid choice (kept in temp dir) + echo "$TEMP_DIR/celestia version && $TEMP_DIR/celestia --help" | tee -a "$LOGFILE" + ;; + esac fi diff --git a/tutorials/node-api.md b/tutorials/node-api.md index 1bce08a8c5e..b8887eea83c 100644 --- a/tutorials/node-api.md +++ b/tutorials/node-api.md @@ -35,9 +35,13 @@ signing + providing RPC-level DOS protection. ### RPC API tutorial +The [quick start guide](../how-to-guides/quick-start.md) is the easiest way to get started. + The [node tutorial](./node-tutorial.md), which uses the RPC CLI, is the recommended way -to get started interacting with your Celestia node. +to learn more about interacting with your Celestia node. + +Other ways to get started are with the [Rust](./rust-client-tutorial.md) and [Golang](./golang-client-tutorial.md) tutorials. ## Gateway API