Skip to content

Define hardcoded ports  #457

Open
Open

Description

@tropicar

Is your feature request related to a problem? Please describe.

Setting up random ports in docker-compose files seems to provoke a problem to find incoming peers in the blockchain clients. Without properly broadcasting and opening the P2P ports for each client other peers cannot connect to your client which harms decentralization since in this situation you are not contributing to the network by sharing your info with peers you're only taking info when you have no inbound peers.

Describe the solution you'd like

The solution would be to add a hardcoded port and set up the client to use this port. To be able to do this, we have to define a clear way to define what ports we will use for the different clients and chains.

We will use 3 values in order to define what number port will be hardcoded in the package:

  • ChainID of the chain multiplied by 10, it will be 0 if the chain has no specified chain ID value.
  • P2P default value
  • ClientID (It's a value we define for every client)

The sum of the 3 above values for each package will be the defined P2P port(s) for the package. This avoids port collisions caused by many clients using the same P2P port and also using the same client with up to 5 separate network implementations again trying to use the same port.

Additional Schema Rules (i.e. the chainID value is larger than the port range)

  • In the beacon-chain clients, the chainID value will be equal to the value of the Execution layers for that network (i.e. Prater network chain ID is equal to its merged EL Goerli so both chain IDs are 50).
  • If the chainID has more than 5 digits, we use the last 4 digits only.(chainID: 431140, we use 1140).
Package Name ChainID P2P port by default ClientID Hardcoded Port Published update
Geth 10 30303 0 30403 ✔️
Goerli Geth 50 30303 0 30803 ✔️
Lukso Geth 2828 30303 0 33141 ❌
Besu 10 30303 11 30414 ✔️
Besu Goerli 50 30303 11 30814 ✔️
Nethermind 10 30303 1 30404 ✔️
Nethermind Goerli 50 30303 1 30804 ✔️
Nethermind Ropsten 30 30303 1 30604 ✔️
Nethermind Chiado 10200 (200) 30303 1 32304 ✔️
Erigon 10 30303 2 30405 ✔️
Erigon Gnosis 1000 30303 2 31305 ✔️
Erigon Gnosis Torrent 1000 42069 2 43084 ✔️
Erigon Gnosis Caplin 1000 UDP/4000 & TCP/4001 15 UDP/5015 & TCP/5016 ✔️
Erigon Goerli 50 30303 2 30805 ✔️
Erigon Ropsten 30 30303 2 30605 ✔️
Prysm 10 TCP/13000 & UDP/12000 3 TCP/13103 & UDP/12103 ❌
Prysm Sepolia 11155111 (5111) TCP/13000 & UDP/12000 3 TCP/19114 & UDP/18114 ❌
Prysm Ropsten 30 3 TCP/13303 & UDP/12303 ✔️
Prysm Prater 50 TCP/13000 & UDP/12000 3 TCP/13503 & UDP/12503 Merged ✔️
Gnosis Beacon Chain Prysm 1000 TCP/13000 & UDP/12000 3 TCP/14003 & UDP/13003 ❌
Prysm Chiado 10200 (200) TCP/13000 & UDP/12000 3 TCP/15003 & UDP/14003 ❌
Teku Ethereum 10 TCP/9000 & UDP/9000 5 TCP/9105 & UDP/9105 ✔️
Teku Gnosis 1000 TCP/9000 & UDP/9000 5 TCP/19005 & UDP/19005 ✔️
Teku Ropsten 30 TCP/9000 & UDP/9000 5 TCP/9305 & UDP/9305 ✔️
Teku Prater 50 TCP/9000 & UDP/9000 5 TCP/9505 & UDP/9505 ✔️
Teku Chiado 10200 (200) TCP/9000 & UDP/9000 5 TCP/1105 & UDP/11005 ❌
Nimbus Ethereum 10 TCP/9000 & UDP/9000 6 TCP/9106 & UDP/9106 ✔️
Nimbus Gnosis 1000 TCP/9000 & UDP/9000 6 TCP/19006 & UDP/19006 ✔️
Nimbus Prater 50 TCP/9000 & UDP/9000 6 TCP/9506 & UDP/9506 ✔️
Nimbus Chiado 10200 (200) TCP/9000 & UDP/9000 6 TCP/11006 & UDP/11006 ❌
Lighthouse Ethereum 10 TCP/9000 & UDP/9000 4 TCP/9104 & UDP/9104 ✔️
Lighthouse Gnosis 1000 TCP/9000 & UDP/9000 4 TCP/19004 & UDP/19004 ✔️
Lighthouse Ropsten 30 TCP/9000 & UDP/9000 4 TCP/9304 & UDP/9304 ✔️
Lighthouse Prater 50 TCP/9000 & UDP/9000 4 TCP/9504 & UDP/9504 ✔️
Lighthouse Chiado 10200 (200) TCP/9000 & UDP/9000 4 TCP/11004 & UDP/11004 ❌
Lodestar Ethereum 10 TCP/9000 & UDP/9000 12 TCP/9112 & UDP/9112 ✔️
Lodestar Prater 50 TCP/9000 & UDP/9000 12 TCP/9512 & UDP/9512 ✔️
Lodestar Gnosis 1000 TCP/9000 & UDP/9000 12 TCP/19012 & UDP/19012 ❌
Lodestar Chiado 10200 (200) TCP/9000 & UDP/9000 12 TCP/11012 & UDP/11012 ❌
Sepolia Geth 11155111 (5111) 30303 0 35415 ✔️
Sepolia Erigon (Execution) 1155111 (5111) 30303 1 35416 ✔️
Sepolia Erigon (Torrent Port) 1155111 (5111) 42069 TCP & UDP 2 TCP/47285 & UDP/47285 ✔️
Sepolia Erigon Caplin (Internal CL) 1155111 (5111) TCP/4000 & UDP/4001 15 TCP/9113 & UDP/9115 ✔️
Nethermind xDai 1000 30303 1 31404 ✔️
Avalanche 431140 (1140) TCP/9651 10 TCP/21061 ❌
Rinkeby 40 30303 0 30343 ❌
Ropsten 30 30303 0 30338 ✔️
Bitcoin 0 8333 7 8340 ❌
Monero 0 18080 9 18089 Merged ✔️
Zcash 0 8233 8 8241 ✔️
Ethereum Classic 610 30303 0 30913 ❌
SSV Shifu Prater 50 TCP/12001 UDP/13001 13 TCP/ 12514 UDP/13514 ✔️

The ClientID is a value we have defined:

Client ClientID
Geth 0
Nethermind 1
Erigon 2
Prysm 3
Lighthouse 4
Teku 5
Nimbus 6
Bitcoin 7
Monero 8
Zcash 9
Avalanche 10
Besu 11
Lodestar 12
SSV Shifu 13
Lukso 14
Caplin (Erigon Embedded CL) 15

┆Issue is synchronized with this Basecamp todo by Unito

Activity

  1. self-assigned this
    on Jun 30, 2022
  2. Pol-Lanski commented on Jul 4, 2022

    @Pol-Lanski
    Member

    Crucial to update the documentation with this! People doing new packages with new chains need to be aware of the logic to use the ports.

  3. alexpeterson91 commented on Jul 24, 2022

    @alexpeterson91
    Contributor

    Before we get too far is there a way to bake in an option to have an A standard a B standard a C standard etc port config for core packages required for use so that everyone wanting to run multiple DAppNodes on one LAN can choose at install time to either use the default core ports (A standard). Or have an option to click this is not the first dappnode, it asks how many you have already.
    You say 1, it does the B standard.
    If you have 2 already then the C standard and so on or something like that and only for the core packages required for each node IPFS The VPN clients. Wi-Fis. Local proxies.
    I suppose it's something to put in the installer.

  4. 3alpha commented on Jul 25, 2022

    @3alpha
    Member

    Yeah, that is a good point. At the very least, we must enable these values to be editable in DAppManager.

  5. tropicar commented on Jul 26, 2022

    @tropicar
    ContributorAuthor

    For now, we are only set up these standard ports for clients. But I agree if we will assign standards on the core package we should implement that.
    In these client packages, every user can change the standard ports from the dappmanager, true is not so user-friendly. They should change the env var and the value and port forwarding on the network config of the package.

  6. alexpeterson91 commented on Jul 26, 2022

    @alexpeterson91
    Contributor

    For now, we are only set up these standard ports for clients. But I agree if we will assign standards on the core package we should implement that.

    In these client packages, every user can change the standard ports from the dappmanager, true is not so user-friendly. They should change the env var and the value and port forwarding on the network config of the package.

    Don't we already have standards for the core packages? OpenVPN (8092,1194), Wireguard (51820), IPFS (4001,4002), HTTPS (80,443) etc?

  7. tropicar commented on Jul 29, 2022

    @tropicar
    ContributorAuthor

    Yes, and some packages like mysterium use some specific ports too.

  8. 2 remaining items

  9. alexpeterson91 commented on Sep 15, 2022

    @alexpeterson91
    Contributor
    • If the chainID has more than 5 numbers, we take the first 4 numbers only.(chainID: 431140, we take 1140 )

    So which is correct, the first 4? or last 4? because it reads as first 4 for but your example shows the last 4 digits being used.

  10. alexpeterson91 commented on Sep 15, 2022

    @alexpeterson91
    Contributor

    9125 for Lodestar, right?

    Shouldn't it be 9112?

    ChainID 10 x 10 = 100 +
    Default port 9000 = 9100 +
    ClientID 12 = 9112?

    And I added Besu Goerli and Lodestar for mainnet, prater, and gnosis. Based on the schema as I understand it. Will create repos for the ones that don't exist yet soon. Still need the upstream fix in Lodestar for the web3signer to work with lodestar but it works to sync ELs at least right now.

  11. alexpeterson91 commented on Oct 13, 2022

    @alexpeterson91
    Contributor

    This whole issue needs to be gone through and reviewed, the checks and X's cannot be relied on. I was struggling to get teku Gnosis to sync and i saw it was not done on the package but here it was marked as completed. I merged it in already, but this isnt the first ive found that was marked as done or not done only to find that the opposite is true in the package

  12. added a commit that references this issue on Oct 13, 2022
  13. added
    docDocumentation update is required
    on May 11, 2023
  14. unpinned this issue on May 11, 2023
  15. alexpeterson91 commented on Jun 9, 2023

    @alexpeterson91
    Contributor

    this issue is far from closed, well this "Issue" can be closed soon but must be converted to a repo. i will create the repo with this data, and add a page in the builder and SDK docs relating to ports. This is incredibly important for safety, reliability, and it must be standardized in the docs if we expect any partners and tech savvy users to develop packages that will be interoperable with existing packages, external ports namely P2P ports but also torrent ports, and other ports that must be open for proper functioning of a package. So far the partners whove made new packages have totally ignored this, and need to change their packages to use assigned ports not whatever they please. It's the only way dappnode even works, i discovered this issue a couple years ago when we used random constantly changing ephemeral ports that allowed no incoming connections which made each dappnode a drain on any network, defeating the goal of dappnodes. if you dont allow incoming then you give nothing back to the network, you only take from the network, which is why this was such a problem and it took a year to even get to this issue's creation. So we cant just toss it away now especially since were making it easier to for anyone to make packages, it's great we are but if they dont follow what Carlos defined here and I implemented for port usage packages will start to break each other. So i gotta get that repo up and a new page on the dev docs for requesting assigned ports for hardcoding into their packages

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

docDocumentation update is requiredenhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions