crypto

package
v0.0.0-...-05c9d29 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateTxProof

func GenerateTxProof(amount, balance uint64, signature []byte) (groth16.Proof, *bn256.Scalar, error)

func VerifyTxProof

func VerifyTxProof(proof groth16.Proof, publicData *bn256.Scalar, vk groth16.VerifyingKey) error

Types

type ThresholdSig

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

func NewThresholdSig

func NewThresholdSig(threshold, total int) (*ThresholdSig, error)

func (*ThresholdSig) AggregateShares

func (ts *ThresholdSig) AggregateShares(signatures map[int]*bls.Sign) (*bls.Sign, error)

func (*ThresholdSig) PublicKey

func (ts *ThresholdSig) PublicKey() *bls.PublicKey

func (*ThresholdSig) Share

func (ts *ThresholdSig) Share(index int) *bls.SecretKey

func (*ThresholdSig) Sign

func (ts *ThresholdSig) Sign(message []byte) *bls.Sign

type TxValidityCircuit

type TxValidityCircuit struct {
	Amount    frontend.Variable `gnark:",secret"`
	Balance   frontend.Variable `gnark:",public"`
	Signature frontend.Variable `gnark:",secret"`
}

ZK Circuit for transaction validity

func (*TxValidityCircuit) Define

func (circuit *TxValidityCircuit) Define(api frontend.API) error

type ZKProof

type ZKProof struct {
	Proof        groth16.Proof   `json:"proof"`
	PublicInputs []*bn256.Scalar `json:"public_inputs"`
	Circuit      string          `json:"circuit"`
	Message      []byte          `json:"message"`
	Signature    *bls.Sign       `json:"signature"`
}

func (*ZKProof) VerifyThreshold

func (zk *ZKProof) VerifyThreshold(publicKey *bls.PublicKey) bool

type ZKThreshold

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

func NewZKThreshold

func NewZKThreshold(threshold int, total int) (*ZKThreshold, error)

func (*ZKThreshold) SignZKProof

func (zt *ZKThreshold) SignZKProof(txHash []byte, proof zk.Proof) ([]byte, error)

Jump to

Keyboard shortcuts

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