Update Go bindings example (#273)

This commit is contained in:
Justin Traglia 2023-03-30 23:38:35 -05:00 committed by GitHub
parent 966e40d70e
commit 6b9b636c1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 7 deletions

View File

@ -2,6 +2,6 @@ module example
go 1.19
require github.com/ethereum/c-kzg-4844 v0.0.0-20230321204456-577d146c0a5a
require github.com/ethereum/c-kzg-4844 v0.0.0-20230330220301-966e40d70e72
require github.com/supranational/blst v0.3.11-0.20230124161941-ca03e11a3ff2 // indirect

View File

@ -1,6 +1,6 @@
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/ethereum/c-kzg-4844 v0.0.0-20230321204456-577d146c0a5a h1:9JrfUHZY75ml0uPjFYVt+vRr/XHrNMvIpXnRDbVNyVE=
github.com/ethereum/c-kzg-4844 v0.0.0-20230321204456-577d146c0a5a/go.mod h1:ECrzdyCNp8d5bLD8Id8Y0mZ8+HDZ0LIdshCrDDTO944=
github.com/ethereum/c-kzg-4844 v0.0.0-20230330220301-966e40d70e72 h1:oBooxFAmy0BLUXYlKK0ecyivDlvqUc9OMVxyG0yXi1A=
github.com/ethereum/c-kzg-4844 v0.0.0-20230330220301-966e40d70e72/go.mod h1:RILWWKloPYRjowfacYdBBTg56GdU2nzxU7hAZ6bwWsw=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
github.com/supranational/blst v0.3.11-0.20230124161941-ca03e11a3ff2 h1:wh1wzwAhZBNiZO37uWS/nDaKiIwHz4mDo4pnA+fqTO0=

View File

@ -10,15 +10,15 @@ import (
var TrustedSetupPath = "../../../src/trusted_setup.txt"
func main() {
ret := ckzg.LoadTrustedSetupFile(TrustedSetupPath)
if ret != ckzg.C_KZG_OK {
err := ckzg.LoadTrustedSetupFile(TrustedSetupPath)
if err != nil {
panic("failed to load trusted setup")
}
defer ckzg.FreeTrustedSetup()
blob := ckzg.Blob{1, 2, 3}
commitment, ret := ckzg.BlobToKZGCommitment(blob)
if ret != ckzg.C_KZG_OK {
commitment, err := ckzg.BlobToKZGCommitment(blob)
if err != nil {
panic("failed to get commitment for blob")
}
fmt.Println(hex.EncodeToString(commitment[:]))