Money Contract Source Code

BZHKGQ26bzmBithTQYTJtjo2QdCqpkR9tjSBopT4yf4o
proof/auth_token_mint_v1.zk
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# Circuit used to verify a token mint authority.
k = 11;
field = "pallas";

constant "AuthTokenMint_V1" {
    EcFixedPointBase NULLIFIER_K,
}

witness "AuthTokenMint_V1" {
    # TokenAttributes {
    Base token_auth_parent,
    Base token_blind,
    # }

    # Secret key used by the mint authority
    Base mint_secret,
}

circuit "AuthTokenMint_V1" {
    # Derive public key for the mint authority
    mint_public = ec_mul_base(mint_secret, NULLIFIER_K);
    mint_x = ec_get_x(mint_public);
    mint_y = ec_get_y(mint_public);
    constrain_instance(mint_x);
    constrain_instance(mint_y);

    # Derive the token ID
    token_user_data = poseidon_hash(mint_x, mint_y);
    token_id = poseidon_hash(token_auth_parent, token_user_data, token_blind);
    constrain_instance(token_id);
}