DustSweeper

Struct DustSweeper 

Source
pub struct DustSweeper { /* private fields */ }
Expand description

DustSweeper provides functionality to identify and clean up dust UTXOs from a Bitcoin wallet in a privacy-preserving way.

§Privacy Features

  • Groups UTXOs by address to avoid linking different addresses
  • Creates separate transactions for each address’s dust

§Example

use bitcoincore_rpc::{Auth, Client};
use dust_cleaner::DustSweeper;

let rpc_client = Client::new(
    "http://localhost:18443",
    Auth::UserPass("user".to_string(), "pass".to_string())
).unwrap();

let sweeper = DustSweeper::new(rpc_client, 1000);
let dust_utxos = sweeper.get_dust_utxos().unwrap();

Implementations§

Source§

impl DustSweeper

Source

pub fn new(rpc_client: Client, threshold: u64) -> Self

Creates a new DustSweeper instance

§Arguments
  • rpc_client - Bitcoin Core RPC client
  • threshold - Amount in satoshis below which UTXOs are considered dust
Source

pub fn get_dust_utxos(&self) -> Result<Vec<ListUnspentResultEntry>, Error>

Retrieves all UTXOs below the dust threshold from the wallet

§Returns
  • Result<Vec<ListUnspentResultEntry>> - List of dust UTXOs or RPC error
Source

pub fn build_psbts_burn( &self, dust_utxos: Vec<ListUnspentResultEntry>, fee: u64, burn_addr: &str, ) -> Result<Vec<Psbt>, Error>

Creates PSBTs to burn dust UTXOs to a specified address

§Arguments
  • dust_utxos - Vector of dust UTXOs to burn
  • fee - Transaction fee in satoshis
  • burn_addr - Address to send dust to
§Returns
  • Result<Vec<Psbt>> - Vector of unsigned PSBTs or error
Source

pub fn psbt_to_base64(psbt: &Psbt) -> String

Converts a PSBT to base64 encoding for transport

§Arguments
  • psbt - The PSBT to encode
§Returns
  • String - Base64 encoded PSBT

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V