Update Go bindings example (#273)
This commit is contained in:
parent
966e40d70e
commit
6b9b636c1b
|
@ -2,6 +2,6 @@ module example
|
||||||
|
|
||||||
go 1.19
|
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
|
require github.com/supranational/blst v0.3.11-0.20230124161941-ca03e11a3ff2 // indirect
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
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-20230330220301-966e40d70e72 h1:oBooxFAmy0BLUXYlKK0ecyivDlvqUc9OMVxyG0yXi1A=
|
||||||
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/go.mod h1:RILWWKloPYRjowfacYdBBTg56GdU2nzxU7hAZ6bwWsw=
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
|
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
|
||||||
github.com/supranational/blst v0.3.11-0.20230124161941-ca03e11a3ff2 h1:wh1wzwAhZBNiZO37uWS/nDaKiIwHz4mDo4pnA+fqTO0=
|
github.com/supranational/blst v0.3.11-0.20230124161941-ca03e11a3ff2 h1:wh1wzwAhZBNiZO37uWS/nDaKiIwHz4mDo4pnA+fqTO0=
|
||||||
|
|
|
@ -10,15 +10,15 @@ import (
|
||||||
var TrustedSetupPath = "../../../src/trusted_setup.txt"
|
var TrustedSetupPath = "../../../src/trusted_setup.txt"
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
ret := ckzg.LoadTrustedSetupFile(TrustedSetupPath)
|
err := ckzg.LoadTrustedSetupFile(TrustedSetupPath)
|
||||||
if ret != ckzg.C_KZG_OK {
|
if err != nil {
|
||||||
panic("failed to load trusted setup")
|
panic("failed to load trusted setup")
|
||||||
}
|
}
|
||||||
defer ckzg.FreeTrustedSetup()
|
defer ckzg.FreeTrustedSetup()
|
||||||
|
|
||||||
blob := ckzg.Blob{1, 2, 3}
|
blob := ckzg.Blob{1, 2, 3}
|
||||||
commitment, ret := ckzg.BlobToKZGCommitment(blob)
|
commitment, err := ckzg.BlobToKZGCommitment(blob)
|
||||||
if ret != ckzg.C_KZG_OK {
|
if err != nil {
|
||||||
panic("failed to get commitment for blob")
|
panic("failed to get commitment for blob")
|
||||||
}
|
}
|
||||||
fmt.Println(hex.EncodeToString(commitment[:]))
|
fmt.Println(hex.EncodeToString(commitment[:]))
|
||||||
|
|
Loading…
Reference in New Issue