- Remove inline Palladium coin definition from Dockerfile.electrumx and COPY coins_plm.py instead, reducing duplication - Add TX_COUNT/TX_COUNT_HEIGHT/TX_PER_BLOCK to coins_plm.py with real chain data (457478 txs at height 382404) - Update entrypoint.sh to fetch live TX stats from palladiumd at container startup, keeping sync estimates accurate automatically
65 lines
1.6 KiB
Docker
65 lines
1.6 KiB
Docker
FROM lukechilds/electrumx
|
|
|
|
# Copy Palladium coin definition and patch ElectrumX
|
|
COPY electrumx-patch/coins_plm.py /tmp/coins_plm.py
|
|
|
|
RUN python3 - <<'PATCH'
|
|
import pathlib, re
|
|
|
|
patch = pathlib.Path('/tmp/coins_plm.py').read_text()
|
|
# Extract only class definitions (skip import lines)
|
|
classes = re.split(r'^(?=class )', patch, flags=re.MULTILINE)
|
|
classes = [c for c in classes if c.strip().startswith('class ')]
|
|
body = '\n' + '\n'.join(classes)
|
|
|
|
for target in [
|
|
'/usr/local/lib/python3.13/dist-packages/electrumx/lib/coins.py',
|
|
'/electrumx/src/electrumx/lib/coins.py',
|
|
]:
|
|
p = pathlib.Path(target)
|
|
if p.exists():
|
|
s = p.read_text()
|
|
if 'class Palladium(Bitcoin):' not in s:
|
|
p.write_text(s + body)
|
|
|
|
print('>> Patched ElectrumX with Palladium coin classes')
|
|
PATCH
|
|
|
|
RUN mkdir -p /certs && \
|
|
cat >/certs/openssl.cnf <<'EOF' && \
|
|
openssl req -x509 -nodes -newkey rsa:4096 -days 3650 \
|
|
-keyout /certs/server.key -out /certs/server.crt \
|
|
-config /certs/openssl.cnf && \
|
|
chmod 600 /certs/server.key && chmod 644 /certs/server.crt
|
|
[req]
|
|
distinguished_name = dn
|
|
x509_extensions = v3_req
|
|
prompt = no
|
|
|
|
[dn]
|
|
C = IT
|
|
ST = -
|
|
L = -
|
|
O = ElectrumX
|
|
CN = plm.local
|
|
|
|
[v3_req]
|
|
keyUsage = keyEncipherment, dataEncipherment, digitalSignature
|
|
extendedKeyUsage = serverAuth
|
|
subjectAltName = @alt_names
|
|
|
|
[alt_names]
|
|
DNS.1 = plm.local
|
|
IP.1 = 127.0.0.1
|
|
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"]
|