What is the function of discport=0 and [::] in an enode address?
Asked Answered
C

1

6

I was wondering what is the function of "discport=0" at the end of an enode address for an ethereum node.

Also, I see that my enode address is populated with my IP address some of the time but populated with [::] at other times upon checking it; does anyone know why this behavior exists?

Countrywoman answered 17/2, 2018 at 14:10 Comment(1)
I think the difference is just in whether or not you specify the --nodiscover option. When you turn off discovery, the IP is omitted and the discovery port is set to 0.Marrowfat
T
3

Here is my limited understanding. discport is short for discovery UDP port. If you don't specify the UDP listening port then it defaults to the TCP listening port. By setting it to 0, you are suggesting the Operating System will find a suitable available UDP discovery port for you.

Source code

Trippet answered 27/9, 2018 at 23:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.