sapling

package module
v0.0.0-...-2eab2c8 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2021 License: BSD-3-Clause Imports: 9 Imported by: 0

README

Sapling (sort of)

This code contains all of the primitives and logic necessary to decrypt Sapling note outputs using an exported viewing key. It was intended as the start of a project to provide webhooks for Zcash payments, but I'm unlikely to continue that work as the upcoming NU5 (currently called Orchard) is slated to replace all of this with a new set of primitives and likely other breaking changes.

If you're interested in completing the project, I'm happy to answer questions and I suggest pursuing a ZOMG grant to fund ongoing maintenance. There's desire for this among people who would like to use Zcash for ecommerce and viewing keys give Zcash a unique affordance for the purpose.

Documentation

Index

Constants

View Source
const OutputDescriptionLength = 948
View Source
const SaplingExtendedFullViewingKeyLength = 169

Variables

View Source
var (
	ZcashIVKPersonality        = []byte{'Z', 'c', 'a', 's', 'h', 'i', 'v', 'k'}
	ZcashDiversifyPersonality  = []byte{'Z', 'c', 'a', 's', 'h', '_', 'g', 'd'}
	ZcashSaplingKDFPersonality = []byte("Zcash_SaplingKDF")
	ZcashPRFExpandPersonality  = []byte("Zcash_ExpandSeed")
)
View Source
var (
	ErrKeyType = errors.New("not a sapling viewing key")
)

Functions

This section is empty.

Types

type Note

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

Note is a decrypted Sapling note

func DecryptNote

func DecryptNote(ivk *jubjub.Scalar, epk *jubjub.Point, cmu *jubjub.FieldElement, ciphertext []byte) (*Note, error)

type NoteVersion

type NoteVersion byte

NoteVersion indicates what type of Sapling note plaintext we're expecting

const (
	// BeforeZIP212 is the NoteVersion from before Canopy activates
	BeforeZIP212 NoteVersion = 0x01
	// AfterZIP212 is the NoteVersion from after Canopy activates
	AfterZIP212 NoteVersion = 0x02
)

type OutputDescription

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

func (*OutputDescription) UnmarshalBinary

func (od *OutputDescription) UnmarshalBinary(data []byte) error

UnmarshalBinary unpacks an OutputDescription struct to its constituent elements but does no further interpretation.

type PaymentAddress

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

func NewPaymentAddress

func NewPaymentAddress(d []byte, ivk *jubjub.Scalar) (*PaymentAddress, error)

NewPaymentAddress returns the PaymentAddress for this incoming viewing key and diversifier.

type ViewingKey

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

ViewingKey is a Sapling full viewing key, stored in raw bytes.

func NewViewingKey

func NewViewingKey(encoded string) (*ViewingKey, error)

NewViewingKey decodes a bech32-encoded full viewing key of the type zcashd exports.

func (*ViewingKey) Ivk

func (vk *ViewingKey) Ivk() []byte

Ivk derives the incoming viewing key and returns a new copy.

func (*ViewingKey) Ovk

func (vk *ViewingKey) Ovk() []byte

Ovk returns a new copy of the outgoing view key.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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