Skip to main content

Crate silentpayments

Crate silentpayments 

Source
Expand description

A rust implementation of BIP352: Silent Payments. This library can be used to add silent payment support to wallets.

§Feature Flags

This library offers granular feature flags to minimize dependencies:

  • default: Enables encode, sending, and receiving features
  • encode: Enables string encoding/decoding for SilentPaymentAddress (requires bech32)
  • serde: Enables serde serialization/deserialization for types
  • sending: Enables sending functionality (requires bitcoin_hashes, hex, and encode)
  • receiving: Enables receiving functionality (requires bitcoin_hashes, hex, bimap, serde, and encode)

§Minimal Usage

If you only need the type definitions (Network and SilentPaymentAddress) without any additional functionality, you can disable all default features:

[dependencies]
silentpayments = { version = "0.4", default-features = false }

This will only pull in secp256k1 as a dependency, giving you access to the core types without any encoding, serialization, or protocol functionality.

Note: Even without the encode feature, you can still construct a SilentPaymentAddress from its components using SilentPaymentAddress::new(). This allows you to use your own bech32 parser (if your application already has one) and avoid duplicate dependencies. See the SilentPaymentAddress::new() documentation for the bech32 format specification.

§Examples

Will be added soon. In the meantime, have a look at the test vectors from the BIP to see how to do a simple implementation.

Alternatively, have a look at Sp client, which is a WIP wallet client for building silent payment wallets.

Re-exports§

pub use bitcoin_hashes;
pub use secp256k1;

Modules§

receiving
The receiving component of silent payments.
sending
The sending component of silent payments.
utils
Utility functions for both sending and receiving.

Structs§

SilentPaymentAddress
A silent payment address struct that can be used to deserialize a silent payment address string.

Enums§

Error
Network
The network format used for this silent payment address.

Type Aliases§

Result