| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- k = 13;
- field = "pallas";
- constant "RLN_Stake_V1" {
- EcFixedPointBase NULLIFIER_K,
- }
- witness "RLN_Stake_V1" {
- # The RLN identity nullifier
- Base identity_nullifier,
- # The RLN identity trapdoor
- Base identity_trapdoor,
- # The staked coin value
- Base stake_value,
- # The staked coin token ID
- Base stake_token_id,
- # The staked coin spend hook
- Base stake_spend_hook,
- # The staked coin user data
- Base stake_user_data,
- # Unique serial number corresponding to the staked coin
- Base stake_blind,
- }
- circuit "RLN_Stake_V1" {
- # Derive the public key for the coin
- identity_secret = poseidon_hash(identity_nullifier, identity_trapdoor);
- identity_stake_public = ec_mul_base(identity_secret, NULLIFIER_K);
- # Derive and constrain the identity commitment
- identity_commitment = poseidon_hash(identity_secret);
- constrain_instance(identity_commitment);
- # Construct and reveal the staked coin.
- # This must be the same coin in the corresponding Money output.
- # We reveal everything except the derived `identity_stake_public`.
- C = poseidon_hash(
- ec_get_x(identity_stake_public),
- ec_get_y(identity_stake_public),
- stake_value,
- stake_token_id,
- stake_spend_hook,
- stake_user_data,
- stake_blind,
- );
- constrain_instance(C);
- # Reveal the staked value
- constrain_instance(stake_value);
- # Reveal the token ID
- constrain_instance(stake_token_id);
- # Reveal the spend_hook
- constrain_instance(stake_spend_hook);
- # Reveal the user_data
- constrain_instance(stake_user_data);
- # Reveal the coin blind
- constrain_instance(stake_blind);
- }
|