Skip to content

Public Key Validation in the Circuit #16

@BlakeMScurr

Description

@BlakeMScurr

Hi there!

I'm building a circuit to prove membership in some list of addresses for PSE's e2e-zk-ecdsa project, and I think I need public key validation inside the circuit. This is because we want to prove membership in arbitrary address sets, including ones where some addresses may have no transactions or signed messages which means the public key can't be recovered. This means we can't do public key validation on the set outside the circuit as you reccomend, so it has to be done in the circuit.

I don't think circom-ecdsa has public key validation yet, so I was planning on implementing it and I hoped you guys could validate my approach.
According to Johnson et al, you just need to make sure that:

  1. $\mathcal{Q} \neq \mathcal{O}$ (where $\mathcal{Q}$ is the public key, and $\mathcal{O}$ is the point at infinity).
  2. The coordinates of $\mathcal{Q}$ are in the field
  3. $\mathcal{Q}$ is on the curve
  4. $n\mathcal{Q} = \mathcal{O}$

I think Secp256k1PointOnCurve solves 2 and 3, and Secp256k1ScalarMult partially solves 4, but I'm not sure how to represent $\mathcal{O}$. My guess is that you represent it as (0,0) but I can't quite tell.

I was also considering writing an ecrecover circuit, but I realised that passing a public key as input to ECDSAVerifyNoPubkeyCheck basically does the same thing from the verifier's point of view, at least for set membership.

I'd be curious if you pick any holes in this. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions