From ae5810bc50523373290c4ac99881ad5ea6359c2e Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Wed, 16 Oct 2013 15:01:43 -0500 Subject: [PATCH] Change default RPC port to 8334 (18334 testnet). This change paves the way for running btcwallet on the same system without having to change any settings. The well-known ports used by the reference implementation (8332 mainnet, 18332 testnet) will be exposed by the separate wallet process, which will in turn forward unknown requests to btcd via websockets (on 8334/18334). This allows the wallet process to ultimately provide a unified interface that exposes the same RPC-JSON API as the reference implementation will maintaining wallet and chain separation. --- params.go | 18 ++++++++++++------ sample-btcd.conf | 2 +- util/btcctl/btcctl.go | 2 +- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/params.go b/params.go index e6bdc882..bf235a18 100644 --- a/params.go +++ b/params.go @@ -30,7 +30,11 @@ type params struct { } // mainNetParams contains parameters specific to the main network -// (btcwire.MainNet). +// (btcwire.MainNet). NOTE: The RPC port is intentionally different than the +// reference implementation because btcd does not handle wallet requests. The +// separate wallet process listens on the well-known port and forwards requests +// it does not handle on to btcd. This approach allows the wallet process +// to emulate the full reference implementation RPC API. var mainNetParams = params{ netName: "mainnet", btcnet: btcwire.MainNet, @@ -40,7 +44,7 @@ var mainNetParams = params{ powLimitBits: btcchain.ChainParams(btcwire.MainNet).PowLimitBits, listenPort: btcwire.MainPort, peerPort: btcwire.MainPort, - rpcPort: "8332", + rpcPort: "8334", dnsSeeds: []string{ "seed.bitcoin.sipa.be", "dnsseed.bluematt.me", @@ -50,7 +54,8 @@ var mainNetParams = params{ } // regressionParams contains parameters specific to the regression test network -// (btcwire.TestNet). +// (btcwire.TestNet). NOTE: The RPC port is intentionally different than the +// reference implementation - see the mainNetParams comment for details. var regressionParams = params{ netName: "regtest", btcnet: btcwire.TestNet, @@ -60,12 +65,13 @@ var regressionParams = params{ powLimitBits: btcchain.ChainParams(btcwire.TestNet).PowLimitBits, listenPort: btcwire.RegressionTestPort, peerPort: btcwire.TestNetPort, - rpcPort: "18332", + rpcPort: "18334", dnsSeeds: []string{}, } // testNet3Params contains parameters specific to the test network (version 3) -// (btcwire.TestNet3). +// (btcwire.TestNet3). NOTE: The RPC port is intentionally different than the +// reference implementation - see the mainNetParams comment for details. var testNet3Params = params{ netName: "testnet", btcnet: btcwire.TestNet3, @@ -75,7 +81,7 @@ var testNet3Params = params{ powLimitBits: btcchain.ChainParams(btcwire.TestNet3).PowLimitBits, listenPort: btcwire.TestNetPort, peerPort: btcwire.TestNetPort, - rpcPort: "18332", + rpcPort: "18334", dnsSeeds: []string{ "testnet-seed.bitcoin.petertodd.org", "testnet-seed.bluematt.me", diff --git a/sample-btcd.conf b/sample-btcd.conf index 73e99ce2..65eea08f 100644 --- a/sample-btcd.conf +++ b/sample-btcd.conf @@ -108,7 +108,7 @@ ; norpc=1 ; The port used to listen for RPC connections. -; rpcport=8332 +; rpcport=8334 ; ------------------------------------------------------------------------------ diff --git a/util/btcctl/btcctl.go b/util/btcctl/btcctl.go index 71348743..4367ef9e 100644 --- a/util/btcctl/btcctl.go +++ b/util/btcctl/btcctl.go @@ -12,7 +12,7 @@ import ( const ( User = "rpcuser" Password = "rpcpass" - Server = "127.0.0.1:8332" + Server = "127.0.0.1:8334" ) var (