Try   HackMD

Verkle Cryptography API

Introduction

In this document, we describe the API that the cryptography layer needs to expose to the verkle trie layer. If you are creating a verkle trie implementation without the cryptography fully being implemented, you can mock the following APIs.

Elliptic Curve API

We define a Elliptic curve

E over a base field
Fp
with a scalar field
Fr
.

The group exposed by

E(Fp) must have prime order. This is so that the verkle trie logic does not need to worry about subgroup attack vectors.

The group exposes two algorithm:

  • Serialise
    : This algorithm takes in a group element as input and returns a unique encoding of the group element as a byte string.
  • MapToFieldBytes
    : This algorithm takes in a group element as input and maps the group element to the base field
    Fp
    . The output is a unique encoding of the field element in
    Fp
    as a byte string.

MapToFieldBytes returns a byte string so that the verkle trie library does not need to be concerned with

Fp, only
Fr
is exposed through the API.

MultiPoint Scheme API

The multipoint scheme exposes three algorithms:

  • Prove:
    This algorithm takes in as input a list of tuples of the form
    (Ci,fi(X),zi,yi)
    and produces a proof
    π
    that each
    fi(zi)=yi
    .

Ci is the commitment to the function
fi(X)
and is produced by using the
Commit
algorithm.

  • Commit:
    This algorithm takes as input a function
    f(X)
    and produces a commitment to that function
    C
    .
  • Verify:
    This algorithm takes as input a proof
    π
    , and a list of tuples
    Ci,zi,yi
    . The output is true, if the proof can attest to the fact that, for all
    i
    ,
    Ci
    commits to a function
    fi(X)
    using
    Commit
    and
    fi(zi)=yi

Summary

The API surface that the cryptography layer exposes to the verkle trie layer is very small; five methods. We note that in some cases,

Serialise and
MapToFieldBytes
can uses the same function. The reason why we have two exposed algorithms is because
MapToFieldBytes
is also expected to be zero knowledge friendly for when we provide a proof of execution for verkle trees, while
Serialise
does not need to be.