|
|
@@ -22,16 +22,6 @@ circuit "Burn" {
|
|
|
nullifier = poseidon_hash(secret, serial);
|
|
|
constrain_instance(nullifier);
|
|
|
|
|
|
- # Coin hash
|
|
|
- pub = ec_mul_base(secret, NULLIFIER_K);
|
|
|
- pub_x = ec_get_x(pub);
|
|
|
- pub_y = ec_get_y(pub);
|
|
|
- C = poseidon_hash(pub_x, pub_y, value, token, serial, coin_blind);
|
|
|
-
|
|
|
- # Merkle root
|
|
|
- root = calculate_merkle_root(leaf_pos, path, C);
|
|
|
- constrain_instance(root);
|
|
|
-
|
|
|
# Pedersen commitment for coin's value
|
|
|
vcv = ec_mul_short(value, VALUE_COMMIT_VALUE);
|
|
|
vcr = ec_mul(value_blind, VALUE_COMMIT_RANDOM);
|
|
|
@@ -54,6 +44,16 @@ circuit "Burn" {
|
|
|
constrain_instance(token_commit_x);
|
|
|
constrain_instance(token_commit_y);
|
|
|
|
|
|
+ # Coin hash
|
|
|
+ pub = ec_mul_base(secret, NULLIFIER_K);
|
|
|
+ pub_x = ec_get_x(pub);
|
|
|
+ pub_y = ec_get_y(pub);
|
|
|
+ C = poseidon_hash(pub_x, pub_y, value, token, serial, coin_blind);
|
|
|
+
|
|
|
+ # Merkle root
|
|
|
+ root = calculate_merkle_root(leaf_pos, path, C);
|
|
|
+ constrain_instance(root);
|
|
|
+
|
|
|
# Finally, we derive a public key for the signature and
|
|
|
# constrain its coordinates:
|
|
|
signature_public = ec_mul_base(signature_secret, NULLIFIER_K);
|