diff --git a/main.go b/main.go index 79c1498..6255492 100644 --- a/main.go +++ b/main.go @@ -14,7 +14,9 @@ import ( ) var ( - visited = struct { + uniquePeers map[string]bool + uniquePeersMu sync.RWMutex + visited = struct { sync.RWMutex nodes map[string]bool }{nodes: make(map[string]bool)} @@ -37,6 +39,10 @@ func main() { initialNodes = strings.Split(os.Args[1], " ") } + uniquePeersMu.Lock() + uniquePeers = make(map[string]bool) + uniquePeersMu.Unlock() + start := time.Now() color.Green("[%s] Starting RPC crawler...\n", start.Format("2006-01-02 15:04:05")) @@ -45,7 +51,7 @@ func main() { } // Wait for all goroutines to finish - time.Sleep(180 * time.Second) + time.Sleep(60 * time.Second) elapsed := time.Since(start) color.Green("[%s] RPC crawler completed in %s\n", time.Now().Format("2006-01-02 15:04:05"), elapsed) @@ -142,7 +148,23 @@ func CheckNode(nodeAddr string) { } netinfo, err := FetchNetInfo(client) if err == nil { - color.Green("[%s] Got net info from %s\n", time.Now().Format("2006-01-02 15:04:05"), nodeAddr) + newPeers := 0 + for _, peer := range netinfo.Peers { + rpcAddr := BuildRPCAddress(peer) + rpcAddr = NormalizeAddressWithRemoteIP(rpcAddr, peer.RemoteIP) + uniquePeersMu.Lock() + if !uniquePeers[rpcAddr] { + uniquePeers[rpcAddr] = true + newPeers++ + } + uniquePeersMu.Unlock() + } + uniquePeersMu.RLock() + totalUniquePeers := len(uniquePeers) + uniquePeersMu.RUnlock() + color.Green("[%s] Got net info from %s with %d peers, and %d new peers for a total of %d unique peers in the network\n", + time.Now().Format("2006-01-02 15:04:05"), nodeAddr, len(netinfo.Peers), newPeers, totalUniquePeers) + ctx := context.TODO() status, err := client.Status(ctx) moniker[nodeAddr] = status.NodeInfo.Moniker @@ -239,9 +261,33 @@ func WriteSectionToToml(file *os.File, nodeAddr string) { } func ProcessPeer(peer coretypes.Peer) { + commonRPCPorts := []string{ + "26657", + "36657", + "22257", + "14657", + "58657", + "33657", + "53657", + "37657", + "31657", + "10157", + "27957", + "2401", + "15957", + } rpcAddr := BuildRPCAddress(peer) rpcAddr = NormalizeAddressWithRemoteIP(rpcAddr, peer.RemoteIP) - CheckNode("http://" + rpcAddr) + + // Extract the IP address and port from the rpcAddr + parts := strings.Split(rpcAddr, ":") + ipAddr := parts[0] + + // Iterate through common RPC ports and check each port + for _, port := range commonRPCPorts { + nodeAddr := fmt.Sprintf("%s:%s", ipAddr, port) + CheckNode("http://" + nodeAddr) + } } func FetchNetInfo(client *http.HTTP) (*coretypes.ResultNetInfo, error) { @@ -285,12 +331,7 @@ func WriteNodesToToml(initialNode string) { if err != nil { color.Red("[%s] cannot write node to toml file\n", time.Now().Format("2006-01-02 15:04:05")) } - // Write sections to the file - for key := range rpcAddr { - WriteSectionToToml(file, key) - } WriteSectionToTomlSlice(file, "successful_rpc_nodes", rpcAddr, true) - WriteSectionToTomlSlice(file, "unsuccessful_rpc_nodes", rpcAddr, false) color.Green("[%s] .toml file created with node details.\n", time.Now().Format("2006-01-02 15:04:05")) } diff --git a/nodes.toml b/nodes.toml index f26d7db..128096b 100644 --- a/nodes.toml +++ b/nodes.toml @@ -1,192 +1,15 @@ -source_node = "https://rpc-composable-ia.cosmosia.notional.ventures:443" +source_node = "https://rpc-celestia-ia.cosmosia.notional.ventures:443" -total_nodes_checked = 79 - -[[nodes]] -name = "default" -earliest_block = 0 -rpc = "http://217.76.49.110:26657" -rpc_status = "unsuccessful" - -[[nodes]] -name = "STAVR-Service" -earliest_block = 5164001 -rpc = "http://135.181.210.171:20307" -rpc_status = "successful" - -[[nodes]] -name = "test" -earliest_block = 3640124 -rpc = "https://rpc-composable-ia.cosmosia.notional.ventures:443" -rpc_status = "successful" - -[[nodes]] -name = "default" -earliest_block = 0 -rpc = "http://" -rpc_status = "unsuccessful" - -[[nodes]] -name = "default" -earliest_block = 0 -rpc = "http://94.130.94.180:26657" -rpc_status = "unsuccessful" - -[[nodes]] -name = "default" -earliest_block = 0 -rpc = "http://213.239.207.175:58657" -rpc_status = "unsuccessful" - -[[nodes]] -name = "default" -earliest_block = 0 -rpc = "http://5.181.190.114:14657" -rpc_status = "unsuccessful" - -[[nodes]] -name = "default" -earliest_block = 0 -rpc = "http://135.181.208.166:33657" -rpc_status = "unsuccessful" - -[[nodes]] -name = "default" -earliest_block = 0 -rpc = "http://51.250.86.13:26657" -rpc_status = "unsuccessful" - -[[nodes]] -name = "L0vd.com | RPC" -earliest_block = 1408001 -rpc = "http://65.109.33.48:23657" -rpc_status = "successful" - -[[nodes]] -name = "default" -earliest_block = 0 -rpc = "http://65.109.116.23:26657" -rpc_status = "unsuccessful" - -[[nodes]] -name = "default" -earliest_block = 0 -rpc = "http://65.108.106.156:27657" -rpc_status = "unsuccessful" - -[[nodes]] -name = "default" -earliest_block = 0 -rpc = "http://136.243.104.103:10157" -rpc_status = "unsuccessful" - -[[nodes]] -name = "default" -earliest_block = 0 -rpc = "http://142.132.156.99:20207" -rpc_status = "unsuccessful" - -[[nodes]] -name = "default" -earliest_block = 0 -rpc = "http://65.109.117.102:26657" -rpc_status = "unsuccessful" - -[[nodes]] -name = "CroutonDigital" -earliest_block = 1537001 -rpc = "http://65.109.117.113:27957" -rpc_status = "successful" - -[[nodes]] -name = "default" -earliest_block = 0 -rpc = "http://65.108.236.140:25576" -rpc_status = "unsuccessful" - -[[nodes]] -name = "default" -earliest_block = 0 -rpc = "http://95.217.192.124:39557" -rpc_status = "unsuccessful" - -[[nodes]] -name = "default" -earliest_block = 0 -rpc = "http://65.108.232.168:41657" -rpc_status = "unsuccessful" - -[[nodes]] -name = "default" -earliest_block = 0 -rpc = "http://185.225.191.100:36657" -rpc_status = "unsuccessful" - -[[nodes]] -name = "default" -earliest_block = 0 -rpc = "http://5.9.104.181:16157" -rpc_status = "unsuccessful" - -[[nodes]] -name = "default" -earliest_block = 0 -rpc = "http://144.91.64.71:26657" -rpc_status = "unsuccessful" - -[[nodes]] -name = "default" -earliest_block = 0 -rpc = "http://78.46.103.246:61957" -rpc_status = "unsuccessful" - -[[nodes]] -name = "default" -earliest_block = 0 -rpc = "http://144.76.97.251:49657" -rpc_status = "unsuccessful" - -[[nodes]] -name = "default" -earliest_block = 0 -rpc = "http://95.216.2.219:16657" -rpc_status = "unsuccessful" - -[[nodes]] -name = "kjgno2uht93" -earliest_block = 2026379 -rpc = "http://93.159.130.4:36657" -rpc_status = "successful" +total_nodes_checked = 818 successful_rpc_nodes = [ - "http://65.109.33.48:23657", - "http://65.109.117.113:27957", - "http://93.159.130.4:36657", - "https://rpc-composable-ia.cosmosia.notional.ventures:443", - "http://135.181.210.171:20307", -] - -unsuccessful_rpc_nodes = [ - "http://144.76.97.251:49657", - "http://65.108.236.140:25576", - "http://95.217.192.124:39557", - "http://65.108.232.168:41657", - "http://185.225.191.100:36657", - "http://5.9.104.181:16157", - "http://144.91.64.71:26657", - "http://78.46.103.246:61957", - "http://95.216.2.219:16657", - "http://5.181.190.114:14657", - "http://217.76.49.110:26657", - "http://", - "http://94.130.94.180:26657", - "http://213.239.207.175:58657", - "http://65.108.106.156:27657", - "http://135.181.208.166:33657", - "http://51.250.86.13:26657", - "http://65.109.116.23:26657", - "http://136.243.104.103:10157", - "http://142.132.156.99:20207", - "http://65.109.117.102:26657", + "http://37.120.245.32:26657", + "https://rpc-celestia-ia.cosmosia.notional.ventures:443", + "http://176.9.10.245:26657", + "http://167.235.114.157:26657", + "http://46.166.170.207:26657", + "http://185.182.186.202:26657", + "http://159.203.143.94:26657", + "http://221.149.114.194:26657", ]