diff --git a/.dockerignore b/.dockerignore index bd58efa..2881242 100644 --- a/.dockerignore +++ b/.dockerignore @@ -11,8 +11,12 @@ LICENSE docker-compose.yml .dockerignore +# IMPORTANT: entrypoint.sh is needed and should NOT be ignored +# !entrypoint.sh + # Data and runtime files -data/ +electrumx-data/ +palladium-node-data/ *.log *.pid diff --git a/.gitignore b/.gitignore index c04a1b4..197be29 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,11 @@ -# ElectrumX data directory -/data/ +# ElectrumX server data +/electrumx-data/ -# Docker volumes and logs +# Palladium node data (keep only the config file) +/palladium-node-data/* +!/palladium-node-data/palladium.conf + +# Logs *.log # IDE and editor files diff --git a/Dockerfile b/Dockerfile.electrumx similarity index 94% rename from Dockerfile rename to Dockerfile.electrumx index 509e70c..cbfbb10 100644 --- a/Dockerfile +++ b/Dockerfile.electrumx @@ -114,3 +114,10 @@ EOF ENV SSL_CERTFILE=/certs/server.crt ENV SSL_KEYFILE=/certs/server.key + +# Copy and setup entrypoint script +COPY entrypoint.sh /usr/local/bin/entrypoint.sh +RUN chmod +x /usr/local/bin/entrypoint.sh + +# Set entrypoint +ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] diff --git a/Dockerfile.palladium-node b/Dockerfile.palladium-node new file mode 100644 index 0000000..c7fdc1d --- /dev/null +++ b/Dockerfile.palladium-node @@ -0,0 +1,38 @@ +FROM ubuntu:22.04 + +# Install required dependencies +RUN apt-get update && apt-get install -y \ + libboost-system1.74.0 \ + libboost-filesystem1.74.0 \ + libboost-thread1.74.0 \ + libboost-chrono1.74.0 \ + libevent-2.1-7 \ + libevent-pthreads-2.1-7 \ + libzmq5 \ + libminiupnpc17 \ + libnatpmp1 \ + libsqlite3-0 \ + && rm -rf /var/lib/apt/lists/* + +# Copy Palladium binaries from daemon folder +COPY daemon/palladiumd /usr/local/bin/ +COPY daemon/palladium-cli /usr/local/bin/ +COPY daemon/palladium-tx /usr/local/bin/ +COPY daemon/palladium-wallet /usr/local/bin/ + +# Make binaries executable +RUN chmod +x /usr/local/bin/palladiumd \ + /usr/local/bin/palladium-cli \ + /usr/local/bin/palladium-tx \ + /usr/local/bin/palladium-wallet + +# Create data directory +RUN mkdir -p /root/.palladium + +# Expose RPC and P2P ports +# Mainnet: 2332 (RPC), 2333 (P2P) +# Testnet: 12332 (RPC), 12333 (P2P) +EXPOSE 2332 2333 12332 12333 + +# Default command (will be overridden by docker-compose) +CMD ["palladiumd", "-printtoconsole=1"] diff --git a/README.md b/README.md index 463a01d..beb9001 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,47 @@ # ElectrumX with Palladium (PLM) Support -This repository provides a **Dockerized** setup of **ElectrumX** with support for the **Palladium (PLM)** coin. -It also includes a test script (`test-server.py`) to verify the connection and main functionalities of the ElectrumX server. +This repository provides a **complete Dockerized setup** of **ElectrumX** with an integrated **Palladium (PLM)** full node. -Tested on: +Everything runs in Docker containers - no need to install dependencies on your host system! -* ✅ Debian 12 -* ✅ Ubuntu 24.04 +## What You Get -🔗 Palladium Full Node: [davide3011/palladiumcore](https://github.com/davide3011/palladiumcore) +- **Palladium Full Node** (palladiumd) - Running in Docker +- **ElectrumX Server** - Pre-configured for Palladium +- **Automatic SSL certificates** - Secure connections ready +- **Easy configuration** - Just edit one config file +- **Reuse existing blockchain** - Or sync from scratch +- **Production ready** - Restart policies included + +## Tested Platforms + +* Debian 12/13 +* Ubuntu 24.04/22.04 LTS +* WSL2 (Windows Subsystem for Linux) + +## Project Structure + +``` +plm-electrumx/ +├── daemon/ # Palladium binaries (YOU must add these) +│ ├── palladiumd # Node daemon (required) +│ ├── palladium-cli # CLI tool (required) +│ ├── palladium-tx # Transaction tool (optional) +│ └── palladium-wallet # Wallet tool (optional) +├── palladium-node-data/ +│ ├── palladium.conf # Node configuration (edit this!) +│ ├── blocks/ # Blockchain blocks (auto-generated) +│ ├── chainstate/ # Blockchain state (auto-generated) +│ └── ... # Other runtime data (auto-generated) +├── electrumx-data/ # ElectrumX database (auto-generated) +├── Dockerfile.palladium-node # Builds Palladium node container +├── Dockerfile.electrumx # Builds ElectrumX server container +└── docker-compose.yml # Main orchestration file +``` + +**Important:** All blockchain data is stored in `./palladium-node-data/` directory, not externally. + +🔗 Palladium Full Node: [palladium-coin/palladiumcore](https://github.com/palladium-coin/palladiumcore) --- @@ -17,23 +50,23 @@ Tested on: ``` ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ │ Electrum │ │ ElectrumX │ │ Palladium │ -│ Clients │◄──►│ Server │◄──►│ Full Node │ -│ │ │ (Docker) │ │ │ +│ Clients │◄──►│ Server │◄──►│ Node Daemon │ +│ │ │ (Docker) │ │ (Docker) │ └─────────────────┘ └─────────────────┘ └─────────────────┘ ``` +This setup includes both ElectrumX and Palladium node (palladiumd) running in separate Docker containers. + --- ## Requirements * [Docker](https://docs.docker.com/get-docker/) * [Docker Compose](https://docs.docker.com/compose/install/) -* Python 3.10+ (to use `test-server.py`) -* A running **Palladium** full node ([NotRin7/Palladium](https://github.com/NotRin7/Palladium)) +* Python 3.10+ (optional, to use `test-server.py`) +* **Palladium binaries** - See installation instructions below -**System Architecture**: This server requires a **64-bit system** (both AMD64 and ARM64 architectures are supported, but 32-bit systems are not compatible). - -**Recommendation**: to ensure maximum stability and reduce communication latency, it is strongly recommended to run the Palladium node **on the same machine** that hosts the ElectrumX container. +**System Architecture**: This server requires a **64-bit system** (AMD64 or ARM64). 32-bit systems are **not** supported. --- @@ -47,68 +80,278 @@ For Docker Compose: --- -## Palladium Node Configuration +## Quick Start Guide -Before running ElectrumX, you need to configure your Palladium Core node to accept RPC connections. Edit your `palladium.conf` file (usually located in `~/.palladium/palladium.conf` on Linux/Mac or `%APPDATA%\Palladium\palladium.conf` on Windows). +Follow these simple steps to get your ElectrumX server running with Palladium node. -### Recommended palladium.conf for Mainnet +### Files Overview -```conf -# Server mode (required for RPC) -server=1 +This project uses two separate Dockerfiles: +- **`Dockerfile.palladium-node`**: Builds the Palladium daemon (palladiumd) container +- **`Dockerfile.electrumx`**: Builds the ElectrumX server container -# RPC credentials (change these!) -rpcuser= -rpcpassword= +**Data Storage:** +- **Configuration**: `./palladium-node-data/palladium.conf` (version controlled) +- **Blockchain data**: `./palladium-node-data/` (auto-generated, ignored by git) +- **ElectrumX database**: `./electrumx-data/` (auto-generated, ignored by git) -# RPC port (default for mainnet) -rpcport=2332 +--- -# Allow Docker containers to connect (REQUIRED for ElectrumX) -# This setting allows RPC connections from all Docker networks -rpcbind=0.0.0.0 -rpcallowip=127.0.0.1 -rpcallowip=172.16.0.0/12 +### Step 1: Clone the Repository -# Optional: reduce debug log verbosity -printtoconsole=0 +```bash +git clone https://github.com/palladium-coin/plm-electrumx.git +cd plm-electrumx ``` -**Important Notes:** -- **`rpcbind=0.0.0.0`**: Makes the RPC server listen on all network interfaces (not just localhost) -- **`rpcallowip=172.16.0.0/12`**: Allows connections from **all** Docker networks (covers 172.16.x.x through 172.31.x.x) - - Docker containers run in isolated networks that can vary (172.17.x.x, 172.18.x.x, 172.21.x.x, etc.) - - The `/12` subnet covers all possible Docker bridge networks, making this configuration universal - - Without this setting, ElectrumX won't be able to connect to your Palladium node -- **Security**: These settings only allow local Docker containers to connect, not external machines -- **Change the credentials**: Never use default usernames/passwords in production +--- -After editing `palladium.conf`, restart your Palladium Core node for the changes to take effect. +### Step 2: Get Palladium Binaries + +**IMPORTANT:** You must download the Palladium binaries that match your system architecture. + +#### Option A: Download from Official Release + +1. Go to the Palladium releases page: [palladium-coin/palladiumcore/releases](https://github.com/palladium-coin/palladiumcore/releases) + +2. Download the correct version for your system: + - **Linux x64 (Intel/AMD)**: `palladium-x.x.x-x86_64-linux-gnu.tar.gz` + - **Linux ARM64 (Raspberry Pi, etc.)**: `palladium-x.x.x-aarch64-linux-gnu.tar.gz` + +3. Extract the binaries: + ```bash + # Example for Linux x64 + tar -xzf palladium-*.tar.gz + ``` + +4. Copy the binaries to the `daemon/` folder: + ```bash + mkdir -p daemon + cp palladium-*/bin/palladiumd daemon/ + cp palladium-*/bin/palladium-cli daemon/ + cp palladium-*/bin/palladium-tx daemon/ + cp palladium-*/bin/palladium-wallet daemon/ + ``` + +5. Make them executable: + ```bash + chmod +x daemon/* + ``` + +#### Option B: Use Existing Palladium Installation + +If you already have Palladium Core installed on your system: + +```bash +mkdir -p daemon +cp /usr/local/bin/palladiumd daemon/ +cp /usr/local/bin/palladium-cli daemon/ +cp /usr/local/bin/palladium-tx daemon/ +cp /usr/local/bin/palladium-wallet daemon/ +``` + +#### Verify Installation + +Check that the binaries are in place: + +```bash +ls -lh daemon/ +``` + +You should see: +``` +-rwxr-xr-x palladiumd # Main daemon (required) +-rwxr-xr-x palladium-cli # CLI tool (required) +-rwxr-xr-x palladium-tx # Optional +-rwxr-xr-x palladium-wallet # Optional +``` + +**Architecture Warning:** The Docker container uses Ubuntu 22.04 base image. Make sure your binaries are compatible with Linux x64 or ARM64. Using macOS or Windows binaries will NOT work. + +--- + +### Step 3: Configure RPC Credentials + +Open the configuration file and change the default credentials: + +```bash +nano palladium-node-data/palladium.conf +``` + +**IMPORTANT:** Change these two lines: +```conf +rpcuser=username # ← Change this to your username +rpcpassword=password # ← Change this to a secure password +``` + +Save and close the file (`Ctrl+X`, then `Y`, then `Enter` in nano). + +**Security Note:** Use a strong password! These credentials control access to your Palladium node. + +--- + +### Step 4: (Optional) Copy Existing Blockchain Data + +If you already have a synced Palladium blockchain, you can copy it to speed up the initial sync: + +```bash +# Copy from your existing .palladium directory +cp -r ~/.palladium/blocks palladium-node-data/ +cp -r ~/.palladium/chainstate palladium-node-data/ +cp -r ~/.palladium/indexes palladium-node-data/ +``` + +**Skip this step** if you want to sync from scratch. The node will automatically start syncing when you run it. + +--- + +### Step 5: Build and Start the Containers + +Now you're ready to start everything: + +```bash +docker-compose up -d +``` + +**What happens:** +- Docker builds two images: `palladium-node` and `electrumx-server` +- Starts the Palladium node container first +- Starts the ElectrumX server container (waits for Palladium node) +- Both run in the background (`-d` flag means "detached mode") + +**First time?** The build process can take a few minutes. + +--- + +### Step 6: Monitor the Logs + +Watch what's happening in real-time: + +```bash +# View all logs +docker-compose logs -f + +# View only Palladium node logs +docker-compose logs -f palladiumd + +# View only ElectrumX logs +docker-compose logs -f electrumx +``` + +Press `Ctrl+C` to stop viewing logs (containers keep running). + +**What to look for:** +- Palladium node: "UpdateTip" messages (blockchain syncing) +- ElectrumX: "INFO:BlockProcessor:height..." (indexing blocks) + +--- + +### Step 7: Verify Everything is Working + +Check if containers are running: + +```bash +docker-compose ps +``` + +You should see both containers with status "Up". + +Test the Palladium node: + +```bash +docker exec palladium-node palladium-cli -rpcuser=username -rpcpassword=password getblockchaininfo +``` + +(Replace `username` and `password` with your credentials) + +You should see blockchain information including the current block height. + +--- + +## Understanding the Configuration + +### Palladium Node Configuration File + +The `palladium-node-data/palladium.conf` file contains all settings for the Palladium daemon: + +```conf +# RPC credentials (CHANGE THESE!) +rpcuser=username +rpcpassword=password + +server=1 +listen=1 +daemon=1 +discover=1 +txindex=1 +addressindex=1 +timestampindex=1 +spentindex=1 + +bind=0.0.0.0 +port=2333 +rpcport=2332 +rpcbind=0.0.0.0 + +# Allow Docker containers to connect +rpcallowip=172.17.0.0/16 +rpcallowip=172.18.0.0/16 + +maxconnections=50 +fallbackfee=0.0001 + +# Addnodes: +seednode=dnsseed.palladium-coin.store + +addnode=89.117.149.130:2333 +addnode=66.94.115.80:2333 +addnode=173.212.224.67:2333 +addnode=82.165.218.152:2333 + +# ZeroMQ Configuration (optional) +zmqpubrawblock=tcp://0.0.0.0:28334 +zmqpubrawtx=tcp://0.0.0.0:28335 +zmqpubhashblock=tcp://0.0.0.0:28332 +zmqpubhashtx=tcp://0.0.0.0:28333 +``` + +**Key Settings Explained:** + +| Setting | Purpose | Required? | +|---------|---------|-----------| +| `rpcuser`, `rpcpassword` | Credentials for RPC access | ✅ Yes - CHANGE THESE! | +| `txindex=1` | Index all transactions | ✅ Yes - ElectrumX needs this | +| `addressindex=1` | Index addresses | ⚡ Recommended for performance | +| `timestampindex=1` | Index timestamps | ⚡ Recommended for performance | +| `spentindex=1` | Index spent outputs | ⚡ Recommended for performance | +| `rpcbind=0.0.0.0` | Allow RPC connections from Docker | ✅ Yes | +| `rpcallowip=172.17.0.0/16` | Allow Docker network IPs | ✅ Yes | +| `addnode=...` | Known Palladium nodes to connect | 📡 Helps with sync | --- ## ElectrumX Configuration -In the `docker-compose.yml` file, you can set the RPC credentials of the Palladium full node that ElectrumX will use: +The ElectrumX container **automatically reads RPC credentials** from the `palladium.conf` file. You don't need to manually configure credentials in `docker-compose.yml` anymore! -```yaml -environment: - DAEMON_URL: "http://:@host.docker.internal:/" -``` +**How it works:** +1. ElectrumX mounts the `palladium-node-data/palladium.conf` file as read-only +2. On startup, it automatically extracts `rpcuser` and `rpcpassword` +3. Builds the `DAEMON_URL` dynamically with the correct credentials -Replace with your actual values: - -* `` → RPC username of the node -* `` → RPC password of the node -* `` → RPC port of the node (`2332` for mainnet, `12332` for testnet) - -**Note:** The compose uses `host.docker.internal` to connect to the Palladium node running on your host machine (outside the container). This works on both Windows/Mac and Linux thanks to the `extra_hosts` configuration. +**Benefits:** +- Single source of truth for credentials (only `palladium.conf`) +- No need to sync credentials between multiple files +- Easier to maintain and more secure **Ports:** ElectrumX exposes: - `50001` → TCP (unencrypted) - `50002` → SSL (encrypted, recommended) -**Important:** never include real credentials in files you upload to GitHub. +**Palladium node ports:** +- `2332` → RPC port (mainnet) +- `2333` → P2P port (mainnet) +- `28332-28335` → ZeroMQ ports (optional) --- @@ -134,7 +377,7 @@ The default configuration is set for **mainnet**. No changes are needed if you w environment: COIN: "Palladium" NET: "mainnet" - DAEMON_URL: "http://:@host.docker.internal:2332/" + # RPC credentials automatically read from palladium.conf ``` **Requirements:** @@ -210,7 +453,7 @@ When switching networks, you **must** clear the ElectrumX database to avoid conf docker compose down # Remove the database -rm -rf ./data/* +rm -rf ./electrumx-data/* # Or on Windows: # rmdir /s /q data @@ -260,40 +503,161 @@ To switch back from testnet to mainnet: 4. In `docker-compose.yml`, change: - `NET: "testnet"` → `NET: "mainnet"` - Port in `DAEMON_URL` from `12332` → `2332` -5. Clear database: `rm -rf ./data/*` +5. Clear database: `rm -rf ./electrumx-data/*` 6. Restart ElectrumX: `docker compose down && docker compose up -d` --- -## Build and Start the Project +## Common Commands -1. Navigate to the directory containing `docker-compose.yml` and `Dockerfile`. - -2. Start the containers with Docker Compose (builds the image automatically on first run): - - ```bash - docker compose up -d - ``` - - **Note:** Docker Compose will automatically build the image if it doesn't exist. No need to run `docker build` manually! - -3. Check the logs to verify that ElectrumX started correctly: - - ```bash - docker compose logs -f - ``` - -### Manual Build (Optional) - -If you want to manually rebuild the Docker image (e.g., after code changes): +### Starting and Stopping ```bash -# Rebuild the image -docker compose build +# Start both containers +docker-compose up -d -# Or rebuild and restart in one command -docker compose up -d --build +# Stop both containers +docker-compose down + +# Stop and remove all data (WARNING: deletes ElectrumX database) +docker-compose down -v + +# Restart containers +docker-compose restart ``` + +### Viewing Logs + +```bash +# All logs (live feed) +docker-compose logs -f + +# Only Palladium node +docker-compose logs -f palladiumd + +# Only ElectrumX +docker-compose logs -f electrumx + +# Last 100 lines +docker-compose logs --tail=100 +``` + +### Checking Status + +```bash +# Container status +docker-compose ps + +# Palladium blockchain info +docker exec palladium-node palladium-cli -rpcuser=YOUR_USER -rpcpassword=YOUR_PASS getblockchaininfo + +# Palladium network info +docker exec palladium-node palladium-cli -rpcuser=YOUR_USER -rpcpassword=YOUR_PASS getnetworkinfo + +# Check how many peers connected +docker exec palladium-node palladium-cli -rpcuser=YOUR_USER -rpcpassword=YOUR_PASS getpeerinfo | grep addr +``` + +### Rebuilding After Changes + +If you modify configuration or update binaries: + +```bash +# Rebuild images +docker-compose build + +# Rebuild and restart +docker-compose up -d --build + +# Force rebuild (no cache) +docker-compose build --no-cache +``` + +--- + +## Troubleshooting + +### Palladium Node Not Starting + +**Problem:** Container exits immediately + +**Solution:** +1. Check logs: `docker-compose logs palladiumd` +2. Verify credentials in `palladium-node-data/palladium.conf` +3. Check if blockchain directory has permissions issues: + ```bash + ls -la palladium-node-data/ + ``` +4. Verify binaries are correct architecture: + ```bash + file daemon/palladiumd + # Should show: ELF 64-bit LSB executable, x86-64 (or aarch64) + ``` + +### ElectrumX Can't Connect to Palladium Node + +**Problem:** ElectrumX logs show "connection refused" + +**Solution:** +1. Verify credentials match in both files: + - `palladium-node-data/palladium.conf` + - `docker-compose.yml` (DAEMON_URL line) +2. Check if Palladium node is running: + ```bash + docker-compose ps + ``` +3. Test RPC connection: + ```bash + docker exec palladium-node palladium-cli -rpcuser=YOUR_USER -rpcpassword=YOUR_PASS getblockchaininfo + ``` + +### Blockchain Sync is Slow + +**Problem:** Sync takes too long + +**Tips:** +- Copy existing blockchain data to `palladium-node-data/` (see Step 5) +- Check internet connection +- Make sure addnodes are configured in `palladium.conf` +- Be patient - initial sync can take hours/days depending on blockchain size + +### Port Already in Use + +**Problem:** Error "port is already allocated" + +**Solution:** +1. Check what's using the port: + ```bash + sudo lsof -i :2332 # or :50001, :50002 + ``` +2. Stop the conflicting service, or change ports in `docker-compose.yml` + +### Disk Space Running Out + +**Problem:** Blockchain takes too much space + +**Solution:** +- The Palladium blockchain can be several GB +- Make sure you have enough space in the project directory +- Check disk usage: + ```bash + df -h + du -sh palladium-node-data/ + du -sh data/ + ``` + +### Binary Architecture Mismatch + +**Problem:** "cannot execute binary file: Exec format error" + +**Solution:** +- You're using binaries for the wrong architecture +- Check your system: `uname -m` + - `x86_64` → need x86_64 Linux binaries + - `aarch64` → need ARM64 Linux binaries +- Download the correct binaries and replace them in `daemon/` +- Rebuild: `docker-compose build --no-cache` + --- ## Testing with `test-server.py` diff --git a/daemon/palladium-cli b/daemon/palladium-cli new file mode 100755 index 0000000..b33e541 Binary files /dev/null and b/daemon/palladium-cli differ diff --git a/daemon/palladiumd b/daemon/palladiumd new file mode 100755 index 0000000..9bb8d1f Binary files /dev/null and b/daemon/palladiumd differ diff --git a/docker-compose.yml b/docker-compose.yml index e967efa..f28f049 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,28 +1,55 @@ services: + palladiumd: + build: + context: . + dockerfile: Dockerfile.palladium-node + image: palladium-node:local + container_name: palladium-node + restart: unless-stopped + ports: + - "0.0.0.0:2332:2332" # RPC port mainnet (accessible from network) + - "0.0.0.0:2333:2333" # P2P port mainnet (accessible from network) + - "0.0.0.0:28332:28332" # ZMQ hashblock (accessible from network) + - "0.0.0.0:28334:28334" # ZMQ rawblock (accessible from network) + - "0.0.0.0:28335:28335" # ZMQ rawtx (accessible from network) + # For testnet, expose: 12332 (RPC) and 12333 (P2P) + + volumes: + # Mount palladium-node-data folder (contains config and blockchain data) + - ./palladium-node-data:/root/.palladium + + command: > + palladiumd + -conf=/root/.palladium/palladium.conf + -datadir=/root/.palladium + -rpcbind=0.0.0.0 + -rpcallowip=0.0.0.0/0 + -daemon=0 + -printtoconsole=1 + electrumx: build: context: . - dockerfile: Dockerfile - image: electrumx-plm:local - container_name: electrumx-plm + dockerfile: Dockerfile.electrumx + image: electrumx-server:local + container_name: electrumx-server restart: unless-stopped - extra_hosts: - - "host.docker.internal:host-gateway" + depends_on: + - palladiumd ports: - - "50001:50001" # TCP - - "50002:50002" # SSL + - "0.0.0.0:50001:50001" # TCP (accessible from network) + - "0.0.0.0:50002:50002" # SSL (accessible from network) environment: # ===== Network Configuration ===== - # For MAINNET use: COIN: "Palladium", NET: "mainnet" and DAEMON_URL port 2332 - # For TESTNET use: COIN: "Palladium", NET: "testnet" and DAEMON_URL port 12332 + # For MAINNET use: COIN: "Palladium", NET: "mainnet" + # For TESTNET use: COIN: "Palladium", NET: "testnet" COIN: "Palladium" # Always "Palladium" for both networks NET: "mainnet" - # Palladium Core RPC connection - # MAINNET: port 2332 | TESTNET: port 12332 - DAEMON_URL: "http://:@host.docker.internal:2332/" # RPC credentials + # NOTE: RPC credentials are automatically read from palladium.conf + # No need to configure DAEMON_URL manually anymore! SERVICES: "tcp://0.0.0.0:50001,ssl://0.0.0.0:50002" @@ -42,4 +69,5 @@ services: hard: 1048576 volumes: - - ./data:/data \ No newline at end of file + - ./electrumx-data:/data + - ./palladium-node-data/palladium.conf:/palladium-config/palladium.conf:ro \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..9dd47de --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,57 @@ +#!/bin/bash +set -e + +PALLADIUM_CONF="/palladium-config/palladium.conf" + +# Function to extract value from palladium.conf +get_conf_value() { + local key=$1 + local value=$(grep "^${key}=" "$PALLADIUM_CONF" 2>/dev/null | cut -d'=' -f2- | tr -d ' \r\n') + echo "$value" +} + +# Check if palladium.conf exists +if [ ! -f "$PALLADIUM_CONF" ]; then + echo "ERROR: palladium.conf not found at $PALLADIUM_CONF" + echo "Please ensure the palladium-node-data volume is mounted correctly." + exit 1 +fi + +# Extract RPC credentials from palladium.conf +RPC_USER=$(get_conf_value "rpcuser") +RPC_PASSWORD=$(get_conf_value "rpcpassword") +RPC_PORT=$(get_conf_value "rpcport") + +# Validate extracted credentials +if [ -z "$RPC_USER" ] || [ -z "$RPC_PASSWORD" ]; then + echo "ERROR: Unable to extract rpcuser or rpcpassword from palladium.conf" + echo "Please ensure your palladium.conf contains:" + echo " rpcuser=your_username" + echo " rpcpassword=your_password" + exit 1 +fi + +# Default RPC port based on network if not specified in conf +if [ -z "$RPC_PORT" ]; then + if [ "$NET" = "testnet" ]; then + RPC_PORT=12332 + else + RPC_PORT=2332 + fi +fi + +# Build DAEMON_URL with extracted credentials +export DAEMON_URL="http://${RPC_USER}:${RPC_PASSWORD}@palladiumd:${RPC_PORT}/" + +echo "==========================================" +echo "ElectrumX Configuration" +echo "==========================================" +echo "Coin: ${COIN}" +echo "Network: ${NET}" +echo "RPC User: ${RPC_USER}" +echo "RPC Port: ${RPC_PORT}" +echo "DAEMON_URL: http://${RPC_USER}:***@palladiumd:${RPC_PORT}/" +echo "==========================================" + +# Execute the original electrumx command +exec /usr/local/bin/electrumx_server diff --git a/palladium-node-data/palladium.conf b/palladium-node-data/palladium.conf new file mode 100644 index 0000000..c72922f --- /dev/null +++ b/palladium-node-data/palladium.conf @@ -0,0 +1,38 @@ +rpcuser=username +rpcpassword=password + +server=1 +listen=1 +daemon=1 +discover=1 +txindex=1 +addressindex=1 +timestampindex=1 +spentindex=1 + +# pruned = 0 + +bind=0.0.0.0 +port=2333 +rpcport=2332 +rpcbind=0.0.0.0 + +rpcallowip=172.17.0.0/16 +rpcallowip=172.18.0.0/16 + +maxconnections=50 +fallbackfee=0.0001 + +# Addnodes: +seednode=dnsseed.palladium-coin.store + +addnode=89.117.149.130:2333 +addnode=66.94.115.80:2333 +addnode=173.212.224.67:2333 +addnode=82.165.218.152:2333 + +# ZeroMQ Configuration +zmqpubrawblock=tcp://0.0.0.0:28334 +zmqpubrawtx=tcp://0.0.0.0:28335 +zmqpubhashblock=tcp://0.0.0.0:28332 +zmqpubhashtx=tcp://0.0.0.0:28333