Documentation
¶
Index ¶
- Variables
- type Address
- type AddressType
- type FinalizeTxParam
- type FinalizedTx
- type GenContext
- type TxDest
- func (dst *TxDest) AmountCommitment(scalar *edwards25519.Scalar, ogc *zanobase.GenContext, i int) *edwards25519.Point
- func (dst *TxDest) BlindedAssetId(scalar *edwards25519.Scalar, ogc *zanobase.GenContext, i int) *edwards25519.Point
- func (dst *TxDest) ConcealingPoint(scalar *edwards25519.Scalar, ogc *zanobase.GenContext, i int) *edwards25519.Point
- func (dst *TxDest) StealthAddress(scalar *edwards25519.Scalar, ogc *zanobase.GenContext, i int) *edwards25519.Point
- type TxDestHtlcOut
- type TxSource
- type TxSourceOutputEntry
- type Wallet
- func (w *Wallet) Address() *Address
- func (w *Wallet) Encrypt(data any) ([]byte, error)
- func (w *Wallet) ParseFTP(buf []byte) (*FinalizeTxParam, error)
- func (w *Wallet) ParseFinalized(buf []byte) (*FinalizedTx, error)
- func (w *Wallet) Sign(rnd io.Reader, ftp *FinalizeTxParam, oneTimeKey *edwards25519.Scalar) (*FinalizedTx, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var (
CRYPTO_HDS_OUT_AMOUNT_BLINDING_MASK = []byte("ZANO_HDS_OUT_AMOUNT_BLIND_MASK_\x00")
)
Functions ¶
This section is empty.
Types ¶
type Address ¶
type Address struct { Type AddressType Flags uint8 SpendKey []byte ViewKey []byte PaymentId []byte }
func ParseAddress ¶
ParseAddress will parse a zano address and return and Address object containing the address
func (*Address) SetPaymentId ¶
SetPaymentId sets the payment ID for the given address, and updates the address type accordingly.
type AddressType ¶
type AddressType uint64
const ( PublicAddress AddressType = 0xc5 // Zx PublicIntegAddress AddressType = 0x3678 // iZ PublicIntegAddressV2 AddressType = 0x36f8 // iZ (new format) PublicAuditAddress AddressType = 0x98c8 // aZx PublicAuditIntegAddress AddressType = 0x8a49 // aiZX )
func (AddressType) Auditable ¶
func (a AddressType) Auditable() bool
func (AddressType) HasFlags ¶
func (a AddressType) HasFlags() bool
func (AddressType) String ¶
func (a AddressType) String() string
type FinalizeTxParam ¶
type FinalizeTxParam struct { UnlockTime uint64 Extra []*zanobase.Variant // currency::extra_v Attachments []*zanobase.Variant // currency::attachment_v CryptAddress *zanobase.AccountPublicAddr // currency::account_public_address TxOutsAttr uint8 Shuffle bool Flags uint8 MultisigId zanobase.Value256 // crypto::hash Sources []*TxSource // currency::tx_source_entry SelectedTransfers []zanobase.Varint // not sure why, but this is encoded as "01 00" in the bytestream PreparedDestinations []*TxDest // currency::tx_destination_entry ExpirationTime uint64 SpendPubKey *zanobase.Point // only for validations TxVersion uint64 TxHardforkId uint64 ModeSeparateFee uint64 }
func ParseFTP ¶
func ParseFTP(buf, viewSecretKey []byte) (*FinalizeTxParam, error)
type FinalizedTx ¶
type FinalizedTx struct { Tx *zanobase.Transaction `json:"tx"` TxId zanobase.Value256 `json:"txid"` // might be zeroes? OneTimeKey *zanobase.Scalar `json:"one_time_key"` // crypto::secret_key FTP *FinalizeTxParam `json:"ftp"` HtlcOrigin string `json:"htlc_origin"` OutsKeyImages []*zanobase.KeyImageIndex `json:"outs_key_images,omitempty"` // pairs (out_index, key_image) for each change output Derivation zanobase.Value256 `json:"derivation"` // crypto::key_derivation, a ec_point WasNotPrepared bool `json:"was_not_prepared"` // true if tx was not prepared/created for some good reason (e.g. not enough outs for UTXO defragmentation tx). Because we decided not to throw exceptions for non-error cases. -- sowle }
func ParseFinalized ¶
func ParseFinalized(buf, viewSecretKey []byte) (*FinalizedTx, error)
type GenContext ¶
type GenContext struct { }
type TxDest ¶
type TxDest struct { Amount uint64 Addr []*zanobase.AccountPublicAddr // account_public_address; destination address, in case of 1 address - txout_to_key, in case of more - txout_multisig MinimumSigs uint64 // if txout_multisig: minimum signatures that are required to spend this output (minimum_sigs <= addr.size()) IF txout_to_key - not used AmountToProvide uint64 // amount money that provided by initial creator of tx, used with partially created transactions UnlockTime uint64 // HtlcOptions *TxDestHtlcOut // destination_option_htlc_out AssetId *zanobase.Point // not blinded, not premultiplied Flags uint64 // set of flags (see tx_destination_entry_flags) }
func (*TxDest) AmountCommitment ¶
func (dst *TxDest) AmountCommitment(scalar *edwards25519.Scalar, ogc *zanobase.GenContext, i int) *edwards25519.Point
func (*TxDest) BlindedAssetId ¶
func (dst *TxDest) BlindedAssetId(scalar *edwards25519.Scalar, ogc *zanobase.GenContext, i int) *edwards25519.Point
func (*TxDest) ConcealingPoint ¶
func (dst *TxDest) ConcealingPoint(scalar *edwards25519.Scalar, ogc *zanobase.GenContext, i int) *edwards25519.Point
func (*TxDest) StealthAddress ¶
func (dst *TxDest) StealthAddress(scalar *edwards25519.Scalar, ogc *zanobase.GenContext, i int) *edwards25519.Point
type TxDestHtlcOut ¶
type TxSource ¶
type TxSource struct { Outputs []*TxSourceOutputEntry RealOutput uint64 RealOutTxKey *zanobase.Point // crypto::public_key RealOutAmountBlindingMask *zanobase.Scalar // crypto::scalar_t RealOutAssetIdBlindingMask *zanobase.Scalar // crypto::scalar_t RealOutInTxIndex uint64 // size_t, index in transaction outputs vector Amount uint64 TransferIndex uint64 MultisigId zanobase.Value256 // crypto::hash if txin_multisig: multisig output id MsSigsCount uint64 // size_t MsKeysCount uint64 // size_t SeparatelySignedTxComplete bool HtlcOrigin string // for htlc, specify origin. len = 1, content = "\x00" ? // contains filtered or unexported fields }
type TxSourceOutputEntry ¶
type TxSourceOutputEntry struct { OutReference *zanobase.Variant // TxOutRef // either global output index or ref_by_id StealthAddress *zanobase.Point // crypto::public_key, a.k.a output's one-time public key ConcealingPoint *zanobase.Point // only for ZC outputs AmountCommitment *zanobase.Point // only for ZC outputs BlindedAssetID *zanobase.Point // only for ZC outputs }
type Wallet ¶
type Wallet struct { SpendPrivKey *edwards25519.Scalar SpendPubKey *edwards25519.Point ViewPrivKey *edwards25519.Scalar ViewPubKey *edwards25519.Point Flags uint8 // flag 1 = auditable }
func LoadSpendSecret ¶
LoadSpendSecret initializesd a Wallet based on a spend secret as found in zano if you run spendkey. It will automatically derive the view key using the appropriate method for Zano.
Set flags to zero for normal keys, or 1 for auditable keys.
func (*Wallet) Encrypt ¶
Encrypt will serialize and encrypt whatever data is passed (can be a FTP or a finalized transaction) so it can be read again.
func (*Wallet) ParseFinalized ¶
func (w *Wallet) ParseFinalized(buf []byte) (*FinalizedTx, error)
func (*Wallet) Sign ¶
func (w *Wallet) Sign(rnd io.Reader, ftp *FinalizeTxParam, oneTimeKey *edwards25519.Scalar) (*FinalizedTx, error)
Source Files
¶
Click to show internal directories.
Click to hide internal directories.