|
|
|
|
@@ -1,7 +1,7 @@
|
|
|
|
|
#!/bin/bash
|
|
|
|
|
# https://github.com/cryptoadvance/specter-desktop
|
|
|
|
|
|
|
|
|
|
pinnedVersion="2.0.5"
|
|
|
|
|
pinnedVersion="2.1.1"
|
|
|
|
|
|
|
|
|
|
# command info
|
|
|
|
|
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
|
|
|
|
@@ -119,15 +119,33 @@ function configure_specter {
|
|
|
|
|
torOnly="false"
|
|
|
|
|
tor_control_port=""
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Set the active node alias based on the chain
|
|
|
|
|
# Always use raspiblitz_${chain}net format, never "default"
|
|
|
|
|
active_alias="raspiblitz_${chain}net"
|
|
|
|
|
|
|
|
|
|
# Get Bitcoin RPC credentials early to use for Specter auth
|
|
|
|
|
echo "# Getting Bitcoin RPC credentials"
|
|
|
|
|
RPCUSER=$(sudo cat /mnt/hdd/app-data/${network}/${network}.conf | grep rpcuser | cut -c 9-)
|
|
|
|
|
PASSWORD_B=$(sudo cat /mnt/hdd/app-data/${network}/${network}.conf | grep rpcpassword | cut -c 13-)
|
|
|
|
|
|
|
|
|
|
# Hash the password for Specter using Specter's own hash_password function
|
|
|
|
|
# Use Specter's virtual environment to access the user module
|
|
|
|
|
PASSWORD_JSON=$(sudo -u specter /home/specter/.env/bin/python3 -c "
|
|
|
|
|
import json
|
|
|
|
|
from cryptoadvance.specter.user import hash_password
|
|
|
|
|
print(json.dumps(hash_password('${PASSWORD_B}')))
|
|
|
|
|
")
|
|
|
|
|
|
|
|
|
|
cat >/home/admin/config.json <<EOF
|
|
|
|
|
{
|
|
|
|
|
"auth": {
|
|
|
|
|
"method": "rpcpasswordaspin",
|
|
|
|
|
"method": "passwordonly",
|
|
|
|
|
"password_min_chars": 6,
|
|
|
|
|
"rate_limit": 10,
|
|
|
|
|
"registration_link_timeout": 1
|
|
|
|
|
},
|
|
|
|
|
"active_node_alias": "raspiblitz_${chain}net",
|
|
|
|
|
"active_node_alias": "${active_alias}",
|
|
|
|
|
"proxy_url": "${proxy}",
|
|
|
|
|
"only_tor": "${torOnly}",
|
|
|
|
|
"tor_control_port": "${tor_control_port}",
|
|
|
|
|
@@ -139,56 +157,52 @@ EOF
|
|
|
|
|
sudo mv /home/admin/config.json /home/specter/.specter/config.json
|
|
|
|
|
sudo chown -RL specter:specter /home/specter/
|
|
|
|
|
|
|
|
|
|
echo "# Adding the raspiblitz_${chain}net node to Specter"
|
|
|
|
|
RPCUSER=$(sudo cat /mnt/hdd/app-data/${network}/${network}.conf | grep rpcuser | cut -c 9-)
|
|
|
|
|
PASSWORD_B=$(sudo cat /mnt/hdd/app-data/${network}/${network}.conf | grep rpcpassword | cut -c 13-)
|
|
|
|
|
# Create the users.json file with admin user (Specter's format)
|
|
|
|
|
cat >/home/admin/users.json <<EOF
|
|
|
|
|
[
|
|
|
|
|
{
|
|
|
|
|
"id": "admin",
|
|
|
|
|
"username": "admin",
|
|
|
|
|
"password": ${PASSWORD_JSON},
|
|
|
|
|
"is_admin": true,
|
|
|
|
|
"jwt_tokens": {},
|
|
|
|
|
"encrypted_user_secret": null,
|
|
|
|
|
"services": []
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
EOF
|
|
|
|
|
sudo mv /home/admin/users.json /home/specter/.specter/users.json
|
|
|
|
|
sudo chown specter:specter /home/specter/.specter/users.json
|
|
|
|
|
|
|
|
|
|
echo "# Connect Specter to the default mainnet node"
|
|
|
|
|
cat >/home/admin/default.json <<EOF
|
|
|
|
|
echo "# Adding the raspiblitz_${chain}net node to Specter"
|
|
|
|
|
|
|
|
|
|
# Set the port based on the chain
|
|
|
|
|
if [ "${chain}" = "main" ]; then
|
|
|
|
|
PORT="8332"
|
|
|
|
|
elif [ "${chain}" = "test" ]; then
|
|
|
|
|
PORT="18332"
|
|
|
|
|
elif [ "${chain}" = "sig" ]; then
|
|
|
|
|
PORT="38332"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
echo "# Connect Specter to the raspiblitz_${chain}net node"
|
|
|
|
|
cat >/home/admin/raspiblitz_${chain}net.json <<EOF
|
|
|
|
|
{
|
|
|
|
|
"python_class": "cryptoadvance.specter.node.Node",
|
|
|
|
|
"fullpath": "/home/specter/.specter/nodes/default.json"
|
|
|
|
|
"name": "raspiblitz_mainnet",
|
|
|
|
|
"alias": "default",
|
|
|
|
|
"autodetect": false,
|
|
|
|
|
"datadir": "",
|
|
|
|
|
"user": "${RPCUSER}",
|
|
|
|
|
"password": "${PASSWORD_B}",
|
|
|
|
|
"port": "8332",
|
|
|
|
|
"host": "localhost",
|
|
|
|
|
"protocol": "http",
|
|
|
|
|
}
|
|
|
|
|
EOF
|
|
|
|
|
sudo mv /home/admin/default.json /home/specter/.specter/nodes/default.json
|
|
|
|
|
sudo chown -RL specter:specter /home/specter/
|
|
|
|
|
|
|
|
|
|
if [ "${chain}" != "main" ]; then
|
|
|
|
|
if [ "${chain}" = "test" ]; then
|
|
|
|
|
portprefix=1
|
|
|
|
|
elif [ "${chain}" = "sig" ]; then
|
|
|
|
|
portprefix=3
|
|
|
|
|
fi
|
|
|
|
|
PORT="${portprefix}8332"
|
|
|
|
|
|
|
|
|
|
echo "# Connect Specter to the raspiblitz_${chain}net node"
|
|
|
|
|
cat >/home/admin/raspiblitz_${chain}net.json <<EOF
|
|
|
|
|
{
|
|
|
|
|
"fullpath": "/home/specter/.specter/nodes/raspiblitz_${chain}net.json",
|
|
|
|
|
"name": "raspiblitz_${chain}net",
|
|
|
|
|
"alias": "raspiblitz_${chain}net",
|
|
|
|
|
"autodetect": false,
|
|
|
|
|
"datadir": "/mnt/hdd/bitcoin",
|
|
|
|
|
"datadir": "/mnt/hdd/app-storage/bitcoin",
|
|
|
|
|
"user": "${RPCUSER}",
|
|
|
|
|
"password": "${PASSWORD_B}",
|
|
|
|
|
"port": "${PORT}",
|
|
|
|
|
"host": "localhost",
|
|
|
|
|
"protocol": "http",
|
|
|
|
|
"external_node": true,
|
|
|
|
|
"fullpath": "/home/specter/.specter/nodes/raspiblitz_${chain}net.json"
|
|
|
|
|
"protocol": "http"
|
|
|
|
|
}
|
|
|
|
|
EOF
|
|
|
|
|
sudo mv /home/admin/raspiblitz_${chain}net.json /home/specter/.specter/nodes/raspiblitz_${chain}net.json
|
|
|
|
|
sudo chown -RL specter:specter /home/specter/
|
|
|
|
|
fi
|
|
|
|
|
sudo mv /home/admin/raspiblitz_${chain}net.json /home/specter/.specter/nodes/raspiblitz_${chain}net.json
|
|
|
|
|
sudo chown -RL specter:specter /home/specter/
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# config
|
|
|
|
|
@@ -243,6 +257,11 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
|
|
|
|
echo "# --> pip-installing specter"
|
|
|
|
|
sudo -u specter /home/specter/.env/bin/python3 -m pip install --upgrade cryptoadvance.specter==$pinnedVersion || exit 1
|
|
|
|
|
|
|
|
|
|
# Pin SQLAlchemy to 1.x to fix compatibility with spectrum extension
|
|
|
|
|
# SQLAlchemy 2.x removed __all__ attribute which breaks spectrum
|
|
|
|
|
echo "# --> Pinning SQLAlchemy to compatible version"
|
|
|
|
|
sudo -u specter /home/specter/.env/bin/python3 -m pip install "sqlalchemy>=1.4,<2.0"
|
|
|
|
|
|
|
|
|
|
# activating Authentication here ...
|
|
|
|
|
configure_specter
|
|
|
|
|
|
|
|
|
|
|