Explore network
We can use the neighborhood
function to explore peers in the network and gather their multi-addresses and Peer IDs.
(seq
(seq
; gather neighborhood of hash(relay)
(call relay ("dht" "neighborhood") [relay] neighs_top)
(seq
; for each node in the neighborhood, gather neighborhood of hash(n)
(fold neighs_top n
(seq
(call n ("dht" "neighborhood") [n] neighs_inner[])
(next n)
)
)
; iterate through all gathered nodes (duplicates are possible)
(fold neighs_inner ns
(seq
(fold ns n
(seq
; ask for identification info: multi-addresses, etc
(call n ("op" "identify") [] addresses[])
(next n)
)
)
(next ns)
)
)
)
)
(seq
; send that collected data back
(call relay ("op" "identity") [])
(call %init_peer_id% ("return" "") [addresses])
)
)
Send script through several nodes and back
(seq
(call relay ("op" "identity") [])
(seq
(call node_a ("op" "identity") [])
(seq
(call node_b ("op" "identity") [])
(seq
(call node_c ("op" "identity") [])
(seq
(call relay ("op" "identity") [])
(call %init_peer_id% ("op" "identity") [])
)
)
)
)
)
Updated about a month ago