Running Verifiable Delay Function in GO
- Clone ChiaVDF official repostory. To do so, we can run:
git submodule update --init
- Install compiling tools.
sudo apt-get install cmake libgmp-dev libboost-system-dev build-essential -y
- Edit
chiavdf/src/CMakeLists.txt
, by turning on thechiavdfc
option, and turning off thepython
option.
option(BUILD_CHIAVDFC "Build the chiavdfc shared library" ON)
option(BUILD_PYTHON "Build the python bindings for chiavdf" OFF)
- Create directory
chiavdf/build
. Then move into it.
mkdir chiavdf/build
cd chiavdf/build
- Run CMake to configure the project. Pass as parameter the directory in which
CMakeLists.txt
is located.
cmake ../src
- Build the project.
make
By following these commands, we obtain a compiled C VDF library: libchiavdfc.a
, located inside chiavdf/build/static
.
- Export absolute path of C Wrappers for ChiaVDF.
export CGO_CFLAGS="-I/path/to/chiavdf/src/c_bindings"
- Export absolute path ob libchiavdfc and libgmp.
export CGO_LDFLAGS="-L/path/to/chiavdf/build/lib/static -L/usr/lib/x86_64-linux-gnu -lgmp"
- (
⚠️ Not working) Run main program.
go run main.go