Return-Path: Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) by lists.linuxfoundation.org (Postfix) with ESMTP id C2A07C000B for ; Sat, 29 Jan 2022 22:02:28 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 9ECDB40893 for ; Sat, 29 Jan 2022 22:02:28 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org X-Spam-Flag: NO X-Spam-Score: -0.2 X-Spam-Level: X-Spam-Status: No, score=-0.2 tagged_above=-999 required=5 tests=[BAYES_20=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=0.001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no Authentication-Results: smtp4.osuosl.org (amavisd-new); dkim=pass (2048-bit key) header.d=tutanota.de Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id JPvsKQWgMpn5 for ; Sat, 29 Jan 2022 22:02:27 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0 Received: from w1.tutanota.de (w1.tutanota.de [81.3.6.162]) by smtp4.osuosl.org (Postfix) with ESMTPS id 4814140892 for ; Sat, 29 Jan 2022 22:02:26 +0000 (UTC) Received: from w3.tutanota.de (unknown [192.168.1.164]) by w1.tutanota.de (Postfix) with ESMTP id 8A0E9FBF851 for ; Sat, 29 Jan 2022 22:02:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1643493744; s=s1; d=tutanota.de; h=From:From:To:To:Subject:Subject:Content-Description:Content-ID:Content-Type:Content-Type:Content-Transfer-Encoding:Cc:Date:Date:In-Reply-To:MIME-Version:MIME-Version:Message-ID:Message-ID:Reply-To:References:Sender; bh=qrJel2zdSD6YHIpJu9e5dBNwSMcKPALOGB8mRI9WsJ0=; b=3te9zBy3Vsn26AI4lldxV1kIkULz91DZk7zBtQExqiimCX/d4YQcCTUC8kcdFq/F bm8fFz0X4FtJT4kdz5SPYsfA1ILiM6O7yKwpuIHw2+Dfe8oLj3/AR4yEigq8dfqBO1U nqifU0paZAlfYYaCy6LDmDoTFXqs8yQvHspV6FMoC9KHCCJJlwgQyoHv0wRRSAMIKY9 02xdp3dZjrsFcostVZEZSJNB7ykaxFsfQOLepIat1Vgd62ye904Zgtt85FMJXpWBmr0 +xY5Af3wT9li8AWw9d4oPKYaeM+GFlPVej2+2TlX1Lmp6hD9UUOLsCNm78zWkdRQgRI sC+LA68C5g== Date: Sat, 29 Jan 2022 23:02:24 +0100 (CET) From: Prayank To: Bitcoin Dev Message-ID: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_290858_1540062542.1643493744552" X-Mailman-Approved-At: Sat, 29 Jan 2022 23:26:53 +0000 Subject: [bitcoin-dev] non-default ports for automatic connections in Bitcoin P2P network X-BeenThere: bitcoin-dev@lists.linuxfoundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Bitcoin Protocol Discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jan 2022 22:02:28 -0000 ------=_Part_290858_1540062542.1643493744552 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable ## Using non-default ports for automatic connections in Bitcoin P2P network ISPs can block default port 8333 used by Bitcoin nodes. One example: https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2015-September/0107= 98.html While it would still be possible for crawlers and scanners to know about bi= tcoin nodes listening on non-default ports using other methods, it can be h= elpful in lot of countries that use basic things to block: domain, port etc= . In October 2021 a [pull request][1] was merged in Bitcoin Core in which lot= of contributors agreed to allow non default ports for automatic connections. It did not imp= lement everything, was limited to discussing the concept and allow AddrMan to support multiple= ports per IP. It was followed by another [pull request][2] in November 2021 which is stil= l open and makes most of the changes required for non-default ports to work with automatic connec= tions. I could not find any major issues with the changes however had some nits in= cluding a discussion on mailing list which was even requested by a few other reviewers. =3D=3D=3DThings that I found during my review, research and testing=3D=3D= =3D 1.One user had posted about issues with default port 8333 on [bitcointalk][= 3] in July 2010. VMWare server also used port 8333 so an option was requested to change port. This option = was added in [May 2011][4] by Gavin Andresen. Gavin has discussed this opti= on and related issues in detail with others on [bitcointalk][5]. 2.I tried running signet for 1 hour v22.0 and 1 hour PR branch with debug= =3Dnet. v22.0 had only 38333 port with different IPs in debug.log for conne= ctions. PR branch had 2 feeler connections with non-default ports 38331 and= 13833. Note: Default ports used in Bitcoin Core are 8333(mainnet), 18333(testnet),= 18444(regtest) and 38333(signet) 3.Wrote a [PowerShell script][6] and tested it on v22.0 and PR branch which= bans all peers every 100 seconds using default port. It works as expected = and I could see one peer using port 3111 on signet. 4.I am not sure about the 'bad ports' list in Bitcoin Core added in PR #235= 42 8333 in leet becomes 'beee' in plain text. Not sure if this was considered = by Satoshi to hardcode 8333 for Bitcoin. =C2=A0 [1]: https://github.com/bitcoin/bitcoin/pull/23306 =C2=A0 [2]: https://github.com/bitcoin/bitcoin/pull/23542 =C2=A0 [3]: https://bitcointalk.org/index.php?topic=3D322.0 =C2=A0 [4]: https://github.com/bitcoin/bitcoin/pull/221 =C2=A0 [5]: https://bitcointalk.org/index.php?topic=3D589.0 =C2=A0 [6]: https://github.com/prayank23/bitcoin-ps-scripts/blob/main/Scrip= ts/Node/ban_default_peers.ps1 --=20 Prayank A3B1 E430 2298 178F ------=_Part_290858_1540062542.1643493744552 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
## Using non-default ports for automatic connections in Bitcoin P2P ne= twork


ISPs can block default port 8333 used by Bitcoin nodes. One e= xample:
https://lists.linuxfoundation.org/piperm= ail/bitcoin-dev/2015-September/010798.html

<= /div>
While it would still be possible for crawlers and sc= anners to know about bitcoin nodes listening on non-default ports using oth= er methods, it can be helpful in lot of countries that use basic things to = block: domain, port etc.

In October 2021 a [pull request][1] was merged in Bitcoin Core in whic= h lot of contributors
agreed to allow non defaul= t ports for automatic connections. It did not implement everything,
was limited to discussing the concept and allow AddrMan= to support multiple ports per IP.

It was followed by another [pull request][2] in November 202= 1 which is still open and makes most
of the chan= ges required for non-default ports to work with automatic connections.
<= /div>

I could not find any maj= or issues with the changes however had some nits including a discussion on<= br>
mailing list which was even requested by a few o= ther reviewers.


=
=3D=3D=3DThings that I found during my review, rese= arch and testing=3D=3D=3D

1.One user had posted about issues with default port 8333 on [bitcoin= talk][3] in July 2010. VMWare server
also used p= ort 8333 so an option was requested to change port. This option was added i= n [May 2011][4] by Gavin Andresen. Gavin has discussed this option and rela= ted issues in detail with others on [bitcointalk][5].

2.I tried running signet for 1 hour v22.0= and 1 hour PR branch with debug=3Dnet. v22.0 had only 38333 port with diff= erent IPs in debug.log for connections. PR branch had 2 feeler connections = with non-default ports 38331 and 13833.

Note: Default ports used in Bitcoin Core are 8333(mainn= et), 18333(testnet), 18444(regtest) and 38333(signet)

3.Wrote a [PowerShell script][6] and test= ed it on v22.0 and PR branch which bans all peers every 100 seconds using d= efault port. It works as expected and I could see one peer using port 3111 = on signet.

4.I am no= t sure about the 'bad ports' list in Bitcoin Core added in PR #23542


8333 in leet becomes 'beee' in plain text. Not sure if this was considere= d by Satoshi to hardcode 8333 for Bitcoin.

<= /div>

  [1]: https://gith= ub.com/bitcoin/bitcoin/pull/23306
  [2]: ht= tps://github.com/bitcoin/bitcoin/pull/23542
&nbs= p; [3]: https://bitcointalk.org/index.php?topic=3D322.0
  [4]: https://github.com/bitcoin/bitcoin/pull/221
=
  [5]: https://bitcointalk.org/index.php?topic=3D589= .0
  [6]: https://github.com/prayank23/bitc= oin-ps-scripts/blob/main/Scripts/Node/ban_default_peers.ps1
<= br>
--
Prayank

A3B1 E430 2298 178F
------=_Part_290858_1540062542.1643493744552--