  This paper addresses a long standing problem, the counting of the microstates
of supersymmetric asymptotically AdS black holes in terms of a holographically
dual field theory. We focus on a class of asymptotically AdS$_4$ static black
holes preserving two real supercharges which are dual to a topologically
twisted deformation of the ABJM theory. We evaluate in the large $N$ limit the
topologically twisted index of the ABJM theory and we show that it correctly
reproduces the entropy of the AdS$_4$ black holes. An extremization of the
index with respect to a set of chemical potentials is required. We interpret it
as the selection of the exact R-symmetry of the superconformal quantum
mechanics describing the horizon of the black hole.
