Expand description
An SQLite-based Zcash light client.
zcash_client_sqlite contains complete SQLite-based implementations of the WalletRead,
WalletWrite, and BlockSource traits from the zcash_client_backend crate. In
combination with zcash_client_backend, it provides a full implementation of a SQLite-backed
client for the Zcash network.
§Design
The light client is built around two SQLite databases:
-
A cache database, used to inform the light client about new
CompactBlocks. It is read-only within all light client APIs except forinit_cache_databasewhich can be used to initialize the database. -
A data database, where the light client’s state is stored. It is read-write within the light client APIs, and assumed to be read-only outside these APIs. Callers MUST NOT write to the database without using these APIs. Callers MAY read the database directly in order to extract information for display to users.
§Feature flags
-
multicore(enabled by default) — Enables multithreading support for creating proofs and building subtrees. -
orchard— Enables support for storing data related to the sending and receiving of Orchard funds.This also enables
zcash_pool_migration/wallet, which supplies theWalletMigrationadapter the end-to-end migration proving simulation drives. That feature forceszcash_client_backend/orchardon, so it must never be reachable while this crate’sorchardfeature is off — including from a dev-dependency, whose features unify into every workspace build. This crate’s storage-trait impls are gated on this feature while the backend traits grow their Orchard and Ironwood methods under theirs, so the two must turn on together or the impls stop satisfying the traits. -
test-dependencies— Exposes APIs that are useful for testing, such aspropteststrategies. -
transparent-inputs— Enables receiving transparent funds and sending to transparent recipients -
spend-index— Emits per-outpointTransactionDataRequest::SpendsOfTransparentOutputrequests (instead of address-basedTransactionsInvolvingAddress) for transparent spend detection, for wallets whose chain-data source has a spent-outpoint index. -
zcashd-compat— Enables import from legacy zcashd wallet.dat wallets. -
zewif— Enables importing wallets from ZeWIF (Zcash Wallet Interchange Format) documents. Spending key material carried by a document is diverted to a caller-providedSecretSinkand is never stored in the wallet database. -
serde— Enablesserdederives for certain types.
§Experimental features
-
unstable— Exposes unstable APIs. Their behaviour may change at any time. -
expensive-tests— A feature used to isolate tests that are expensive to run. Test-only. -
ignore-expensive-tests— Marks expensive tests as ignored without removing them from compilation. Test-only. -
pczt-tests— A feature used to enable PCZT-specific tests. Test-only.This enables this crate’s
orchardandtransparent-inputsfeatures, becausezcash_client_backend/pcztforces the backend’s counterparts on, and the backend’s storage traits and this crate’s impls must grow their pool-specific methods together or the impls stop satisfying the traits.
Modules§
- chain
- Functions for enforcing chain validity and handling chain reorgs.
- error
- Error types for problems that may arise when reading or storing wallet data to SQLite.
- testing
test-dependencies - Test-support utilities exposed under the
test-dependenciesfeature: an in-memorydb::TestDbFactory/db::TestDbwallet for thezcash_client_backendtesting framework, aBlockCachecompact-block source, and the [highest_rooted_orchard_checkpoint] commitment-tree helper. Consumed by this crate’s own tests and, through the feature, by downstream crates’ tests. - util
- Types that should be part of the standard library, but aren’t.
- wallet
- Functions for querying information in the wallet database.
Structs§
- Account
Ref - A typesafe wrapper for the primary key identifier for a row in the
accountstable. - Account
Uuid - Unique identifier for a specific account tracked by a
WalletDb. - BlockDb
- A handle for the SQLite block source.
- Extension
Transaction - A restricted statement executor for writing to application-owned extension tables within a wallet database transaction.
- FsBlock
Db unstable - A block source that reads block data from disk and block metadata from a SQLite database.
- Received
Note Id - An opaque type for received note identifiers.
- SqlTransaction
- A wrapper for a SQLite transaction affecting the wallet database.
- TxRef
- A newtype wrapper for sqlite primary key values for the transactions table.
- UtxoId
- A newtype wrapper for sqlite primary key values for the utxos table.
- Wallet
Db - A wrapper for the SQLite connection to the wallet database, along with a capability to read the
system from the clock. A
WalletDbencapsulates the full set of capabilities that are required in order to implement theWalletRead,WalletWriteandWalletCommitmentTreestraits.
Enums§
- FsBlock
DbError unstable - Errors that can be generated by the filesystem/sqlite-backed block source.