Create ore.sh
This commit is contained in:
commit
346e4788f9
70
ore.sh
Normal file
70
ore.sh
Normal file
@ -0,0 +1,70 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 更新系统和安装必要的包
|
||||
echo "更新系统软件包..."
|
||||
sudo apt update && sudo apt upgrade -y
|
||||
echo "安装必要的工具和依赖..."
|
||||
sudo apt install -y curl build-essential jq git libssl-dev pkg-config screen
|
||||
|
||||
# 安装 Rust 和 Cargo
|
||||
echo "正在安装 Rust 和 Cargo..."
|
||||
curl https://sh.rustup.rs -sSf | sh -s -- -y
|
||||
source $HOME/.cargo/env
|
||||
|
||||
# 安装 Solana CLI
|
||||
echo "正在安装 Solana CLI..."
|
||||
sh -c "$(curl -sSfL https://release.solana.com/v1.18.4/install)"
|
||||
|
||||
# 检查 solana-keygen 是否在 PATH 中
|
||||
if ! command -v solana-keygen &> /dev/null; then
|
||||
echo "将 Solana CLI 添加到 PATH"
|
||||
export PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH"
|
||||
fi
|
||||
|
||||
# 创建 Solana 密钥对
|
||||
echo "正在创建 Solana 密钥对..."
|
||||
solana-keygen new --derivation-path m/44'/501'/0'/0' --force | tee solana-keygen-output.txt
|
||||
|
||||
# 显示提示信息,要求用户确认已备份
|
||||
echo "请确保你已经备份了上面显示的助记词和私钥信息。"
|
||||
echo "请向pubkey充值sol资产,用于挖矿gas费用。"
|
||||
|
||||
echo "备份完成后,请输入 'yes' 继续:"
|
||||
|
||||
read -p "" user_confirmation
|
||||
|
||||
if [[ "$user_confirmation" == "yes" ]]; then
|
||||
echo "确认备份。继续执行脚本..."
|
||||
else
|
||||
echo "脚本终止。请确保备份你的信息后再运行脚本。"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 安装 Ore CLI
|
||||
echo "正在安装 Ore CLI..."
|
||||
cargo install ore-cli
|
||||
|
||||
# 获取用户输入的 RPC 地址或使用默认地址
|
||||
read -p "请输入自定义的 RPC 地址 (默认设置使用 https://api.mainnet-beta.solana.com): " custom_rpc
|
||||
RPC_URL=${custom_rpc:-https://api.mainnet-beta.solana.com}
|
||||
|
||||
# 获取用户输入的线程数或使用默认值
|
||||
read -p "请输入挖矿时要使用的线程数 (默认设置 4): " custom_threads
|
||||
THREADS=${custom_threads:-4}
|
||||
|
||||
# 获取用户输入的优先费用或使用默认值
|
||||
read -p "请输入交易的优先费用 (默认设置 1): " custom_priority_fee
|
||||
PRIORITY_FEE=${custom_priority_fee:-1}
|
||||
|
||||
# 使用 screen 和 Ore CLI 开始挖矿
|
||||
session_name="ore"
|
||||
echo "开始挖矿,会话名称为 $session_name ..."
|
||||
screen -dmS $session_name ore \
|
||||
--rpc $RPC_URL \
|
||||
--keypair ~/.config/solana/id.json \
|
||||
--priority-fee $PRIORITY_FEE \
|
||||
mine \
|
||||
--threads $THREADS
|
||||
|
||||
echo "挖矿进程已在名为 $session_name 的 screen 会话中后台启动。"
|
||||
echo "使用 'screen -r $session_name' 命令重新连接到此会话。"
|
Loading…
Reference in New Issue
Block a user