Sign up
User Signs Up
User signs up by providing an identity commitment and an initial balance. It also inserts a state leaf into the state tree.
function userSignUp(uint256 identityCommitment, uint256 initBalance) public
source: Unirep.sol/userSignUp
If user signs up through an attester (msg.sender
is a registered attester) and the attester sets the airdrop amount initBalance
non-zero, the user will have a one non-zero leaf in his user state. The non-zero leaf is computed by
const hasSignedUp = 1
const airdroppedLeaf = hash(initBalance, 0, 0, hasSignedUp)
Attester Signs up
Attester can sign up through attesterSignUp
and attesterSignUpViaRelayer
.
function attesterSignUp() external override
source: Unirep.sol/attesterSignUp
If an attester signs up through his wallet or another smart contract, UniRep smart contract will record the msg.sender
and assign an attester ID to the address.
function attesterSignUpViaRelayer(
address attester,
bytes calldata signature
) external override
The attester can also sign up through another relayer, but he has to provide the address of the attester who wants to sign up and the signature. The attester signs over his's own address concatenated with this contract address, then the UniRep smart contract will verify the signature by verifySignature.