mina icon indicating copy to clipboard operation
mina copied to clipboard

verificationKey as base64 and signature helpers to snarkyjs

Open Trivo25 opened this issue 2 years ago • 4 comments

  • checkAccountUpdateSignature to verify the signature for an account update
  • exports the verificationKey of a zkApp account in ~~base58~~ base64 format and its hash
  • now uses base64 entirely

Companion of https://github.com/o1-labs/snarkyjs/pull/421

Trivo25 avatar Sep 18 '22 13:09 Trivo25

!ci-build-me

Trivo25 avatar Sep 19 '22 12:09 Trivo25

We're using Base64 in the archive database for verification keys, which is faster than using Base58Check.

Encoding time of a key:

BASE58: 0.024964
BASE64: 0.000017

Encoding + decoding time:

BASE58: 0.048735
BASE64: 0.000078

Is it possible to use Base64 in SnarkyJS, so we have uniformity, and best performance?

The Base64 string is the base64 encoding of the Bin_prot-serialization of the key.

psteckler avatar Sep 19 '22 19:09 psteckler

cc @mitschabaude how much of an issue would it be to use base64 instead? I am unsure of the scope

Trivo25 avatar Sep 19 '22 19:09 Trivo25

seems useful for us to have the base64 {en,de}coder support on the SnarkyJS side given that the protocol is moving towards using this in more places anyway so it's probably worth handling sooner rather than later

bkase avatar Sep 19 '22 23:09 bkase