standard

package
v0.0.4-alpha Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2023 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrIntegerOverflow = errors.New("integer overflow")

Functions

func AddUint64

func AddUint64(a, b uint64) (uint64, error)

func StandardCircuit

func StandardCircuit(privateParams, publicParams interface{}) bool

This whole function is a placeholder for the actual zk-snark circuit. We enumerate it here to give an approximate idea of what the circuit will do.

func ValidateInclusionProof

func ValidateInclusionProof(outputCommitment []byte, commitmentIndex uint64, hashes [][]byte, flags uint64, accumulator [][]byte, root []byte) bool

func ValidateUnlockingScript

func ValidateUnlockingScript(scriptCommitment []byte, scriptParams *UnlockingScriptInputs, unlockingParams [][]byte) (bool, error)

ValidateUnlockingScript is a placeholder. Normally this would be part of the overall circuit to validate the functional commitment.

Types

type InclusionProof

type InclusionProof struct {
	Hashes      [][]byte
	Flags       uint64
	Accumulator [][]byte
}

type PrivateInput

type PrivateInput struct {
	Amount           uint64
	Salt             [types.SaltLen]byte
	AssetID          [types.AssetIDLen]byte
	State            [types.StateLen]byte
	CommitmentIndex  uint64
	InclusionProof   InclusionProof
	ScriptCommitment []byte
	ScriptParams     [][]byte
	UnlockingParams  [][]byte
}

type PrivateOutput

type PrivateOutput struct {
	ScriptHash []byte
	Amount     uint64
	Salt       [types.SaltLen]byte
	AssetID    [types.AssetIDLen]byte
	State      [types.StateLen]byte
}

type PrivateParams

type PrivateParams struct {
	Inputs  []PrivateInput
	Outputs []PrivateOutput
}

type PublicOutput

type PublicOutput struct {
	Commitment []byte
	CipherText []byte
}

type PublicParams

type PublicParams struct {
	TXORoot           []byte
	SigHash           []byte
	Outputs           []PublicOutput
	Nullifiers        [][]byte
	Fee               uint64
	Coinbase          uint64
	MintID            []byte
	MintAmount        uint64
	Locktime          time.Time
	LocktimePrecision time.Duration
}

type UnlockingScriptInputs

type UnlockingScriptInputs struct {
	InputIndex    int
	PrivateParams PrivateParams
	PublicParams  PublicParams
	ScriptParams  [][]byte
}

Jump to

Keyboard shortcuts

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