mirror of
https://github.com/QuilibriumNetwork/ceremonyclient.git
synced 2026-02-21 10:27:26 +08:00
* v2.1.0 [omit consensus and adjacent] - this commit will be amended with the full release after the file copy is complete * 2.1.0 main node rollup
33 lines
822 B
Go
33 lines
822 B
Go
package vdf
|
|
|
|
import (
|
|
generated "source.quilibrium.com/quilibrium/monorepo/vdf/generated/vdf"
|
|
)
|
|
|
|
//go:generate ./generate.sh
|
|
|
|
const intSizeBits = uint16(2048)
|
|
|
|
// WesolowskiSolve Solve and prove with the Wesolowski VDF using the given parameters.
|
|
// Outputs the concatenated solution and proof (in this order).
|
|
func WesolowskiSolve(challenge [32]byte, difficulty uint32) [516]byte {
|
|
return [516]byte(
|
|
generated.WesolowskiSolve(intSizeBits, challenge[:], difficulty),
|
|
)
|
|
}
|
|
|
|
// WesolowskiVerify Verify with the Wesolowski VDF using the given parameters.
|
|
// `allegedSolution` is the output of `WesolowskiSolve`.
|
|
func WesolowskiVerify(
|
|
challenge [32]byte,
|
|
difficulty uint32,
|
|
allegedSolution [516]byte,
|
|
) bool {
|
|
return generated.WesolowskiVerify(
|
|
intSizeBits,
|
|
challenge[:],
|
|
difficulty,
|
|
allegedSolution[:],
|
|
)
|
|
}
|