  Self testing is a device-independent technique based on non-local
correlations whose aim is to certify the effective uniqueness of the quantum
state and measurements needed to produce these correlations. It is known that
the maximal violation of some Bell inequalities suffices for this purpose.
However, most of the existing self-testing protocols for two devices exploit
the well-known Clauser-Horne-Shimony-Holt Bell inequality or modifications of
it, and always with two measurements per party. Here, we generalize the
previous results by demonstrating that one can construct self-testing protocols
based on the chained Bell inequalities, defined for two devices implementing an
arbitrary number of two-output measurements. On the one hand, this proves that
the quantum state and measurements leading to the maximal violation of the
chained Bell inequality are unique. On the other hand, in the limit of a large
number of measurements, our approach allows one to self-test the entire plane
of measurements spanned by the Pauli matrices X and Z. Our results also imply
that the chained Bell inequalities can be used to certify two bits of perfect
randomness.
