wickra

package module
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 13, 2026 License: Apache-2.0, MIT Imports: 4 Imported by: 0

README

Built on Wickra Go module

Wickra Proof — Go


The deterministic Proof-of-Backtest core for Go, over the Wickra C ABI hub via cgo.

Wickra Proof folds a (spec, data) pair into a deterministic wickra-backtest report and a canonical blake3 hash that anyone recomputes byte-for-byte in ten languages. This package is the Go binding: it consumes the C ABI hub through cgo and exposes the stateless Prover handle with the same JSON protocol as every other binding.

Install

Use the published wickra-proof-go module, which bundles the prebuilt C ABI library for every platform, so go get + go build works with no extra steps (a C compiler is still required, as the binding uses cgo):

go get github.com/wickra-lib/wickra-proof-go

Quick start

package main

import (
	"fmt"

	wickra "github.com/wickra-lib/wickra-proof-go"
)

func main() {
	p := wickra.New()
	defer p.Close()

	cmd := `{"cmd":"prove","spec":{"strategy":{...},"dataset_ref":"BTCUSDT/1h"},` +
		`"data":{"BTCUSDT":[{"time":1,"open":100,"high":101,"low":99,"close":100,"volume":1000}]}}`

	proof, err := p.Command(cmd)
	if err != nil {
		panic(err)
	}
	fmt.Println(proof) // {"engine_version":"…","inputs_hash":"…","report":…,"report_hash":"…"}
	fmt.Println(wickra.Version())
}

Commands

Command Payload Response
prove {spec, data} {report, inputs_hash, report_hash, engine_version}
verify {proof, spec, data} {ok: true, valid: bool}
canonicalize {value} {ok: true, canonical}
version {engine_version}

Errors are reported in-band as {"ok":false,"error":"…"}.

wickra-proof-go is generated from this directory by the release pipeline: it mirrors the Go sources, the vendored C ABI header (include/wickra_proof.h) and the prebuilt libraries under lib/<goos>_<goarch>/. On Windows the DLL must be discoverable at run time (next to the executable or on PATH).

Building from this repository (contributors)

This bindings/go directory is the development source. To build it directly, compile the C ABI hub and stage the library into the per-platform directory cgo links against:

cargo build -p wickra-proof-c --release
mkdir -p bindings/go/lib/linux_amd64                 # match your GOOS_GOARCH
cp target/release/libwickra_proof.so    bindings/go/lib/linux_amd64/   # Linux
cp target/release/libwickra_proof.dylib bindings/go/lib/darwin_arm64/  # macOS (arm64)
cp target/release/wickra_proof.dll      bindings/go/lib/windows_amd64/ # Windows

Then, with the library on the loader path, run go test ./... from this directory.

License

Dual-licensed under MIT or Apache-2.0, at your option.

Documentation

Overview

Package wickra provides idiomatic Go bindings for wickra-proof over its C ABI hub: create a stateless Prover, drive it with command JSON (prove, verify, canonicalize, version) and read back the response JSON — the same protocol as the CLI and every other binding.

The binding links the prebuilt C ABI library, staged per platform under ./lib/<goos>_<goarch>/, with the header vendored under ./include.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Version

func Version() string

Version returns the library version.

Types

type Prover

type Prover struct {
	// contains filtered or unexported fields
}

Prover is a stateless prover driven by JSON commands.

func New

func New() *Prover

New creates a stateless prover. Call Close when done (a finalizer also frees it, but explicit Close is preferred).

func (*Prover) Close

func (p *Prover) Close()

Close frees the prover handle. Safe to call more than once.

func (*Prover) Command

func (p *Prover) Command(cmdJSON string) (string, error)

Command applies a command JSON and returns the response JSON. It uses the C ABI's length-out protocol: a first call learns the length, then the response is read into a caller-owned buffer.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL