#!/bin/bash # # MoltShell Quick Install Script # Usage: curl -sSL https://moltshell.io/install.sh | bash # # This script: # 1. Checks system requirements # 2. Downloads the latest molt CLI # 3. Creates a new wallet # 4. Requests testnet tokens from faucet # set -e # Colors RED='\033[0;31m' GREEN='\033[0;32m' BLUE='\033[0;34m' PURPLE='\033[0;35m' CYAN='\033[0;36m' NC='\033[0m' # No Color echo -e "${PURPLE}" echo "╔═══════════════════════════════════════════════════════════════╗" echo "║ ║" echo "║ 🐚 MoltShell - Quantum-Secure Payments for Bots ║" echo "║ ║" echo "╚═══════════════════════════════════════════════════════════════╝" echo -e "${NC}" # Detect OS and architecture OS=$(uname -s | tr '[:upper:]' '[:lower:]') ARCH=$(uname -m) case "$ARCH" in x86_64) ARCH="x86_64" ;; aarch64) ARCH="aarch64" ;; arm64) ARCH="aarch64" ;; *) echo -e "${RED}Unsupported architecture: $ARCH${NC}"; exit 1 ;; esac case "$OS" in linux) OS="linux" ;; darwin) OS="darwin" ;; *) echo -e "${RED}Unsupported OS: $OS${NC}"; exit 1 ;; esac echo -e "${CYAN}Detected: $OS-$ARCH${NC}" # Set install directory INSTALL_DIR="$HOME/.moltshell" BIN_DIR="$INSTALL_DIR/bin" WALLET_DIR="$INSTALL_DIR/wallets" mkdir -p "$BIN_DIR" "$WALLET_DIR" # Download URL (update when we have releases) DOWNLOAD_URL="https://moltshell.io/releases/molt-${OS}-${ARCH}" echo "" echo -e "${BLUE}[1/4] Downloading MoltShell CLI...${NC}" # For now, build from source if no binary available if ! curl -sSL -f "$DOWNLOAD_URL" -o "$BIN_DIR/molt" 2>/dev/null; then echo -e "${CYAN}No pre-built binary available. Building from source...${NC}" # Check for Rust if ! command -v cargo &> /dev/null; then echo -e "${CYAN}Installing Rust...${NC}" curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y source "$HOME/.cargo/env" fi # Clone and build TEMP_DIR=$(mktemp -d) git clone --depth 1 https://github.com/qweez/aetheris.git "$TEMP_DIR" cd "$TEMP_DIR" cargo build --release --bin molt cp target/release/molt "$BIN_DIR/" cd - > /dev/null rm -rf "$TEMP_DIR" fi chmod +x "$BIN_DIR/molt" echo -e "${GREEN}✓ CLI installed${NC}" # Add to PATH echo "" echo -e "${BLUE}[2/4] Configuring PATH...${NC}" SHELL_RC="" if [ -f "$HOME/.zshrc" ]; then SHELL_RC="$HOME/.zshrc" elif [ -f "$HOME/.bashrc" ]; then SHELL_RC="$HOME/.bashrc" fi if [ -n "$SHELL_RC" ]; then if ! grep -q "MOLTSHELL" "$SHELL_RC" 2>/dev/null; then echo "" >> "$SHELL_RC" echo "# MoltShell" >> "$SHELL_RC" echo "export PATH=\"\$HOME/.moltshell/bin:\$PATH\"" >> "$SHELL_RC" echo "export MOLTSHELL_KEY_FILE=\"\$HOME/.moltshell/wallets/default.seed\"" >> "$SHELL_RC" fi fi export PATH="$BIN_DIR:$PATH" echo -e "${GREEN}✓ PATH configured${NC}" # Create wallet echo "" echo -e "${BLUE}[3/4] Creating wallet...${NC}" if [ ! -f "$WALLET_DIR/default.seed" ]; then "$BIN_DIR/molt" wallet new --save "$WALLET_DIR/default.seed" > "$WALLET_DIR/default.info" 2>&1 # Extract address ADDRESS=$(grep "Address (bech32)" "$WALLET_DIR/default.info" | awk '{print $3}') echo -e "${GREEN}✓ Wallet created${NC}" echo -e " Address: ${CYAN}$ADDRESS${NC}" else ADDRESS=$(MOLTSHELL_KEY_FILE="$WALLET_DIR/default.seed" "$BIN_DIR/molt" wallet info 2>&1 | grep "Address (bech32)" | awk '{print $3}') echo -e "${GREEN}✓ Wallet already exists${NC}" echo -e " Address: ${CYAN}$ADDRESS${NC}" fi export MOLTSHELL_KEY_FILE="$WALLET_DIR/default.seed" # Request faucet tokens echo "" echo -e "${BLUE}[4/4] Requesting testnet tokens...${NC}" FAUCET_URL="https://moltshell.io/api/faucet" if curl -sSL -X POST "$FAUCET_URL" \ -H "Content-Type: application/json" \ -d "{\"address\": \"$ADDRESS\"}" 2>/dev/null | grep -q "success"; then echo -e "${GREEN}✓ Received 100 SHL from faucet${NC}" else echo -e "${CYAN}ℹ Faucet not available. Join Discord for tokens: https://discord.gg/moltshell${NC}" fi echo "" echo -e "${PURPLE}════════════════════════════════════════════════════════════════${NC}" echo "" echo -e "${GREEN}🎉 MoltShell installed successfully!${NC}" echo "" echo -e "Your wallet address:" echo -e " ${CYAN}$ADDRESS${NC}" echo "" echo -e "Quick commands:" echo -e " ${BLUE}molt balance${NC} - Check your balance" echo -e " ${BLUE}molt transfer --to --amount 10${NC}" echo -e " - Send 10 SHL" echo -e " ${BLUE}molt wallet info${NC} - Show wallet details" echo "" echo -e "${CYAN}Reload your shell or run: source $SHELL_RC${NC}" echo "" echo -e "${PURPLE}════════════════════════════════════════════════════════════════${NC}"