Formally Verified and Publicly Verifiable E-counting