Skip to main content

Module wallet

Module wallet 

Source
Expand description

§Functions for creating Zcash transactions that spend funds belonging to the wallet

This module contains several different ways of creating Zcash transactions. This module is designed around the idea that a Zcash wallet holds its funds in notes in either the Orchard or Sapling shielded pool. In order to better preserve users’ privacy, it does not provide any functionality that allows users to directly spend transparent funds except by sending them to a shielded internal address belonging to their wallet.

The important high-level operations provided by this module are propose_transfer, and create_proposed_transactions.

propose_transfer takes a TransactionRequest object, selects inputs notes and computes the fees required to satisfy that request, and returns a Proposal object that describes the transaction to be made.

create_proposed_transactions constructs one or more Zcash [Transaction]s based upon a provided Proposal, stores them to the wallet database, and returns the [TxId] for each constructed transaction to the caller. The caller can then use the WalletRead::get_transaction method to retrieve the newly constructed transactions. It is the responsibility of the caller to retrieve and serialize the transactions and submit them for inclusion into the Zcash blockchain.

Another important high-level operation provided by this module is propose_shielding, which takes a set of transparent source addresses, and constructs a Proposal to send those funds to a wallet-internal shielded address, as described in ZIP 316.

Re-exports§

pub use super::locking::LockRequest;
pub use super::locking::unlock_proposal_inputs;

Modules§

input_selection
Types related to the process of selecting inputs to be spent given a transaction request.

Structs§

ConfirmationsPolicy
ConfirmationsPolicyError
A description of the policy that is used to determine what notes are available for spending, based upon the number of confirmations (the number of blocks in the chain since and including the block in which a note was produced.)
SpendingKeys
A set of spending keys for an account, for use in execution of transaction proposals.
TargetHeight
A wrapper type around [BlockHeight] that represents the next chain tip.

Enums§

SignerViewpczt
Selects the view produced by redact_pczt_for_signer, according to the capabilities of the receiving Signer.

Functions§

create_pczt_from_proposalpczt
Constructs a transaction using the inputs supplied by the given proposal.
create_proposed_transactions
Construct, prove, and sign a transaction or series of transactions using the inputs supplied by the given proposal, and persist it to the wallet database.
decrypt_and_store_transaction
Scans a [Transaction] for any information that can be decrypted by the accounts in the wallet, and saves it to the wallet.
extract_and_store_transaction_from_pcztpczt
Finalizes the given PCZT, and persists the transaction to the wallet database.
propose_send_max_transfer
Proposes spending the maximum available value from the given shielded pools, sending it to a single recipient.
propose_shieldingtransparent-inputs
Constructs a proposal to shield all of the funds belonging to the provided set of addresses.
propose_shielding_coinbasetransparent-inputs
Constructs a proposal to shield one or more coinbase transparent outputs to an arbitrary shielded recipient.
propose_standard_transfer_to_address
Proposes making a payment to the specified address from the given account.
propose_transfer
Select transaction inputs, compute fees, and construct a proposal for a transaction or series of transactions that can then be authorized and made ready for submission to the network with create_proposed_transactions.
redact_pczt_for_batch_signerpczt
Creates a compact wallet PCZT for a batch Signer that obtains its full viewing key independently and returns only new Orchard and Ironwood signatures.
redact_pczt_for_signerpczt
Creates a redacted copy of a wallet PCZT for an external Signer.
shield_transparent_fundstransparent-inputs
Constructs a transaction that consumes available transparent UTXOs belonging to the specified secret key, and sends them to the most-preferred receiver of the default internal address for the provided Unified Spending Key.

Type Aliases§

CreateErrT
Errors that may be generated in combined creation and execution of transaction proposals.
ExtractErrTpczt
Errors that may be generated when extracting a transaction from a PCZT.
ProposeSendMaxErrT
Errors that may be generated in construction of proposals for shielded->shielded or shielded->transparent transactions that transfer the maximum value available within an account and do not produce change outputs.
ProposeShieldingCoinbaseErrTtransparent-inputs
Errors that may be generated in construction of proposals for shielding coinbase transparent outputs to an arbitrary shielded recipient via propose_shielding_coinbase.
ProposeShieldingErrTtransparent-inputs
Errors that may be generated in construction of proposals for transparent->shielded wallet-internal transfers.
ProposeTransferErrT
Errors that may be generated in construction of proposals for shielded->shielded or shielded->transparent transfers.
ShieldErrTtransparent-inputs
Errors that may be generated in the execution of shielding proposals.
TransferErrT
Errors that may be generated in the execution of proposals that may send shielded inputs.