-
Notifications
You must be signed in to change notification settings - Fork 57
Add Quick Start tutorial #357
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
#!/bin/bash -e | ||
|
||
# This script installs or updates to the latest version of Go. | ||
# Multi-platform (Linux and macOS) | ||
# Multi-architecture (amd64, arm64, arm) support | ||
|
||
error_string=("Error: This command has to be run with superuser" | ||
"privileges (under the root user on most systems).") | ||
if [[ $(id -u) -ne 0 ]]; then echo "${error_string[@]}" >&2; exit 1; fi | ||
|
||
deps=( curl jq ) | ||
unset bail | ||
for i in "${deps[@]}"; do command -v "$i" >/dev/null 2>&1 || { bail="$?"; echo "$i" is not available; }; done | ||
if [ "$bail" ]; then exit "$bail"; fi | ||
|
||
version="$(curl -s 'https://go.dev/dl/?mode=json' | jq -r '.[0].version')" | ||
current="$(/usr/local/go/bin/go version 2>/dev/null | awk '{print $3}')" | ||
if [[ "$current" == "$version" ]]; then | ||
echo "Go is already up-to-date at version ${version}" | ||
exit 0 | ||
fi | ||
|
||
update_go() { | ||
local arch="$1" | ||
local os="$2" | ||
|
||
local go_url="https://golang.org/dl/${version}.${os}-${arch}.tar.gz" | ||
|
||
curl -so "/tmp/${version}.${os}-${arch}.tar.gz" -L "$go_url" && \ | ||
rm -rf /usr/local/go && tar -C /usr/local -xzf /tmp/${version}.${os}-${arch}.tar.gz | ||
|
||
tar -C /usr/local -xzf "/tmp/${version}.${os}-${arch}.tar.gz" && \ | ||
echo "Go updated to version ${version}" | ||
|
||
rm "/tmp/${version}.${os}-${arch}.tar.gz" | ||
} | ||
|
||
case "$(uname -s)" in | ||
Linux) | ||
case "$(uname -m)" in | ||
armv6l|armv7l) | ||
update_go "armv6l" "linux" | ||
;; | ||
arm64) | ||
update_go "arm64" "linux" | ||
;; | ||
x86_64) | ||
update_go "amd64" "linux" | ||
;; | ||
*) | ||
echo "Unsupported architecture: $(uname -m)" >&2 | ||
exit 1 | ||
;; | ||
esac | ||
;; | ||
Darwin) | ||
case "$(uname -m)" in | ||
arm64) | ||
update_go "arm64" "darwin" | ||
;; | ||
x86_64) | ||
update_go "amd64" "darwin" | ||
;; | ||
*) | ||
echo "Unsupported architecture: $(uname -m)" >&2 | ||
exit 1 | ||
;; | ||
esac | ||
;; | ||
*) | ||
echo "Unsupported operating system: $(uname -s)" >&2 | ||
exit 1 | ||
;; | ||
esac | ||
|
||
# Define the Go binary path | ||
GO_BIN_PATH="/usr/local/go/bin" | ||
|
||
# Function to add path to the specific shell config file | ||
add_path_to_config() { | ||
local config_file="$1" | ||
|
||
# Check if the Go bin path is already in the config file to prevent duplicates | ||
if ! grep -q "export PATH=.*$GO_BIN_PATH" "$config_file" ; then | ||
echo "export PATH=\$PATH:$GO_BIN_PATH" >> "$config_file" | ||
echo "Added $GO_BIN_PATH to $config_file" | ||
else | ||
echo "$GO_BIN_PATH is already in $config_file" | ||
fi | ||
} | ||
|
||
# Determine shell and appropriate config file | ||
if [[ -n "$ZSH_VERSION" ]]; then | ||
# Assuming the user is using Zsh | ||
CONFIG_FILE="$HOME/.zshenv" | ||
elif [[ -n "$BASH_VERSION" ]]; then | ||
# Check if .bash_profile exists, otherwise use .profile | ||
if [[ -f "$HOME/.bash_profile" ]]; then | ||
CONFIG_FILE="$HOME/.bash_profile" | ||
else | ||
CONFIG_FILE="$HOME/.profile" | ||
fi | ||
else | ||
echo "Unsupported shell. Only Bash and Zsh are supported." | ||
exit 1 | ||
fi | ||
|
||
# Check if the Go bin path is already in the PATH | ||
if [[ ":$PATH:" != *":$GO_BIN_PATH:"* ]]; then | ||
echo "Adding $GO_BIN_PATH to PATH." | ||
add_path_to_config "$CONFIG_FILE" | ||
# Source the config file to update the current session | ||
source "$CONFIG_FILE" | ||
echo "$GO_BIN_PATH added to PATH successfully." | ||
else | ||
echo "$GO_BIN_PATH is already in PATH." | ||
fi | ||
|
||
/usr/local/go/bin/go version |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
|
||
echo "Downloading Rollkit source code..." | ||
git clone https://github.com/rollkit/rollkit.git | ||
|
||
if ! which go > /dev/null; then | ||
echo "Go is not installed. Attempting to install Go..." | ||
if ! which go > /dev/null; then | ||
curl -sL https://raw.githubusercontent.com/rollkit/docs/main/scripts/install-go.sh | sh | ||
if ! which go > /dev/null; then | ||
echo "Failed to install Go. Please install it manually and rerun this script." | ||
exit 1 | ||
fi | ||
fi | ||
fi | ||
|
||
cd rollkit || { echo "Failed to find the unpacked directory."; exit 1; } | ||
git checkout v0.13.2 | ||
echo "Building and installing Rollkit..." | ||
make install | ||
cd .. | ||
echo "Installation completed successfully." | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,47 @@ | ||||||||||||||
--- | ||||||||||||||
description: Quickly start a rollup node using the Rollkit CLI. | ||||||||||||||
--- | ||||||||||||||
|
||||||||||||||
# Quick Start Guide | ||||||||||||||
|
||||||||||||||
Welcome to Rollkit, a sovereign rollup framework! The easiest way to launch your sovereign rollup node is by using the Rollkit CLI. | ||||||||||||||
|
||||||||||||||
### 📦 Install Rollkit (CLI) | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adjust the heading level for consistency. - ### 📦 Install Rollkit (CLI)
+ ## 📦 Install Rollkit (CLI) This change ensures that heading levels increment by one level at a time, maintaining a logical structure in the document. Committable suggestion
Suggested change
|
||||||||||||||
|
||||||||||||||
To install Rollkit, run the following command in your terminal: | ||||||||||||||
|
||||||||||||||
```bash | ||||||||||||||
curl -s https://install.rollkit.dev | sh | ||||||||||||||
``` | ||||||||||||||
Comment on lines
+13
to
+15
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider enhancing the security of the installation command. - curl -s https://install.rollkit.dev | sh
+ curl -s https://install.rollkit.dev -o rollkit_install.sh
+ sh rollkit_install.sh This change allows the user to review the script before executing it, reducing the risk of executing malicious code. Committable suggestion
Suggested change
|
||||||||||||||
|
||||||||||||||
Verify the installation by checking the Rollkit version: | ||||||||||||||
|
||||||||||||||
```bash | ||||||||||||||
rollkit version | ||||||||||||||
``` | ||||||||||||||
|
||||||||||||||
A successful installation will display the version number and its associated git commit hash. | ||||||||||||||
|
||||||||||||||
### 🚀 Run Your Sovereign Rollup Node | ||||||||||||||
|
||||||||||||||
To start a basic sovereign rollup node, execute: | ||||||||||||||
|
||||||||||||||
```bash | ||||||||||||||
rollkit start | ||||||||||||||
``` | ||||||||||||||
|
||||||||||||||
Upon execution, the CLI will output log entries that provide insights into the node's initialization and operation: | ||||||||||||||
|
||||||||||||||
```bash | ||||||||||||||
I[2024-05-01|09:58:46.001] Found private validator module=main keyFile=/root/.rollkit/config/priv_validator_key.json stateFile=/root/.rollkit/data/priv_validator_state.json | ||||||||||||||
I[2024-05-01|09:58:46.002] Found node key module=main path=/root/.rollkit/config/node_key.json | ||||||||||||||
I[2024-05-01|09:58:46.002] Found genesis file module=main path=/root/.rollkit/config/genesis.json | ||||||||||||||
... | ||||||||||||||
I[2024-05-01|09:58:46.080] Started node module=main | ||||||||||||||
I[2024-05-01|09:58:46.081] Creating and publishing block module=BlockManager height=223 | ||||||||||||||
I[2024-05-01|09:58:46.082] Finalized block module=BlockManager height=223 num_txs_res=0 num_val_updates=0 block_app_hash= | ||||||||||||||
``` | ||||||||||||||
|
||||||||||||||
### 🎉 Conclusion | ||||||||||||||
|
||||||||||||||
That's it! Your sovereign rollup node is now up and running. It's incredibly simple to start a blockchain (which is essentially what a rollup is) these days using Rollkit. Explore further and discover how you can build useful applications on Rollkit. Good luck! |
Uh oh!
There was an error while loading. Please reload this page.