Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New UTXO & nullifier structure #34

Closed
wanseob opened this issue Jul 8, 2020 · 3 comments
Closed

New UTXO & nullifier structure #34

wanseob opened this issue Jul 8, 2020 · 3 comments
Labels
spec about specification

Comments

@wanseob
Copy link
Member

wanseob commented Jul 8, 2020

Is your feature request related to a problem? Please describe.
The sender creates a UTXO for the recipient, and therefore the sender can track the 1st transaction after the recipient receives the UTXO.

In version(0.7.0), Zkopru computes the hash of the UTXO with

var intermediate_hash = poseidon(ether, pub_key.x, pub_key.y, salt)
var result_hash = poseidon(intemediate_hash, token_address, erc20, nft)

Describe the solution you'd like

The recipient create a zk-tx public key with the following logic and share to others.

var zk_public_key = poseidon(pub_key.x, pub_key.y, nullifier_seed)

We can generate the UTXO with following steps:

var asset_hash = poseidon(ether, token_address, erc20, nft)
var utxo_hash = poseidon(zk_public_key, asset_hash, salt)

Then finally the nullifier becomes

var nullifier = poseidon(nullifier_seed, leaf_index)

Describe alternatives you've considered
MPC protocol can help this, but non-interactive way preferred.

Additional context
N/A

@wanseob wanseob added the spec about specification label Jul 8, 2020
@wanseob
Copy link
Member Author

wanseob commented Jul 10, 2020

The solution described above increases the complexity of the system because the sender also requires the jubjub point of the recipient for the DH key exchange(the shared key is used to encrypt leaf data.) Furthermore, the wallet should manage the nullifier_seed together which means if a user only has the private key without the nullifier seed, the user loses UTXOs.

Therefore we can only modify the nullifier computation logic using the EdDSA signature just like

nullifier = hash(EdDSA, leaf_index)

This makes sense because

  1. EdDSA's signature is derived from the private key, therefore the sender cannot know unless the signer reveals it. It means the sender can infer the nullifier.
  2. EdDSA signature does not allow malleability by the specification. https://tools.ietf.org/html/rfc8032#section-8.4
    Therefore, there is no possibility of double-spending caused by the signature malleability that can allow multiple nullifiers for one UTXO.

But currently, this is not sure that the current circom circuit supports the non-malleability of the EdDSA.
This feature will be part of the Burrito version.

@wanseob wanseob added this to the Nullifier updates milestone Jul 23, 2020
@wanseob
Copy link
Member Author

wanseob commented Jul 31, 2020

We've decided to change the UTXO & nullifier's detail structure to follow ZCash's viewing key & spending key structure.

p = random() // spending key
n = ff(sha3(p)) // nullifier seed, viewing key
N = n*G // public nullifier seed, public viewing key
s = random() // tx sender's ephemeral key
K = s*N // shared secret key for chacha20 encryption/decryption
P = poseidon(p*G, n) // public spending key
utxo = poseidon(P, data, salt)
nullifier = poseidon(n, index)

Account shares (P, N) and store (p, n)
For the effective account restoration protocol, we can derive nullifier seed n from p for example (n = ff(sha3(p))

wanseob added a commit to wanseob/zkopru that referenced this issue Aug 7, 2020
Zkopru uses ZCash's spending key and viewing key scheme

closes zkopru-network#34
wanseob added a commit to wanseob/zkopru that referenced this issue Aug 16, 2020
Zkopru uses ZCash's spending key and viewing key scheme

closes zkopru-network#34
wanseob added a commit to wanseob/zkopru that referenced this issue Aug 16, 2020
Zkopru uses ZCash's spending key and viewing key scheme

closes zkopru-network#34
wanseob added a commit that referenced this issue Aug 16, 2020
Zkopru uses ZCash's spending key and viewing key scheme

closes #34
@wanseob
Copy link
Member Author

wanseob commented Aug 16, 2020

closed by #44

@wanseob wanseob closed this as completed Aug 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
spec about specification
Projects
None yet
Development

No branches or pull requests

1 participant