Skip to content

Commit

Permalink
Add limit/offset to verify receive address
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Flaxman committed Nov 10, 2020
1 parent 1c4ee84 commit 7a5de77
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 10 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ python multiwallet_gui/app.py
```

## Roadmap:
* Allow user to select limit/offset for receive address verfication
* Mainnet/testnet toggle
* Add QR code generation on send/receive
* Support arbitrary paths
Expand Down
5 changes: 5 additions & 0 deletions clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
rm -rf .venv3/
rm -rf dist/
rm -rf build/
rm -rf multiwallet.egg-info/
find . | grep -E "(__pycache__|\.pyc|\.pyo$)" | xargs rm -rf
31 changes: 24 additions & 7 deletions multiwallet_gui/receive.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
#! /usr/bin/env bash

import re

from PyQt5.QtWidgets import (
QApplication,
QVBoxLayout,
QWidget,
QLabel,
QPlainTextEdit,
QPushButton,
QSpinBox,
)

from multiwallet_gui.helper import _clean_submisission, _msgbox_err, _is_libsec_enabled
Expand Down Expand Up @@ -112,13 +114,26 @@ def __init__(self):

self.descriptorLabel = QLabel("<b>Wallet Descriptor</b>")
self.descriptorLabel.setToolTip(
"This extended <i>public</i> key information is used to generate your bitcoin addresses."
"This extended <i>public</i> key information (from all your hardware wallets) is used to generate your bitcoin addresses."
"<br><br>From Specter-Desktop: Wallet > Settings > Export To Wallet Software > Export > Copy wallet data."
)
self.descriptorEdit = QPlainTextEdit("")
self.descriptorEdit.setPlaceholderText(
"Something like this:\n\nwsh(sortedmulti(2,[deadbeef/48h/1h/0h/2h]xpub.../0/*,"
)

self.limit_label = QLabel("<b>Limit of Addresses to Derive</b>")
self.limit_label.setToolTip("Address derivation is slow.")
self.limit_box = QSpinBox()
self.limit_box.setValue(5)
self.limit_box.setRange(1, 10000)

self.offset_label = QLabel("<b>Offset of Addresses to Derive</b>")
self.offset_label.setToolTip("Advanced users only.")
self.offset_box = QSpinBox()
self.offset_box.setValue(0)
self.offset_box.setMinimum(0)

self.descriptorSubmitButton = QPushButton("Derive Addresses")
self.descriptorSubmitButton.clicked.connect(self.process_submit)

Expand All @@ -132,6 +147,10 @@ def __init__(self):

vbox.addWidget(self.descriptorLabel)
vbox.addWidget(self.descriptorEdit)
vbox.addWidget(self.limit_label)
vbox.addWidget(self.limit_box)
vbox.addWidget(self.offset_label)
vbox.addWidget(self.offset_box)
vbox.addWidget(self.descriptorSubmitButton)
vbox.addWidget(self.addrResultsLabel)
vbox.addWidget(self.addrResultsEdit)
Expand Down Expand Up @@ -170,18 +189,16 @@ def process_submit(self):
self.addrResultsLabel.setText(results_label)
self.addrResultsEdit.setHidden(False)

# https://stackoverflow.com/questions/44014108/pass-a-variable-between-two-scripts
# TODO: make configurable
OFFSET = 0
LIMIT = 5
limit = self.limit_box.value()
offset = self.offset_box.value()

# https://stackoverflow.com/questions/50104163/update-pyqt-gui-from-a-python-thread
for index, address in get_addresses(
pubkey_dicts=pubkeys_info["pubkey_dicts"],
quorum_m=pubkeys_info["quorum_m"],
quorum_n=pubkeys_info["quorum_n"],
limit=LIMIT,
offset=OFFSET,
limit=limit,
offset=offset,
is_testnet=pubkeys_info["is_testnet"],
):
result = f"#{index}: {address}"
Expand Down
2 changes: 1 addition & 1 deletion multiwallet_gui/send.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def __init__(self):
"<b>Partially Signed Bitcoin Transaction</b> (required)"
)
self.psbtLabel.setToolTip(
"Transaction that your online computer is asking you to sign, in base64 format."
"What your online computer is asking you to sign, in base64 format."
)
self.psbtEdit = QPlainTextEdit("")
self.psbtEdit.setPlaceholderText("Something like this:\n\ncHNidP8BAH0CAAAAA...")
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

setup(
name="multiwallet",
version="0.3.3",
version="0.3.4",
author="Michael Flaxman",
author_email="[email protected]",
description="Stateless multisig bitcoin wallet",
Expand Down

0 comments on commit 7a5de77

Please sign in to comment.