use.miden::account use.miden::tx use.std::crypto::dsa::rpo_falcon512 # CONSTANTS # ================================================================================================= # The slot in this component's storage layout where the public key is stored. const.PUBLIC_KEY_SLOT=0 #! Authenticate a transaction using the Falcon signature scheme #! Stack: [] #! Output: [] #! export.auth_tx_rpo_falcon512 # Get commitments to output notes exec.tx::get_output_notes_hash # => [OUTPUT_NOTES_HASH, ...] exec.tx::get_input_notes_commitment # => [INPUT_NOTES_COMMITMENT, OUTPUT_NOTES_HASH, ...] # Get current nonce of the account and pad exec.account::get_nonce push.0.0.0 # => [0, 0, 0, nonce, INPUT_NOTES_HASH, OUTPUT_NOTES_HASH, ...] # Get current AccountID and pad exec.account::get_id push.0.0.0 # => [0, 0, 0, account_id, 0, 0, 0, nonce, INPUT_NOTES_HASH, OUTPUT_NOTES_HASH, ...] # Compute the message to be signed # M = h(OUTPUT_NOTES_HASH, h(INPUT_NOTES_HASH, h(0, 0, 0, account_id, 0, 0, 0, nonce))) hmerge hmerge hmerge # Get public key from account storage at pos 0 and verify signature push.PUBLIC_KEY_SLOT exec.account::get_item # => [PUB_KEY, M] # Update the nonce push.1 exec.account::incr_nonce # => [] # Verify the signature against the public key and the message. The procedure gets as # inputs the hash of the public key and the hash of the message via the operand # stack. The signature is provided via the advice stack. The signature is valid if and # only if the procedure returns. exec.rpo_falcon512::verify # => [] end