HomePhabricator

[chronik] Add support for TLS to the electrum server

Description

[chronik] Add support for TLS to the electrum server

Summary: This diff adds the API to run the Chronik Electrum JSON RPC server over TLS.

Test Plan:

# Check it starts with TCP and default port as before
./src/bitcoind -regtest -chronik -chronikelectrumbind=127.0.0.1
# Check it starts with TCP and port 50001
./src/bitcoind -regtest -chronik -chronikelectrumbind=127.0.0.1:50001
./src/bitcoind -regtest -chronik -chronikelectrumbind=127.0.0.1:50001:t

# Check it returns a meaningful error
./src/bitcoind -regtest -chronik -chronikelectrumbind=127.0.0.1:50001:
./src/bitcoind -regtest -chronik -chronikelectrumbind=127.0.0.1:50001:q # unknown protocol
./src/bitcoind -regtest -chronik -chronikelectrumbind=127.0.0.1:50001:s # missing cert and key

Generate a self signed certificate with:

openssl req -nodes -new -x509 -keyout server.key -out server.pem

Then

./src/bitcoind -regtest -chronik -chronikelectrumbind=127.0.0.1:50001:s -chronikelectrumcert=server.pem # require both cert and key
./src/bitcoind -regtest -chronik -chronikelectrumbind=127.0.0.1:50001:s -chronikelectrumprivkey=server.key # require both cert and key

# No error, tested ping via a custom ping.py script that uses electrum functions
./src/bitcoind -regtest -chronik -chronikelectrumbind=127.0.0.1:50001:s -chronikelectrumcert=server.pem -chronikelectrumprivkey=server.key

Reviewers: #bitcoin_abc, PiRK, tobias_ruck

Reviewed By: #bitcoin_abc, PiRK, tobias_ruck

Subscribers: tobias_ruck, PiRK

Differential Revision: https://reviews.bitcoinabc.org/D17333

Details

Provenance
FabienAuthored on Dec 10 2024, 09:39
FabienPushed on Dec 12 2024, 12:12
Reviewer
Restricted Project
Differential Revision
D17333: [chronik] Add support for TLS to the electrum server
Parents
rABC31d2229d41aa: [mock-chronik-client] implement ts
Branches
Unknown
Tags
Unknown