Package detail

verkle-cryptography-wasm

ethereumjs2.9kMIT/Apache0.4.8

Verkle Trie Crytography WASM/TypeScript Bindings

ethereum, verkle, WASM, JavaScript

readme

Verkle Cryptography (WASM/TypeScript)

Note: This library is in the process of moving over from https://github.com/crate-crypto/rust-verkle-wasm. Package and build structure are in the process of being reworked and documentation/instructions are not yet fully updated.

This library provides a WASM build bundled with a TypeScript API of the Rust rust-verkle implementation and exposes core Verkle Tree related crypto and arithmetic primitives to be consumed and used by higher level packages.

The library has been initially developed by kevaundray (a thousand ❤️s for all the great work!) and is now maintained and further developed by Kev and the Ethereum Foundation JavaScript team.

A higher level Verkle Tree TypeScript library using this package is in the works at https://github.com/ethereumjs/ethereumjs-monorepo/tree/master/packages/verkle.

Installation

    npm i verkle-cryptography-wasm

Basic Structure

Rust/WASM

The Rust code and the necessary tooling for the WASM build and a low level TypeScript API exposure can be found in ./src.rs. The associated README contains the main documentation describing the WASM build process.

High Level TypeScript API

The main high level API exposed in a final published package can be found in ./src.ts. Usage instructions can be found here

Node.js

The root folder of this package holds a Node.js package.json file referencing the final package exports and the necessary build scripts.

Build

Build scripts can be found in the scripts folder and the build process can be triggered with:

npm run build

See the comments in the build scripts for a more detailed explanation of what occurs in each step.

Note that this requires all Rust/WASM tooling to be installed, so a first look into the dedicated RUST/WASM documentation is recommended.

Testing

There are a few high level JavaScript API respectively unit tests available which can be run with:

npm run test

changelog

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog (modification: no type change headlines) and this project adheres to Semantic Versioning.

0.4.8 - 2024-09-12

  • Expose commitToScalars in public API. #60

0.4.7 - 2024-09-10

  • Add better API for createProof/verifyProof and expanded tests #57

0.4.6 - 2024-09-08

  • Expose createProof and verifyProof from verkle_ffi. #56

0.4.5 - 2024-06-21

  • Remove duplicative VerkleCrypto typescript interface as unnecessary. #55

0.4.4 - 2024-06-11

  • Add serializeCommitment to to the public API, PR #53

0.4.3 - 2024-06-03

  • Add hashCommitment to the public API and add new test to demonstrate how to derive a new commitment using the current API, PR #51

0.4.2 - 2024-05-15

  • Updates rust-verkle dependency so that verifyExecutionProof returns 0 for node not present, PR #47
  • Updates rust-verkle dependency so that verifyExecutionProof returns false for malformed proof elements, PR #48

0.4.1 - 2024-05-14

  • Update rust-verkle dependency, PR #45
  • Add method to public API to verify prestate in execution witness, PR #44

0.4.0 - 2024-04-02

  • Update getTreeKey to use hashCommitment following latest spec, PR #31

0.3.1 - 2024-03-29

  • Fix several minor bugs impacting ESM and browser usage; add new VerkleCrypto type that defines output of loadVerkleCrypto, PR #41

0.3.0 - 2024-03-27

  • Update API to use async initialization function loadVerkleCrypto to instantiate WASM module before use and redesign build process, PR #37

0.2.1 - 2024-03-11

  • Remove postinstall build hook, PR #35

0.2.0 - 2024-03-08

  • Limit API exposure to FFI, PR #32

0.1.1 - 2024-03-07

  • Additionally expose VerkleFFI and getTreeKeyHash()
  • Improve ESM compatibility (.js file endings)

0.1.0 - 2024-03-07

This a pre-release primarily meant to be used for internal purposes (feel free to do your early-on experimentation though! 🙂).