zsl

package
v0.0.0-...-f6c2049 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2019 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ZSL_PROOF_SIZE                                   int = 584
	ZSL_TREE_DEPTH                                       = 29
	ZSL_V_SIZE                                           = 16
	ZSL_RHO_SIZE                                         = 32
	ZSL_NOTEPLAINTEXT_SIZE                               = ZSL_V_SIZE + ZSL_RHO_SIZE
	ZSL_NOTEENCRYPTION_AUTH_BYTES                        = 16
	ZSL_NOTEENCRYPTION_CIPHER_KEYSIZE                    = 32
	ZSL_crypto_aead_chacha20poly1305__IETF_NPUBBYTES     = 12
	ZSL_crypto_generichash_blake2b_PERSONALBYTES         = 16
)
View Source
const CSBYTES = 4

Variables

View Source
var (
	ErrChecksum      = errors.New("checksum error")
	ErrInvalidFormat = errors.New("invalid format: version and/or checksum bytes missing")
)
View Source
var (
	ProdSpendingKey    = []byte{0xAB, 0x36}
	TestSpendingKey    = []byte{0xAC, 0x08}
	ProdPaymentAddress = []byte{0x16, 0x9A}
	TestPaymentAddress = []byte{0x16, 0xB6}
	ProdViewingKey     = []byte{0xA8, 0xAB, 0xD3}
	TestViewingKey     = []byte{0xA8, 0xAC, 0x0C}
)

Functions

func DecodeShieldedPaymentAddress

func DecodeShieldedPaymentAddress(addr string) (a_pk, pk_enc, version []byte, err error)

func DecodeSpendingKey

func DecodeSpendingKey(addr string) (a_sk, version []byte, err error)

func DecodeViewingKey

func DecodeViewingKey(addr string) (a_pk, sk_enc, version []byte, err error)

func EncodeIncomingViewingKey

func EncodeIncomingViewingKey(a_pk, sk_enc []byte) string

func EncodeShieldedPaymentAddress

func EncodeShieldedPaymentAddress(a_pk, pk_enc []byte) string

func EncodeSpendingKey

func EncodeSpendingKey(a_sk []byte) string

func KDF

func KDF(dhsecret [32]byte, epk []byte, pk_enc [32]byte, nonce byte) []byte

See "5.4.4.2 Sprout Key Derivation"

func ZC_generate_privkey

func ZC_generate_privkey(a_sk []byte) []byte

SK_ENC ZCASH

func ZC_generate_pubkey

func ZC_generate_pubkey(sk_enc []byte) []byte

PK_ENC ZCASH

Types

type PublicZSLAPI

type PublicZSLAPI struct {
}

func NewPublicZSLAPI

func NewPublicZSLAPI() *PublicZSLAPI

func (*PublicZSLAPI) CreateShieldedTransfer

func (api *PublicZSLAPI) CreateShieldedTransfer(
	rho_1 common.Hash, sk_1 common.Hash, value_1 float64, treeIndex_1 float64, authPath_1 []string,
	rho_2 common.Hash, sk_2 common.Hash, value_2 float64, treeIndex_2 float64, authPath_2 []string,
	out_rho_1 common.Hash, shieldedAddress string, out_value_1 float64,
	out_rho_2 common.Hash, out_pk_2 common.Hash, out_value_2 float64,
) (map[string]interface{}, error)

func (*PublicZSLAPI) CreateShielding

func (api *PublicZSLAPI) CreateShielding(rho common.Hash, pk common.Hash, value float64) (map[string]interface{}, error)

func (*PublicZSLAPI) CreateUnshielding

func (api *PublicZSLAPI) CreateUnshielding(rho common.Hash, sk common.Hash, addr common.Address, value float64, treeIndex float64, authPath []string) (map[string]interface{}, error)

func (*PublicZSLAPI) DebugShieldedTransfer

func (api *PublicZSLAPI) DebugShieldedTransfer() (bool, error)

Test copied from from snark_test.go

func (*PublicZSLAPI) DebugShielding

func (api *PublicZSLAPI) DebugShielding() (bool, error)

Test copied from from snark_test.go

func (*PublicZSLAPI) DebugUnshielding

func (api *PublicZSLAPI) DebugUnshielding() (bool, error)

Test copied from from snark_test.go

func (*PublicZSLAPI) GenerateZKeypair

func (api *PublicZSLAPI) GenerateZKeypair() (map[string]interface{}, error)

func (*PublicZSLAPI) GetCommitment

func (api *PublicZSLAPI) GetCommitment(rho common.Hash, pk common.Hash, value float64) common.Hash

func (*PublicZSLAPI) GetNewAddress

func (api *PublicZSLAPI) GetNewAddress() (map[string]interface{}, error)

Create a shielded address and return all components: a_sk, a_pk

func (*PublicZSLAPI) GetRandomness

func (api *PublicZSLAPI) GetRandomness() (common.Hash, error)

Generate 32 bytes of randomness

func (*PublicZSLAPI) GetSendNullifier

func (api *PublicZSLAPI) GetSendNullifier(rho common.Hash) common.Hash

func (*PublicZSLAPI) GetSpendNullifier

func (api *PublicZSLAPI) GetSpendNullifier(rho common.Hash, sk common.Hash) common.Hash

func (*PublicZSLAPI) LoadTracker

func (api *PublicZSLAPI) LoadTracker(filename string) (string, error)

Note: API function names should match those defined in web3ext.go, first character upper case as external function.

func (*PublicZSLAPI) NoteDecrypt

func (api *PublicZSLAPI) NoteDecrypt(a_sk string, blob string) (map[string]interface{}, error)

func (*PublicZSLAPI) SaveTracker

func (api *PublicZSLAPI) SaveTracker(filename string, data string) bool

TODO: Post-demo, sanitize filenames and check exiting files before over-writing.

func (*PublicZSLAPI) Test

func (api *PublicZSLAPI) Test() (map[string]interface{}, error)

func (*PublicZSLAPI) TestZaddr

func (api *PublicZSLAPI) TestZaddr(shieldedAddress string) (map[string]interface{}, error)

func (*PublicZSLAPI) VerifyShieldedTransfer

func (api *PublicZSLAPI) VerifyShieldedTransfer(
	proofHex string,
	anchor common.Hash,
	spend_nf_1 common.Hash,
	spend_nf_2 common.Hash,
	send_nf_1 common.Hash,
	send_nf_2 common.Hash,
	cm_1 common.Hash,
	cm_2 common.Hash) (bool, error)

func (*PublicZSLAPI) VerifyShielding

func (api *PublicZSLAPI) VerifyShielding(proofHex string, send_nf common.Hash, cm common.Hash, value float64) (bool, error)

glyff: zsl.verifyShielding(proof, send_nf, cm, value); Javascript numbers are floats, there is no support for 64-bit integers.

func (*PublicZSLAPI) VerifyUnshielding

func (api *PublicZSLAPI) VerifyUnshielding(proofHex string, spend_nf common.Hash, rt common.Hash, addr common.Address, value float64) (bool, error)

glyff: zsl.verifyUnshielding(proof, spend_nf, rt, addr, value); Javascript numbers are floats, there is no support for 64-bit integers.

Jump to

Keyboard shortcuts

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