Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deniability - a tool to automatically improve coin ownership privacy #733

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/interfaces/wallet.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,16 @@ class Wallet
WalletValueMap value_map,
WalletOrderForm order_form) = 0;

virtual std::pair<unsigned int, bool> calculateDeniabilizationCycles(const COutPoint& outpoint) = 0;

virtual util::Result<CTransactionRef> createDeniabilizationTransaction(const std::set<COutPoint>& inputs,
const std::optional<OutputType>& opt_output_type,
unsigned int confirm_target,
unsigned int deniabilization_cycles,
bool sign,
bool& insufficient_amount,
CAmount& fee) = 0;

//! Return whether transaction can be abandoned.
virtual bool transactionCanBeAbandoned(const uint256& txid) = 0;

Expand All @@ -184,6 +194,13 @@ class Wallet
std::vector<bilingual_str>& errors,
uint256& bumped_txid) = 0;

//! Create a fee bump transaction for a deniabilization transaction
virtual util::Result<CTransactionRef> createBumpDeniabilizationTransaction(const uint256& txid,
unsigned int confirm_target,
bool sign,
CAmount& old_fee,
CAmount& new_fee) = 0;

//! Get a transaction.
virtual CTransactionRef getTx(const uint256& txid) = 0;

Expand Down Expand Up @@ -255,6 +272,9 @@ class Wallet
int* returned_target,
FeeReason* reason) = 0;

//! Get the fee rate for deniabilization
virtual CFeeRate getDeniabilizationFeeRate(unsigned int confirm_target) = 0;

//! Get tx confirm target.
virtual unsigned int getConfirmTarget() = 0;

Expand Down
2 changes: 2 additions & 0 deletions src/qt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ if(ENABLE_WALLET)
coincontroltreewidget.h
createwalletdialog.cpp
createwalletdialog.h
deniabilitydialog.cpp
deniabilitydialog.h
editaddressdialog.cpp
editaddressdialog.h
openuridialog.cpp
Expand Down
1 change: 1 addition & 0 deletions src/qt/bitcoin.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
<file alias="hd_disabled">res/icons/hd_disabled.png</file>
<file alias="network_disabled">res/icons/network_disabled.png</file>
<file alias="proxy">res/icons/proxy.png</file>
<file alias="crosseye">res/icons/crosseye.png</file>
</qresource>
<qresource prefix="/animation">
<file alias="spinner-000">res/animation/spinner-000.png</file>
Expand Down
18 changes: 18 additions & 0 deletions src/qt/bitcoingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,13 @@ void BitcoinGUI::createActions()
historyAction->setShortcut(QKeySequence(QStringLiteral("Alt+4")));
tabGroup->addAction(historyAction);

deniabilityAction = new QAction(platformStyle->SingleColorIcon(":/icons/crosseye"), tr("&Deniability"), this);
deniabilityAction->setStatusTip(tr("Improve coin ownership privacy"));
deniabilityAction->setToolTip(deniabilityAction->statusTip());
deniabilityAction->setCheckable(true);
deniabilityAction->setShortcut(QKeySequence(QStringLiteral("Alt+5")));
tabGroup->addAction(deniabilityAction);

#ifdef ENABLE_WALLET
// These showNormalIfMinimized are needed because Send Coins and Receive Coins
// can be triggered from the tray menu, and need to show the GUI to be useful.
Expand All @@ -288,6 +295,8 @@ void BitcoinGUI::createActions()
connect(receiveCoinsAction, &QAction::triggered, this, &BitcoinGUI::gotoReceiveCoinsPage);
connect(historyAction, &QAction::triggered, [this]{ showNormalIfMinimized(); });
connect(historyAction, &QAction::triggered, this, &BitcoinGUI::gotoHistoryPage);
connect(deniabilityAction, &QAction::triggered, [this] { showNormalIfMinimized(); });
connect(deniabilityAction, &QAction::triggered, this, &BitcoinGUI::gotoDeniabilityPage);
#endif // ENABLE_WALLET

quitAction = new QAction(tr("E&xit"), this);
Expand Down Expand Up @@ -597,6 +606,7 @@ void BitcoinGUI::createToolBars()
toolbar->addAction(sendCoinsAction);
toolbar->addAction(receiveCoinsAction);
toolbar->addAction(historyAction);
toolbar->addAction(deniabilityAction);
overviewAction->setChecked(true);

#ifdef ENABLE_WALLET
Expand Down Expand Up @@ -818,6 +828,7 @@ void BitcoinGUI::setWalletActionsEnabled(bool enabled)
sendCoinsAction->setEnabled(enabled);
receiveCoinsAction->setEnabled(enabled);
historyAction->setEnabled(enabled);
deniabilityAction->setEnabled(enabled);
encryptWalletAction->setEnabled(enabled);
backupWalletAction->setEnabled(enabled);
changePassphraseAction->setEnabled(enabled);
Expand Down Expand Up @@ -979,6 +990,12 @@ void BitcoinGUI::gotoHistoryPage()
if (walletFrame) walletFrame->gotoHistoryPage();
}

void BitcoinGUI::gotoDeniabilityPage()
{
deniabilityAction->setChecked(true);
if (walletFrame) walletFrame->gotoDeniabilityPage();
}

void BitcoinGUI::gotoReceiveCoinsPage()
{
receiveCoinsAction->setChecked(true);
Expand Down Expand Up @@ -1294,6 +1311,7 @@ void BitcoinGUI::changeEvent(QEvent *e)
sendCoinsAction->setIcon(platformStyle->SingleColorIcon(QStringLiteral(":/icons/send")));
receiveCoinsAction->setIcon(platformStyle->SingleColorIcon(QStringLiteral(":/icons/receiving_addresses")));
historyAction->setIcon(platformStyle->SingleColorIcon(QStringLiteral(":/icons/history")));
deniabilityAction->setIcon(platformStyle->SingleColorIcon(QStringLiteral(":/icons/crosseye")));
}

QMainWindow::changeEvent(e);
Expand Down
3 changes: 3 additions & 0 deletions src/qt/bitcoingui.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ class BitcoinGUI : public QMainWindow
QToolBar* appToolBar = nullptr;
QAction* overviewAction = nullptr;
QAction* historyAction = nullptr;
QAction* deniabilityAction = nullptr;
QAction* quitAction = nullptr;
QAction* sendCoinsAction = nullptr;
QAction* usedSendingAddressesAction = nullptr;
Expand Down Expand Up @@ -279,6 +280,8 @@ public Q_SLOTS:
void gotoOverviewPage();
/** Switch to history (transactions) page */
void gotoHistoryPage();
/** Switch to deniability (ownership obfuscation) page */
void gotoDeniabilityPage();
/** Switch to receive coins page */
void gotoReceiveCoinsPage();
/** Switch to send coins page */
Expand Down
Loading