Skip to content

BlockchainCommons/sweeptool-cli

Repository files navigation

Blockchain Commons sweeptool-cli

  • part of the gordian technology family

Tool for sweeping bitcoin based on Bitcoin Dev Kit (bdk) and Uniform Resources. Funds can be swept either to an address or to another output descriptor by preserving the number of UTXOs.

Sweeptool connects to an Electrum server hosted by Blockstream or a server of your choice (including Esplora or Electrum server via Tor onion address) and synchronizes the list of transactions received and available UTXOs. Based on this information sweeptool produces a PSBT which can be signed by an offline signing device or by the tool itself.

Status - Late Alpha

sweeptool-cli is currently under active development and in the late alpha testing phase. It should not be used for production tasks until it has had further testing and auditing.

⚠️ Disclaimer

There are some risks involved associated with the usage of sweeptool:

  1. This tool is based on a fairly large framework with lots of small- and medium-sized dependencies. This presents a risk for a dependency or the package manager to get compromised.

  2. Using sweeptool with UR-based format is fairly new and therefore experimental.

Both of the risks (1 and 2) may lead to a loss of funds. To mitigate this risk user MUST double-check the output results of sweeptool with the input results of an (offline) signing device which user signs the PSBT with. Specifically, the entries that MUST match are: PSBT, destination address and the amount of funds swept.

  1. Another risk is associated with sweeping the funds from output descriptors to output descriptors. Here the UTXOs get fragmented and may become dust in which case they will entirely be given to miners. Note, that the larger the portion of UTXOs that hold a value below the miner fee, the worse the fee estimation function will work. Every UTXO (non dust) pays the same amount in fees.

Roadmap

  • sweep funds from descriptor to an address
  • support for URs (btc descriptor, btc address, psbt)
  • fee estimation
  • error handling
  • sweep funds from descriptor to another descriptor
  • access servers via Tor onion address (proxy)
  • signing a PSBT

Prerequisites

Make sure you have Rust and Cargo installed.

Installation Instructions

After downloading this repository, in order to compile sweeptool on Linux, libSSL1.1.1, provided by OpenSSL 1.1.1, is required. Debian distributions will provide this in the libssl1.1 and libssl-dev packages. Verify that the header files are the correct version.

If you downloaded OpenSSL 1.1.1, compile sweeptool with a command in the form:

OPENSSL_DIR=$HOME/openssl-1.1.1t OPENSSL_LIB_DIR=$HOME/openssl-1.1.1t cargo build

Otherwise, use:

$ cargo run

This will build and run the executable.

To run tests:

$ cargo test

To run tests with regtest network (requires installing https://github.com/vulpemventures/nigiri):

cargo test --features nigiri

Alternatively, you can build the executable like so

$ cargo build

It will be generated in target/debug/

Usage Instructions

See Manual

Gordian Principles

Sweeptool is a reference implementation meant to display the Gordian Principles, which are philosophical and technical underpinnings to Blockchain Commons' Gordian technology. This includes:

  • Independence. Sweeptool allows you to confidentially manage your own descriptor wallet.
  • Privacy. By focusing on descriptor technology, Sweeptool ensures that you have an infinite array of disposable addresses.
  • Resilience. Sweeptool is built to minimize the chances of losing funds when you sweep forward from a descriptor wallet.
  • Openness. Sweeptool is built on the open descriptor specification for Bitcoin.

Blockchain Commons apps do not phone home and do not run ads. Some are available through various app stores; all are available in our code repositories for your usage.

Origin, Authors, Copyright & Licenses

Unless otherwise noted (either in this /README.md or in the file's header comments) the contents of this repository are Copyright © 2020 by Blockchain Commons, LLC, and are licensed under the spdx:BSD-2-Clause Plus Patent License.

In most cases, the authors, copyright, and license for each file reside in header comments in the source code. When it does not, we will attempt to attribute it accurately in a table in this section.

Libraries

External libraries are listed in cargo.toml.

Since external libraries use their own libraries you can see the complete list of libraries in Cargo.lock

Derived from ...

This sweeptool-cli project is either derived from or was inspired by:

  • Bitcoin Dev Kit - A modern, lightweight, descriptor-based wallet library written in Rust

Subsequent Usage

Currently no other projects are based on this tool.

Financial Support

sweeptool-cli is a project of Blockchain Commons. We are proudly a "not-for-profit" social benefit corporation committed to open source & open development. Our work is funded entirely by donations and collaborative partnerships with people like you. Every contribution will be spent on building open tools, technologies, and techniques that sustain and advance blockchain and internet security infrastructure and promote an open web.

To financially support further development of sweeptool-cli and other projects, please consider becoming a Patron of Blockchain Commons through ongoing monthly patronage as a GitHub Sponsor. You can also support Blockchain Commons with bitcoins at our BTCPay Server.

Project Sponsors

Thanks to our project sponsors for their support of sweeptool-cli:

$sponsor-logo-with-link

$sponsor-description

Contributing

We encourage public contributions through issues and pull requests! Please review CONTRIBUTING.md for details on our development process. All contributions to this repository require a GPG signed Contributor License Agreement.

Discussions

The best place to talk about Blockchain Commons and its projects is in our GitHub Discussions areas.

Gordian System Discussions. For users and developers of the Gordian system, including the Gordian Server, Bitcoin Standup technology, QuickConnect, and the Gordian Wallet. If you want to talk about our linked full-node and wallet technology, suggest new additions to our Bitcoin Standup standards, or discuss the implementation our standalone wallet, the Discussions area of the main Gordian repo is the place.

Wallet Standard Discussions. For standards and open-source developers who want to talk about wallet standards, please use the Discussions area of the Airgapped Signing repo. This is where you can talk about projects like our LetheKit and command line tools such as seedtool, both of which are intended to testbed wallet technologies, plus the libraries that we've built to support your own deployment of wallet technology such as bc-bip39, bc-slip39, bc-shamir, Sharded Secret Key Reconstruction, bc-ur, and the bc-crypto-base. If it's a wallet-focused technology or a more general discussion of wallet standards,discuss it here.

Blockchain Commons Discussions. For developers, interns, and patrons of Blockchain Commons, please use the discussions area of the Community repo to talk about general Blockchain Commons issues, the intern program, or topics other than the Gordian System or the wallet standards, each of which have their own discussion areas.

Other Questions & Problems

As an open-source, open-development community, Blockchain Commons does not have the resources to provide direct support of our projects. Please consider the discussions area as a locale where you might get answers to questions. Alternatively, please use this repository's issues feature. Unfortunately, we can not make any promises on response time.

If your company requires support to use our projects, please feel free to contact us directly about options. We may be able to offer you a contract for support from one of our contributors, or we might be able to point you to another entity who can offer the contractual support that you need.

Credits

The following people directly contributed to this repository. You can add your name here by getting involved. The first step is learning how to contribute from our CONTRIBUTING.md documentation.

Name Role Github Email GPG Fingerprint
Christopher Allen Principal Architect @ChristopherA <ChristopherA@LifeWithAlacrity.com> FDFE 14A5 4ECB 30FC 5D22 74EF F8D3 6C91 3574 05ED
Gorazd Kovacic Developer @gorazdko <gorazdko@gmail.com> 41F0 EA16 99A7 4C1E 2FA4 1B53 8CF9 6BC3 FF9D BBCE

Responsible Disclosure

We want to keep all of our software safe for everyone. If you have discovered a security vulnerability, we appreciate your help in disclosing it to us in a responsible manner. We are unfortunately not able to offer bug bounties at this time.

We do ask that you offer us good faith and use best efforts not to leak information or harm any user, their data, or our developer community. Please give us a reasonable amount of time to fix the issue before you publish it. Do not defraud our users or us in the process of discovery. We promise not to bring legal action against researchers who point out a problem provided they do their best to follow the these guidelines.

Reporting a Vulnerability

Please report suspected security vulnerabilities in private via email to ChristopherA@BlockchainCommons.com (do not use this email for support). Please do NOT create publicly viewable issues for suspected security vulnerabilities.

The following keys may be used to communicate sensitive information to developers:

Name Fingerprint
Christopher Allen FDFE 14A5 4ECB 30FC 5D22 74EF F8D3 6C91 3574 05ED

You can import a key by running the following command with that individual’s fingerprint: gpg --recv-keys "<fingerprint>" Ensure that you put quotes around fingerprints that contain spaces.