From 764cd3816ab94746a980a7a9a9ee6e82fc35ccba Mon Sep 17 00:00:00 2001 From: fkolakovic Date: Wed, 1 May 2024 10:46:33 +0200 Subject: [PATCH] Change RPC port number --- contrib/linearize/README.md | 2 +- contrib/linearize/linearize-hashes.py | 2 +- contrib/zmq/zmq_sub.py | 12 ++++++------ doc/JSON-RPC-interface.md | 10 +++++----- doc/REST-interface.md | 8 ++++---- doc/zmq.md | 4 ++-- src/bitcoin-cli.cpp | 2 +- src/chainparamsbase.cpp | 6 +++--- src/rpc/util.cpp | 4 ++-- src/test/rpc_tests.cpp | 6 +++--- 10 files changed, 28 insertions(+), 28 deletions(-) diff --git a/contrib/linearize/README.md b/contrib/linearize/README.md index 25a1c7351a297c..50701ff53fa7de 100644 --- a/contrib/linearize/README.md +++ b/contrib/linearize/README.md @@ -11,7 +11,7 @@ Required configuration file settings for linearize-hashes: Optional config file setting for linearize-hashes: * RPC: `host` (Default: `127.0.0.1`) -* RPC: `port` (Default: `8332`) +* RPC: `port` (Default: `6332`) * Blockchain: `min_height`, `max_height` * `rev_hash_bytes`: If true, the written block hash list will be byte-reversed. (In other words, the hash returned by getblockhash will have its diff --git a/contrib/linearize/linearize-hashes.py b/contrib/linearize/linearize-hashes.py index 695bafad3428c5..fe3b62a827378f 100755 --- a/contrib/linearize/linearize-hashes.py +++ b/contrib/linearize/linearize-hashes.py @@ -114,7 +114,7 @@ def get_rpc_cookie(): if 'host' not in settings: settings['host'] = '127.0.0.1' if 'port' not in settings: - settings['port'] = 8332 + settings['port'] = 6332 if 'min_height' not in settings: settings['min_height'] = 0 if 'max_height' not in settings: diff --git a/contrib/zmq/zmq_sub.py b/contrib/zmq/zmq_sub.py index d8087a4db387c5..0204bf7503a398 100755 --- a/contrib/zmq/zmq_sub.py +++ b/contrib/zmq/zmq_sub.py @@ -8,11 +8,11 @@ Bitcoin should be started with the command line arguments: bitcoind -testnet -daemon \ - -zmqpubrawtx=tcp://127.0.0.1:28332 \ - -zmqpubrawblock=tcp://127.0.0.1:28332 \ - -zmqpubhashtx=tcp://127.0.0.1:28332 \ - -zmqpubhashblock=tcp://127.0.0.1:28332 \ - -zmqpubsequence=tcp://127.0.0.1:28332 + -zmqpubrawtx=tcp://127.0.0.1:26332 \ + -zmqpubrawblock=tcp://127.0.0.1:26332 \ + -zmqpubhashtx=tcp://127.0.0.1:26332 \ + -zmqpubhashblock=tcp://127.0.0.1:26332 \ + -zmqpubsequence=tcp://127.0.0.1:26332 We use the asyncio library here. `self.handle()` installs itself as a future at the end of the function. Since it never returns with the event @@ -34,7 +34,7 @@ print("This example only works with Python 3.5 and greater") sys.exit(1) -port = 28332 +port = 26332 class ZMQHandler(): def __init__(self): diff --git a/doc/JSON-RPC-interface.md b/doc/JSON-RPC-interface.md index ec332d23ebee50..f6fbecd8cd3a0d 100644 --- a/doc/JSON-RPC-interface.md +++ b/doc/JSON-RPC-interface.md @@ -32,11 +32,11 @@ requests when multiple wallets are in use. ### Examples ```sh -# Get block count from the / endpoint when rpcuser=alice and rpcport=38332 -$ curl --user alice --data-binary '{"jsonrpc": "1.0", "id": "0", "method": "getblockcount", "params": []}' -H 'content-type: text/plain;' localhost:38332/ +# Get block count from the / endpoint when rpcuser=alice and rpcport=36332 +$ curl --user alice --data-binary '{"jsonrpc": "1.0", "id": "0", "method": "getblockcount", "params": []}' -H 'content-type: text/plain;' localhost:36332/ -# Get balance from the /wallet/walletname endpoint when rpcuser=alice, rpcport=38332 and rpcwallet=desc-wallet -$ curl --user alice --data-binary '{"jsonrpc": "1.0", "id": "0", "method": "getbalance", "params": []}' -H 'content-type: text/plain;' localhost:38332/wallet/desc-wallet +# Get balance from the /wallet/walletname endpoint when rpcuser=alice, rpcport=36332 and rpcwallet=desc-wallet +$ curl --user alice --data-binary '{"jsonrpc": "1.0", "id": "0", "method": "getbalance", "params": []}' -H 'content-type: text/plain;' localhost:36332/wallet/desc-wallet ``` @@ -126,7 +126,7 @@ RPC interface will be abused. need to expose the RPC port to the host system. The default way to do this in Docker also exposes the port to the public Internet. Instead, expose it only on the host system's localhost, for example: - `-p 127.0.0.1:8332:8332` + `-p 127.0.0.1:6332:6332` - **Secure authentication:** By default, when no `rpcpassword` is specified, Bitcoin Core generates unique login credentials each time it restarts and puts them into a file diff --git a/doc/REST-interface.md b/doc/REST-interface.md index 2d7d0e3769367a..f600c058c99f86 100644 --- a/doc/REST-interface.md +++ b/doc/REST-interface.md @@ -3,8 +3,8 @@ Unauthenticated REST Interface The REST API can be enabled with the `-rest` option. -The interface runs on the same port as the JSON-RPC interface, by default port 8332 for mainnet, port 18332 for testnet, -port 38332 for signet, and port 18443 for regtest. +The interface runs on the same port as the JSON-RPC interface, by default port 6332 for mainnet, port 16332 for testnet, +port 36332 for signet, and port 18443 for regtest. REST Interface consistency guarantees ------------------------------------- @@ -106,7 +106,7 @@ input and output serialization (relevant for `bin` and `hex` output formats). Example: ``` -$ curl localhost:18332/rest/getutxos/checkmempool/b2cdfd7b89def827ff8af7cd9bff7627ff72e5e8b0f71210f92ea7a4000c5d75-0.json 2>/dev/null | json_pp +$ curl localhost:16332/rest/getutxos/checkmempool/b2cdfd7b89def827ff8af7cd9bff7627ff72e5e8b0f71210f92ea7a4000c5d75-0.json 2>/dev/null | json_pp { "chainHeight" : 325347, "chaintipHash" : "00000000fb01a7f3745a717f8caebee056c484e6e0bfe4a9591c235bb70506fb", @@ -146,4 +146,4 @@ Refer to the `getrawmempool` RPC help for details. Defaults to setting Risks ------------- -Running a web browser on the same node with a REST enabled bitcoind can be a risk. Accessing prepared XSS websites could read out tx/block data of your node by placing links like `