Create new config params
MODIFY
WalletWasabi.Backend/Config.cs
WalletWasabi.Backend/Config.cs
@@ -27,6 +27,32 @@ namespace WalletWasabi.Backend
[JsonProperty(PropertyName = "BitcoinRpcConnectionString")]
public string BitcoinRpcConnectionString { get; private set; }
+ [JsonProperty(PropertyName = "MainNetBitcoinP2pEndPoint")]
+ [JsonConverter(typeof(EndPointJsonConverter), Constants.DefaultMainNetBintcoinP2pPort)]
+ public EndPoint MainNetBitcoinP2PEndPoint { get; internal set; }
+
+ [JsonProperty(PropertyName = "TestNetBitcoinP2pEndPoint")]
+ [JsonConverter(typeof(EndPointJsonConverter), Constants.DefaultTestNetBintcoinP2pPort)]
+ public EndPoint TestNetBitcoinP2pEndPoint { get; internal set; }
+
+ [JsonProperty(PropertyName = "RegTestBitcoinP2pEndPoint")]
+ [JsonConverter(typeof(EndPointJsonConverter), Constants.DefaultRegTestBintcoinP2pPort)]
+ public EndPoint RegTestBitcoinP2pEndPoint { get; internal set; }
+
+ [JsonProperty(PropertyName = "MainNetBitcoinCoreRpcEndPoint")]
+ [JsonConverter(typeof(EndPointJsonConverter), Constants.DefaultMainNetBintcoinCoreRpcPort)]
+ public EndPoint MainNetBitcoinCoreRpcEndPoint { get; internal set; }
+
+ [JsonProperty(PropertyName = "TestNetBitcoinCoreRpcEndPoint")]
+ [JsonConverter(typeof(EndPointJsonConverter), Constants.DefaultTestNetBintcoinCoreRpcPort)]
+ public EndPoint TestNetBitcoinCoreRpcEndPoint { get; internal set; }
+
+ [JsonProperty(PropertyName = "RegTestBitcoinCoreRpcEndPoint")]
+ [JsonConverter(typeof(EndPointJsonConverter), Constants.DefaultRegTestBintcoinCoreRpcPort)]
+ public EndPoint RegTestBitcoinCoreRpcEndPoint { get; internal set; }
+
+ #region Deleteme
+
[JsonProperty(PropertyName = "MainNetBitcoinCoreHost")]
public string MainNetBitcoinCoreHost { get; internal set; }
@@ -45,6 +71,8 @@ namespace WalletWasabi.Backend
[JsonProperty(PropertyName = "RegTestBitcoinCorePort")]
public int? RegTestBitcoinCorePort { get; internal set; }
+ #endregion Deleteme
+
private EndPoint _bitcoinCoreEndPoint;
public EndPoint GetBitcoinCoreEndPoint()

MODIFY
WalletWasabi.Gui/Config.cs
WalletWasabi.Gui/Config.cs
@@ -44,6 +44,24 @@ namespace WalletWasabi.Gui
[JsonProperty(PropertyName = "UseTor")]
public bool? UseTor { get; internal set; }
+ [JsonProperty(PropertyName = "TorSocks5EndPoint")]
+ [JsonConverter(typeof(EndPointJsonConverter), Constants.DefaultTorSocksPort)]
+ public EndPoint TorSocks5EndPoint { get; internal set; }
+
+ [JsonProperty(PropertyName = "MainNetBitcoinP2pEndPoint")]
+ [JsonConverter(typeof(EndPointJsonConverter), Constants.DefaultMainNetBintcoinP2pPort)]
+ public EndPoint MainNetBitcoinP2PEndPoint { get; internal set; }
+
+ [JsonProperty(PropertyName = "TestNetBitcoinP2pEndPoint")]
+ [JsonConverter(typeof(EndPointJsonConverter), Constants.DefaultTestNetBintcoinP2pPort)]
+ public EndPoint TestNetBitcoinP2pEndPoint { get; internal set; }
+
+ [JsonProperty(PropertyName = "RegTestBitcoinP2pEndPoint")]
+ [JsonConverter(typeof(EndPointJsonConverter), Constants.DefaultRegTestBintcoinP2pPort)]
+ public EndPoint RegTestBitcoinP2pEndPoint { get; internal set; }
+
+ #region Deleteme
+
[JsonProperty(PropertyName = "TorHost")]
public string TorHost { get; internal set; }
@@ -68,6 +86,8 @@ namespace WalletWasabi.Gui
[JsonProperty(PropertyName = "RegTestBitcoinCorePort")]
public int? RegTestBitcoinCorePort { get; internal set; }
+ #endregion Deleteme
+
[JsonProperty(PropertyName = "MixUntilAnonymitySet")]
public int? MixUntilAnonymitySet
{
@@ -325,6 +345,7 @@ namespace WalletWasabi.Gui
public async Task LoadFileAsync()
{
string jsonString = await File.ReadAllTextAsync(FilePath, Encoding.UTF8);
+
var config = JsonConvert.DeserializeObject<Config>(jsonString);
Network = config.Network ?? Network;

MODIFY
WalletWasabi/Helpers/Constants.cs
WalletWasabi/Helpers/Constants.cs
@@ -80,5 +80,18 @@ namespace WalletWasabi.Helpers
public const int OneDayConfirmationTarget = 144;
public const int SevenDaysConfirmationTarget = 1008;
+
+ public const int DefaultTorSocksPort = 9050;
+ public const int DefaultTorBrowserSocksPort = 9150;
+ public const int DefaultTorControlPort = 9051;
+ public const int DefaultTorBrowserControlPort = 9151;
+
+ public const int DefaultMainNetBintcoinP2pPort = 8333;
+ public const int DefaultTestNetBintcoinP2pPort = 18333;
+ public const int DefaultRegTestBintcoinP2pPort = 18444;
+
+ public const int DefaultMainNetBintcoinCoreRpcPort = 8332;
+ public const int DefaultTestNetBintcoinCoreRpcPort = 18332;
+ public const int DefaultRegTestBintcoinCoreRpcPort = 18443;
}
}

ADD
WalletWasabi/JsonConverters/EndPointJsonConverter.cs
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Net;
+using System.Text;
+using WalletWasabi.Helpers;
+
+namespace WalletWasabi.JsonConverters
+{
+ public class EndPointJsonConverter : JsonConverter
+ {
+ public int DefaultPort { get; }
+
+ private EndPointJsonConverter()
+ {
+ }
+
+ public EndPointJsonConverter(int defaultPort)
+ {
+ if (DefaultPort == 0)
+ {
+ throw new ArgumentException("Default port not specified.", nameof(DefaultPort));
+ }
+
+ DefaultPort = defaultPort;
+ }
+
+ /// <inheritdoc />
+ public override bool CanConvert(Type objectType)
+ {
+ return objectType == typeof(EndPoint);
+ }
+
+ /// <inheritdoc />
+ public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
+ {
+ string endPointString = Guard.Correct(reader.Value as string);
+ endPointString = endPointString.TrimEnd('/');
+ endPointString = endPointString.TrimEnd(':');
+
+ var lastIndex = endPointString.LastIndexOf(':');
+
+ string portString = null;
+ if (lastIndex != -1)
+ {
+ portString = endPointString.Substring(endPointString.LastIndexOf(':') + 1);
+ }
+
+ if (portString is null || !int.TryParse(portString, out int port))
+ {
+ port = DefaultPort;
+ }
+
+ string host = endPointString.TrimEnd(portString, StringComparison.OrdinalIgnoreCase).TrimEnd(':');
+
+ EndPoint endPoint;
+ if (IPAddress.TryParse(host, out IPAddress addr))
+ {
+ endPoint = new IPEndPoint(addr, port);
+ }
+ else
+ {
+ endPoint = new DnsEndPoint(host, port);
+ }
+
+ return endPoint;
+ }
+
+ /// <inheritdoc />
+ public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
+ {
+ string host;
+ int port;
+ if (value is DnsEndPoint dnsEndPoint)
+ {
+ host = dnsEndPoint.Host;
+ port = dnsEndPoint.Port;
+ }
+ else if (value is IPEndPoint ipEndPoint)
+ {
+ host = ipEndPoint.Address.ToString();
+ port = ipEndPoint.Port;
+ }
+ else
+ {
+ throw new FormatException($"Invalid endpoint: {value.ToString()}");
+ }
+
+ if (port == 0)
+ {
+ port = DefaultPort;
+ }
+
+ var endPointString = $"{host}:{port}";
+
+ writer.WriteValue(endPointString);
+ }
+ }
+}

Create new config params