Documentation
¶
Index ¶
- Variables
- func AssetCommitment(asset, factor []byte) ([]byte, error)
- func CalculateScalarOffset(amount uint64, assetBlinder, valueBlinder []byte) ([]byte, error)
- func ComputeAndAddToScalarOffset(scalar []byte, value uint64, assetBlinder, valueBlinder []byte) ([]byte, error)
- func CreateBlindAssetProof(asset, assetCommitment, assetBlinder []byte) ([]byte, error)
- func CreateBlindValueProof(rng func() ([]byte, error), valueBlinder []byte, amount uint64, ...) ([]byte, error)
- func FinalValueBlindingFactor(args FinalValueBlindingFactorArgs) ([32]byte, error)
- func NonceHash(pubKey, privKey []byte) ([32]byte, error)
- func RangeProof(args RangeProofArgs) ([]byte, error)
- func SubtractScalars(a []byte, b []byte) ([]byte, error)
- func SurjectionProof(args SurjectionProofArgs) ([]byte, bool)
- func ValueCommitment(value uint64, generator, factor []byte) ([]byte, error)
- func VerifyBlindAssetProof(asset, assetCommitment, proof []byte) bool
- func VerifyBlindValueProof(value uint64, valueCommitment, assetCommitment, proof []byte) bool
- func VerifySurjectionProof(args VerifySurjectionProofArgs) bool
- type BlinderHandler
- func NewBlinderHandlerFromBlindingKeys(inBlindingKeys [][]byte, opts *BlinderHandlerOpts) *BlinderHandler
- func NewBlinderHandlerFromMasterBlindingKey(masterBlindingKey []byte, opts *BlinderHandlerOpts) (*BlinderHandler, error)
- func NewBlinderHandlerFromOwnedInputs(ownedInputs map[uint32]psetv2.OwnedInput, opts *BlinderHandlerOpts) (*BlinderHandler, error)
- func (h *BlinderHandler) BlindIssuances(p *psetv2.Pset, blindingKeysByIndex map[uint32][]byte) ([]psetv2.InputIssuanceBlindingArgs, error)
- func (h *BlinderHandler) BlindOutputs(p *psetv2.Pset, outputIndexes []uint32, ...) ([]psetv2.OutputBlindingArgs, error)
- func (h *BlinderHandler) ComputeAndAddToScalarOffset(scalar []byte, value uint64, assetBlinder, valueBlinder []byte) ([]byte, error)
- func (h *BlinderHandler) LastBlindValueProof(value uint64, valueCommitment, assetCommitment, blinder []byte) ([]byte, error)
- func (h *BlinderHandler) LastValueCommitment(value uint64, asset, blinder []byte) ([]byte, error)
- func (h *BlinderHandler) LastValueRangeProof(value uint64, ...) ([]byte, error)
- func (h *BlinderHandler) SubtractScalars(a, b []byte) ([]byte, error)
- func (h *BlinderHandler) UnblindInputs(p *psetv2.Pset, inputIndexes []uint32) ([]psetv2.OwnedInput, error)
- func (h *BlinderHandler) VerifyBlindAssetProof(asset, assetCommitment, proof []byte) bool
- func (h *BlinderHandler) VerifyBlindValueProof(value uint64, valueCommitment, assetCommitment, proof []byte) bool
- type BlinderHandlerOpts
- type FinalValueBlindingFactorArgs
- type RandomNumberGenerator
- type RangeProofArgs
- type SurjectionProofArgs
- type UnblindIssuanceResult
- type UnblindOutputResult
- type VerifySurjectionProofArgs
Constants ¶
This section is empty.
Variables ¶
var ( ErrPrivKeyMult = errors.New("privKey mult error") ErrPrivKeyTweakAdd = errors.New("privKey tweak add error") ErrPrivKeyNegate = errors.New("privKey negate error") ErrInvalidValueBlinder = errors.New("invalid value blinder") )
var (
Zero = make([]byte, 32)
)
Functions ¶
func AssetCommitment ¶
AssetCommitment method generates asset commitment
func CalculateScalarOffset ¶ added in v0.4.0
CalculateScalarOffset computes the scalar offset used for the final blinder computation value * asset_blinder + value_blinder
func ComputeAndAddToScalarOffset ¶ added in v0.4.0
func ComputeAndAddToScalarOffset( scalar []byte, value uint64, assetBlinder, valueBlinder []byte, ) ([]byte, error)
ComputeAndAddToScalarOffset computes a scalar offset and adds it to another existing one
func CreateBlindAssetProof ¶ added in v0.4.0
func CreateBlindValueProof ¶ added in v0.4.0
func FinalValueBlindingFactor ¶
func FinalValueBlindingFactor( args FinalValueBlindingFactorArgs, ) ([32]byte, error)
FinalValueBlindingFactor method calculates the blinder as the sum of all previous blinders of a tx.
func RangeProof ¶
func RangeProof(args RangeProofArgs) ([]byte, error)
RangeProof method calculates range proof
func SubtractScalars ¶ added in v0.4.0
SubtractScalars subtract b from a in place
func SurjectionProof ¶
func SurjectionProof(args SurjectionProofArgs) ([]byte, bool)
SurjectionProof method generates surjection proof
func ValueCommitment ¶
ValueCommitment method generates value commitment
func VerifyBlindAssetProof ¶ added in v0.4.0
func VerifyBlindValueProof ¶ added in v0.4.0
func VerifySurjectionProof ¶ added in v0.0.4
func VerifySurjectionProof(args VerifySurjectionProofArgs) bool
VerifySurjectionProof method verifies the validity of a surjection proof
Types ¶
type BlinderHandler ¶
type BlinderHandler struct {
// contains filtered or unexported fields
}
func NewBlinderHandlerFromBlindingKeys ¶
func NewBlinderHandlerFromBlindingKeys( inBlindingKeys [][]byte, opts *BlinderHandlerOpts, ) *BlinderHandler
func NewBlinderHandlerFromMasterBlindingKey ¶
func NewBlinderHandlerFromMasterBlindingKey( masterBlindingKey []byte, opts *BlinderHandlerOpts, ) (*BlinderHandler, error)
func NewBlinderHandlerFromOwnedInputs ¶
func NewBlinderHandlerFromOwnedInputs( ownedInputs map[uint32]psetv2.OwnedInput, opts *BlinderHandlerOpts, ) (*BlinderHandler, error)
func (*BlinderHandler) BlindIssuances ¶
func (h *BlinderHandler) BlindIssuances( p *psetv2.Pset, blindingKeysByIndex map[uint32][]byte, ) ([]psetv2.InputIssuanceBlindingArgs, error)
func (*BlinderHandler) BlindOutputs ¶
func (h *BlinderHandler) BlindOutputs( p *psetv2.Pset, outputIndexes []uint32, inIssuances []psetv2.InputIssuanceBlindingArgs, ) ([]psetv2.OutputBlindingArgs, error)
func (*BlinderHandler) ComputeAndAddToScalarOffset ¶
func (*BlinderHandler) LastBlindValueProof ¶
func (h *BlinderHandler) LastBlindValueProof( value uint64, valueCommitment, assetCommitment, blinder []byte, ) ([]byte, error)
func (*BlinderHandler) LastValueCommitment ¶
func (h *BlinderHandler) LastValueCommitment( value uint64, asset, blinder []byte, ) ([]byte, error)
func (*BlinderHandler) LastValueRangeProof ¶
func (h *BlinderHandler) LastValueRangeProof( value uint64, asset, assetBlinder, valueCommitment, valueBlinder, scriptPubkey, nonce []byte, ) ([]byte, error)
func (*BlinderHandler) SubtractScalars ¶
func (h *BlinderHandler) SubtractScalars(a, b []byte) ([]byte, error)
func (*BlinderHandler) UnblindInputs ¶
func (h *BlinderHandler) UnblindInputs( p *psetv2.Pset, inputIndexes []uint32, ) ([]psetv2.OwnedInput, error)
func (*BlinderHandler) VerifyBlindAssetProof ¶
func (h *BlinderHandler) VerifyBlindAssetProof( asset, assetCommitment, proof []byte, ) bool
func (*BlinderHandler) VerifyBlindValueProof ¶
func (h *BlinderHandler) VerifyBlindValueProof( value uint64, valueCommitment, assetCommitment, proof []byte, ) bool
type BlinderHandlerOpts ¶
type BlinderHandlerOpts struct {
Rng RandomNumberGenerator
}
type FinalValueBlindingFactorArgs ¶ added in v0.0.4
type FinalValueBlindingFactorArgs struct { InValues []uint64 OutValues []uint64 InGenerators [][]byte OutGenerators [][]byte InFactors [][]byte OutFactors [][]byte }
FinalValueBlindingFactorArgs is the type provided to the function that calculates the blinder of the last output of a tx.
type RandomNumberGenerator ¶ added in v0.4.0
type RangeProofArgs ¶ added in v0.0.4
type SurjectionProofArgs ¶ added in v0.0.4
type UnblindIssuanceResult ¶ added in v0.0.4
type UnblindIssuanceResult struct { Asset *UnblindOutputResult Token *UnblindOutputResult }
func UnblindIssuance ¶ added in v0.0.4
func UnblindIssuance( in *transaction.TxInput, blindKeys [][]byte, ) (*UnblindIssuanceResult, error)
type UnblindOutputResult ¶
type UnblindOutputResult struct { Value uint64 Asset []byte ValueBlindingFactor []byte AssetBlindingFactor []byte }
UnblindOutputResult is the type returned by the functions that unblind tx outs. It contains the unblinded asset and value and also the respective blinding factors.
func UnblindOutputWithKey ¶ added in v0.0.4
func UnblindOutputWithKey( out *transaction.TxOutput, blindKey []byte, ) (*UnblindOutputResult, error)
UnblindOutputWithKey method unblinds a confidential transaction output with the given blinding private key.
func UnblindOutputWithNonce ¶ added in v0.0.4
func UnblindOutputWithNonce( out *transaction.TxOutput, nonce []byte, ) (*UnblindOutputResult, error)
UnblindOutputWithNonce method unblinds a confidential transaction output with the given ecdh nonce calculated for example with the above NonceHash func.