2023-03-22 05:28:42 -05:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/hex"
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
ckzg "github.com/ethereum/c-kzg-4844/bindings/go"
|
|
|
|
)
|
|
|
|
|
|
|
|
var TrustedSetupPath = "../../../src/trusted_setup.txt"
|
|
|
|
|
|
|
|
func main() {
|
2023-03-30 23:38:35 -05:00
|
|
|
err := ckzg.LoadTrustedSetupFile(TrustedSetupPath)
|
|
|
|
if err != nil {
|
2023-03-22 05:28:42 -05:00
|
|
|
panic("failed to load trusted setup")
|
|
|
|
}
|
|
|
|
defer ckzg.FreeTrustedSetup()
|
|
|
|
|
|
|
|
blob := ckzg.Blob{1, 2, 3}
|
2023-03-30 23:38:35 -05:00
|
|
|
commitment, err := ckzg.BlobToKZGCommitment(blob)
|
|
|
|
if err != nil {
|
2023-03-22 05:28:42 -05:00
|
|
|
panic("failed to get commitment for blob")
|
|
|
|
}
|
|
|
|
fmt.Println(hex.EncodeToString(commitment[:]))
|
|
|
|
}
|