mirror of
https://github.com/tornadocash/tornado-nova
synced 2024-02-02 14:53:56 +01:00
remove commitment from signature
This commit is contained in:
parent
3fed6e5410
commit
ecc3e6b0f5
@ -12,13 +12,11 @@ template Keypair() {
|
||||
|
||||
template Signature() {
|
||||
signal input privateKey;
|
||||
signal input commitment;
|
||||
signal input merklePath;
|
||||
signal output out;
|
||||
|
||||
component hasher = Poseidon(3);
|
||||
component hasher = Poseidon(2);
|
||||
hasher.inputs[0] <== privateKey;
|
||||
hasher.inputs[1] <== commitment;
|
||||
hasher.inputs[2] <== merklePath;
|
||||
hasher.inputs[1] <== merklePath;
|
||||
out <== hasher.out;
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ Utxo structure:
|
||||
}
|
||||
|
||||
commitment = hash(amount, pubKey, blinding)
|
||||
nullifier = hash(commitment, merklePath, sign(commitment + merklePath, privKey))
|
||||
nullifier = hash(commitment, merklePath, sign(merklePath, privKey))
|
||||
*/
|
||||
|
||||
// Universal JoinSplit transaction with nIns inputs and 2 outputs
|
||||
@ -57,7 +57,6 @@ template Transaction(levels, nIns, nOuts, zeroLeaf) {
|
||||
|
||||
inSignature[tx] = Signature();
|
||||
inSignature[tx].privateKey <== inPrivateKey[tx];
|
||||
inSignature[tx].commitment <== inUtxoHasher[tx].out;
|
||||
inSignature[tx].merklePath <== inPathIndices[tx];
|
||||
|
||||
nullifierHasher[tx] = Poseidon(3);
|
||||
|
@ -85,8 +85,8 @@ class Keypair {
|
||||
* @param {string|number|BigNumber} merklePath a hex string with merkle path
|
||||
* @returns {BigNumber} a hex string with signature
|
||||
*/
|
||||
sign(commitment, merklePath) {
|
||||
return poseidonHash([this.privkey, commitment, merklePath])
|
||||
sign(merklePath) {
|
||||
return poseidonHash([this.privkey, merklePath])
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -46,7 +46,7 @@ class Utxo {
|
||||
) {
|
||||
throw new Error('Can not compute nullifier without utxo index or private key')
|
||||
}
|
||||
const signature = this.keypair.privkey ? this.keypair.sign(this.getCommitment(), this.index || 0) : 0
|
||||
const signature = this.keypair.privkey ? this.keypair.sign(this.index || 0) : 0
|
||||
this._nullifier = poseidonHash([this.getCommitment(), this.index || 0, signature])
|
||||
}
|
||||
return this._nullifier
|
||||
|
Loading…
Reference in New Issue
Block a user