Based jointly on idempotents and modular Golomb rulers, we construct a class of nonbinary cyclic low-density parity-check (LDPC) codes. The defining parity-check matrix is a sparse circulant, on which we put two constraints: 1) the characteristic polynomial is an idempotent, 2) the nonzero elements