This repository is dedicated to reproducing an issue we have encountered related to digital signatures using the Mina protocol. The core of the issue lies in the verification process of a digital signature generated in Rust and then verified in TypeScript using o1js.
The Rust script uses the mina-signer
crate to generate a digital signature for an array of u8 numbers, then saves this data along with the associated public key and the base58 encoded signature into a JSON file. The TypeScript script (using the Signature
class from o1js
) attempts to verify this signature but fails despite using identical data and public key parameters.
The primary goal here is to reach out to the Mina community for insights or solutions and document any progress or findings related to this issue.
rust/
: Contains the Rust script for generating the digital signature and exporting the necessary data.o1js/
: Contains the TypeScript script intended to verify the signature generated by the Rust script.
When attempting to verify a digital signature (using o1js
) that was generated in Rust (using mina-signer
), the verification fails. This is puzzling as the data, public key, and signature remain consistent across both implementations.
- Rust installation for running Rust scripts.
- Node.js and pnpm for handling JavaScript dependencies and running the TypeScript script.
To generate the digital signature and associated data:
- Navigate to the
signature_poc/rust
directory. - Execute the command:
cargo run
This will generate a JSON file containing the signed data, the digital signature, and the public key, and will save it to the o1js/web
directory.
To verify the signature:
-
Ensure you have pnpm installed. If not, you can install it using npm install -g pnpm.
-
Navigate to the
signature_poc/o1js
directory. -
Install the necessary dependencies:
pnpm install
-
Run the local development server:
pnpm vite
-
Open a browser and navigate to localhost:5173 to execute the TypeScript script.
-
Open the browser's console and check the logs.