Signing a Transaction
To prove an input account ownership
Transactions in zkBob are signed by the spending key σ. To verify a transaction signature the prover should use an intermediate key A.
Transaction hashing
A client application should sign a 'composite' transaction hash instead of full transaction data. The transaction hash is calculated from the input and output hashes:
H=Hashsponge(Hashaccount(Accin),Hashnote(Note0in),Hashnote(Note1in),Hashnote(Note2in),TxCommit)
where
Hash is a Poseidon multi-hash (sponged) routine in the different modes
Accinis an input account
Noteiinis an input notes,
TxCommit - is a transaction commitment hash (Merkle subtree root). It depends on transaction output account and notes.
Signing
Next, a client uses the account spending key to sign a transaction hash H:
r=Blake2s(σ,H), whereBlake2s is the 256-bit hash function
R=rG, A=σG (moving r and σ to the JubJub Elliptic curve field)
S=r+Hasheddsa(R.x,A.x,H)σ
The output signature (S,R) will be sent with a intermediate key A=σG
Verifying
To verify a transaction signature a validator should perform the following computations:
SG==R+Hasheddsa(R.x,A.x,H)A
Last updated
Was this helpful?