Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: BlackHatCoiner on March 04, 2021, 11:33:51 AM



Title: About GetMyExternalIP on v0.1
Post by: BlackHatCoiner on March 04, 2021, 11:33:51 AM
Satoshi's code included GetMyExternalIP, a boolean function on net.cpp. What seems curious to me is that he/she used one IP address. This creates me the following queries:
  • Did this server manage to distribute the information of all nodes? Like their IP addresses? RPC didn't exist on that early release, it was added later so you couldn't add a node with addnode. In a way, if it did, bitcoin's information was distributed from a server. The distribution was centralized. Once you connected with 72.233.89.199:80, it wouldn't matter, but you've have to connect with Satoshi's IP first. Since RPC did not exist, it was like vSeeds.
  • Isn't this Satoshi's IP? Couldn't he/she be located that way? It is a mainnet IP address.

Code:
bool GetMyExternalIP(unsigned int& ipRet)
{
    CAddress addrConnect("72.233.89.199:80"); // whatismyip.com 198-200

    SOCKET hSocket;
    if (!ConnectSocket(addrConnect, hSocket))
        return error("GetMyExternalIP() : connection to %s failed\n", addrConnect.ToString().c_str());

    char* pszGet =
        "GET /automation/n09230945.asp HTTP/1.1\r\n"
        "Host: www.whatismyip.com\r\n"
        "User-Agent: Bitcoin/0.1\r\n"
        "Connection: close\r\n"
        "\r\n";
    send(hSocket, pszGet, strlen(pszGet), 0);

    string strLine;
    while (RecvLine(hSocket, strLine))
    {
        if (strLine.empty())
        {
            if (!RecvLine(hSocket, strLine))
            {
                closesocket(hSocket);
                return false;
            }
            closesocket(hSocket);
            CAddress addr(strLine.c_str());
            printf("GetMyExternalIP() received [%s] %s\n", strLine.c_str(), addr.ToString().c_str());
            if (addr.ip == 0)
                return false;
            ipRet = addr.ip;
            return true;
        }
    }
    closesocket(hSocket);
    return error("GetMyExternalIP() : connection closed\n");
}


Title: Re: About GetMyExternalIP on v0.1
Post by: ranochigo on March 04, 2021, 11:44:27 AM
The IP address appears to belong to whatismyip.com in the past and the code just sends a request to them to get the external IP of which the request is coming from. Seems like its just used to determine the external IP of the node? IRC was used initially for them to find peers, AFAIK.


Title: Re: About GetMyExternalIP on v0.1
Post by: NotATether on March 04, 2021, 12:08:44 PM
Satoshi's code included GetMyExternalIP, a boolean function on net.cpp. What seems curious to Did this server manage to distribute the information of all nodes? Like their IP addresses? RPC didn't exist on that early release, it was added later so you couldn't add a node with addnode. In a way, if it did, bitcoin's information was distributed from a server. The distribution was centralized. Once you connected with 72.233.89.199:80, it wouldn't matter, but you've have to connect with Satoshi's IP first. Since RPC did not exist, it was like vSeeds.

A GET request cannot send the server any more data than what is in the request headers. And there are no IP addresses in them.

Isn't this Satoshi's IP? Couldn't he/she be located that way? It is a mainnet IP address.

How do you know it's not just one of his ISP's IP addresses used for NAT, that is, grouping a bunch of customers together under one IP address?



A GET request cannot send the server any more data than what is in the request headers. And there are no IP addresses in them.
Are you saying that with the whatismyip.com IP, it only took the request headers?

Yes


Title: Re: About GetMyExternalIP on v0.1
Post by: Coding Enthusiast on March 04, 2021, 12:13:20 PM
IRC was used initially for them to find peers, AFAIK.
Not to find peers but to find "your own" information and advertise "yourself" to others.

Your computer does not know its own IP address, the outside words does. So you have to ask someone else what your IP is. Early versions used this service and I believe some others added later to fetch your own IP address which would have been used in an addr message to advertise your own node if you wanted to listen for incoming connections.

Obviously the above method is relying on a centralized service so these days we rely on other nodes in a very decentralized way to tell us what our IP is. Each time you connect to another node it sends you back a version message that contains your IP which you can use in your future version and addr messages


Title: Re: About GetMyExternalIP on v0.1
Post by: BlackHatCoiner on March 04, 2021, 08:22:36 PM
The IP address appears to belong to whatismyip.com in the past and the code just sends a request to them to get the external IP of which the request is coming from.
So, bitcoin v0.1.0 could only work only when that IP was not down. Anyway, I don't think that it's that important. I don't know if the node saved the connections it received to a log file (so it wouldn't need whatismyip.com), but that version didn't last long.

A GET request cannot send the server any more data than what is in the request headers. And there are no IP addresses in them.
Are you saying that with the whatismyip.com IP, it only took the request headers?

How do you know it's not just one of his ISP's IP addresses used for NAT, that is, grouping a bunch of customers together under one IP address?
You probably can't know who exactly was, but you know that the person behind that IP was a customer. Even if it was a VPN service. Thus, you limit the people that could be. Again, though, you have no permission to ask for such information from a VPN that would be most likely closed right now. Even if we're talking about Satoshi Nakamoto.