2024-06-05 20:45:50 +00:00
|
|
|
package vdf
|
|
|
|
|
|
|
|
import (
|
2024-06-05 21:56:34 +00:00
|
|
|
generated "source.quilibrium.com/quilibrium/monorepo/vdf/generated/vdf"
|
2024-06-05 20:45:50 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
//go:generate ./generate.sh
|
|
|
|
|
2024-06-05 21:33:32 +00:00
|
|
|
const intSizeBits = uint16(2048)
|
|
|
|
|
2024-06-05 20:45:50 +00:00
|
|
|
// WesolowskiSolve Solve and prove with the Wesolowski VDF using the given parameters.
|
|
|
|
// Outputs the concatenated solution and proof (in this order).
|
2024-06-05 22:05:02 +00:00
|
|
|
func WesolowskiSolve(challenge [32]byte, difficulty uint32) [516]byte {
|
|
|
|
return [516]byte(generated.WesolowskiSolve(intSizeBits, challenge[:], difficulty))
|
2024-06-05 20:45:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// WesolowskiVerify Verify with the Wesolowski VDF using the given parameters.
|
|
|
|
// `allegedSolution` is the output of `WesolowskiSolve`.
|
2024-06-05 22:05:02 +00:00
|
|
|
func WesolowskiVerify(challenge [32]byte, difficulty uint32, allegedSolution [516]byte) bool {
|
|
|
|
return generated.WesolowskiVerify(intSizeBits, challenge[:], difficulty, allegedSolution[:])
|
2024-06-05 20:45:50 +00:00
|
|
|
}
|