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

Support Anoma sign / verify APIs #2716

Closed
paulcadman opened this issue Apr 10, 2024 · 1 comment
Closed

Support Anoma sign / verify APIs #2716

paulcadman opened this issue Apr 10, 2024 · 1 comment
Milestone

Comments

@paulcadman
Copy link
Collaborator

Verify

Anoma application logic functions will need to verify signatures. See the kudos example:

https://github.com/anoma/kudos-snippets/blob/fe8b83f288124eaf58902a566353ff3dde06beb6/docs/resource_logic.md?plain=1#L64

verification is used to check that resources have the ownership as specified in the transaction.

We're waiting for the Anoma stdlib verify call to be specified but my guess is that we'll need the following:

builtin anoma-verify
--- first argument is signed data, second argument is a public key
axiom anomaVerify : Nat -> Nat -> Bool

With example usage:

verifyLogic (r : Resource) (tx : Transaction) : Bool :=
  all (\ { n := anomaVerify n (Resource.npk r) }) (Transaction.nullifiers tx);

Sign

Signing is required to construct nullifiers in a resource. Possibly only for tests?

https://github.com/anoma/anoma/blob/1522993620fff4a9a998379a49f3d7a51e7a01d5/test/resource_test.exs#L135

https://github.com/anoma/anoma/blob/base/lib/anoma/resource.ex#L59

Proposed builtin:

builtin anoma-sign
--- first argument is the data to sign, second argument is a private key
axiom anomaSign : {A : Type} -> A -> Nat -> Bool

The implementation should use the Nockma/Anoma serialisation to serialise the data to sign before calling the Anoma stdlib sign function.

@paulcadman paulcadman added this to the 0.6.2 milestone Apr 10, 2024
@paulcadman
Copy link
Collaborator Author

Completed by #2798

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant