https://github.com/jsign/kzg-ceremony-test-vectors
Ethereum KZG ceremony test vectors using the reference implementation
https://github.com/jsign/kzg-ceremony-test-vectors
cryptography ethereum kzg powers-of-tau
Last synced: 7 months ago
JSON representation
Ethereum KZG ceremony test vectors using the reference implementation
- Host: GitHub
- URL: https://github.com/jsign/kzg-ceremony-test-vectors
- Owner: jsign
- Created: 2023-01-02T16:42:27.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-01-02T21:53:19.000Z (almost 3 years ago)
- Last Synced: 2025-02-09T18:47:54.537Z (9 months ago)
- Topics: cryptography, ethereum, kzg, powers-of-tau
- Language: Rust
- Homepage:
- Size: 3.43 MB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Ethereum KZG Powers of Tau Test Vectors
This repository contains a program that generates a `BatchContribution` from the [initialContribution.json](https://github.com/ethereum/kzg-ceremony-specs/blob/master/initialContribution.json) from the spec. The generation is done using the [reference implementation](https://github.com/ethereum/kzg-ceremony-sequencer) ceremony client.
This can help KZG ceremony client implementations to validate that their batch contribution logic is working as expected. This is possible since `f(initialContribution, subCeremonySecrets) -> newBatchContribution` is deterministic.
Clients can also cross-validate their implementations with the devnet sequencer, but that is slower to validate than a unit test and also implies building the API flow logic.
## How should I use this?
In your client implementation, create a test that:
- Loads `initialContribution.json`
- Execute a contribution with fixed secrets `[0x111100, 0x221100, 0x331100, 0x441100]`. Each secret is a big-endian byte representation of the n-th sub ceremony `x` (private key).
- Serialize your new batch contribution, and compare it with `updatedContribution.json`.
If they match, then your KZG ceremony client generates a batch contribution that matches the reference implementation, so there's a high chance that you're not missing any details.
Soon I'll include a link on how this test vector is used in a Go client implementation.
## How do I regenerate the `updatedContribution.json`?
Simply run `cargo run`. The `updateContribution.json` file in the repository is just a cached version.
```bash
$ cargo run
unmarshaling initial contribution file...
done.
fixed secrets for test vector: ["0x111100", "0x221100", "0x331100", "0x441100"]
updating contribution...
done.
```
## Why only one test vector?
Today running the program generates the output for the fixed secrets `[0x111100, 0x221100, 0x331100, 0x441100]` (one for each sub-ceremony). If the output of your client matches the expected output, that's high signal that your implementation is correct since getting that by chance is impossible.
However, we could change the code in this repo to generate `(N * #sub-ceremonies`) random test vectors and `N` `updatedContribution.json` outputs.
If you're interested in generating the output for specific secrets, you can easily change that in `main.rs`.