Skip to main content
Version: 1.0.1

Attestations

Submit Attestation

An attester can submit the attestation with a proof index. A valid proof is either an epoch key proof, a user sign up proof or a reputation proof with epoch key being one of the public signals. An attester can also submit attestations through a relayer or not.

It it is from a reputation proof we should include a fromProofIndex to make sure the attestation is from a valid reputation proof, or the attestation will fail.

contracts/Unirep.sol
function submitAttestation(
Attestation calldata attestation,
uint256 epochKey
) external payable {
contracts/Unirep.sol
function submitAttestationViaRelayer(
address attester,
bytes calldata signature,
Attestation calldata attestation,
uint256 epochKey
) external payable {

Spend Reputation

A user include a reputation proof to spend reputation via an attester, the non-zero nullifiers will be processed as a negative attestation, and the spent reputation cannot be re-used.

contracts/Unirep.sol
/**
* @dev A user spend reputation via an attester, the non-zero nullifiers will be processed as a negative attestation
* publicSignals[0] = [ epochKey ]
* publicSignals[1] = [ globalStateTree ]
* publicSignals[2: maxReputationBudget + 2] = [ reputationNullifiers ]
* publicSignals[maxReputationBudget + 2] = [ epoch ]
* publicSignals[maxReputationBudget + 3] = [ attesterId ]
* publicSignals[maxReputationBudget + 4] = [ proveReputationAmount ]
* publicSignals[maxReputationBudget + 5] = [ minRep ]
* publicSignals[maxReputationBudget + 6] = [ minRep ]
* publicSignals[maxReputationBudget + 7] = [ proveGraffiti ]
* publicSignals[maxReputationBudget + 8] = [ graffitiPreImage ]
* @param publicSignals The public signals of the reputation proof
* @param proof The The proof of the reputation proof
*/
function spendReputation(
uint256[] memory publicSignals,
uint256[8] memory proof
) external payable {