-- bring the builtin services into scope
import "@fluencelabs/aqua-lib/builtin.aqua"
-- create an identity service to join our results
array(a: string, b: u64) -> string
-- function to get ten timestamps from our Kademlia
-- neighborhood peers and return as an array of u64 timestamps
-- the function arguement node is our peer id
func ts_getter(node: string) -> []u64:
-- create a streaming variable
-- execute on the pecified peer
-- get the base58 representation of the peer id
k <- Op.string_to_b58(node)
-- find all (default 20) neighborhood peers from k
nodes <- Kademlia.neighborhood(k, nil, nil)
-- for each peer in our neighborhood and in parallel
-- try and get the peer's timestamp
res <- Peer.timestamp_ms()
-- flatten nine of our joined results
-- return an array of ten timestamps