Skip to main content
Version: 1.0.1

5. Attest

Construct an attestation object

import { genRandomSalt, hashOne } from '@unirep/crypto'
import { Attestation } from '@unirep/contracts'

const attesterID = await contract.attesters(attester.address)
// positive reputation
const posRep = 10
// negative reputation
const negRep = 3
// a random bigint
const graffitiPreImage = genRandomSalt()
// hash of the random bigint
const graffiti = hashOne(graffitiPreImage)
// a sign up flag in the attester's application
const signUp = 0

// the attestation object
const attestation = new Attestation(
attesterID,
posRep,
negRep,
graffiti,
signUp
)

Submit the attestation

const config = await contract.config()
const tx = await contract
.connect(attester)
.submitAttestation(
attestation,
proof.epochKey,
{
value: config.attestingFee
}
)
info

Attesting fee can be set in UniRep configuration to force attesters attest an epoch key with an amount of ETH .