# Byzantine-Resilient Counting in Networks

We present two distributed algorithms for the Byzantine counting problem, which is concerned with estimating the size of a network in the presence of a large number of Byzantine nodes. In an n-node network (n is unknown), our first algorithm, which is deterministic, finishes in O(logn) rounds and is time-optimal. This algorithm can tolerate up to O(n^1 - γ) arbitrarily (adversarially) placed Byzantine nodes for any arbitrarily small (but fixed) positive constant γ. It outputs a (fixed) constant factor estimate of logn that would be known to all but o(1) fraction of the good nodes. This algorithm works for any bounded degree expander network. However, this algorithms assumes that good nodes can send arbitrarily large-sized messages in a round. Our second algorithm is randomized and most good nodes send only small-sized messages (Throughout this paper, a small-sized message is defined to be one that contains O(logn) bits in addition to at most a constant number of node IDs.). This algorithm works in almost all d-regular graphs. It tolerates up to B(n) = n^1/2 - ξ (note that n and B(n) are unknown to the algorithm) arbitrarily (adversarially) placed Byzantine nodes, where ξ is any arbitrarily small (but fixed) positive constant. This algorithm takes O(B(n)log^2n) rounds and outputs a (fixed) constant factor estimate of logn with probability at least 1 - o(1). The said estimate is known to most nodes, i.e., ≥ (1 - β)n nodes for any arbitrarily small (but fixed) positive constant β. To complement our algorithms, we also present an impossibility result that shows that it is impossible to estimate the network size with any reasonable approximation with any non-trivial probability of success if the network does not have sufficient vertex expansion.