Skip to content

Commit

Permalink
add mainnet to seedpicker
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Flaxman committed Nov 15, 2020
1 parent 7a5de77 commit 42f1ebb
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 27 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ python multiwallet_gui/app.py
```

## Roadmap:
* Mainnet/testnet toggle
* Mainnet/testnet toggle on sending
* Add QR code generation on send/receive
* Support arbitrary paths
* Test/release on multiple OS
Expand Down
10 changes: 0 additions & 10 deletions multiwallet_gui/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from PyQt5.QtWidgets import (
QApplication,
QDialog,
QDialogButtonBox,
QTabWidget,
QVBoxLayout,
)
Expand All @@ -27,15 +26,6 @@ def __init__(self):

self.tab_widget = QTabWidget()

if False:
# TODO: use something like this for a testnet toggle
self.buttonbox = QDialogButtonBox(
QDialogButtonBox.Ok | QDialogButtonBox.Cancel
)
self.buttonbox.accepted.connect(self.accept)
self.buttonbox.rejected.connect(self.reject)
self.layout.addWidget(self.buttonbox)

# Initialize tab screen
self.seedpicker_tab = SeedpickerTab()
self.receive_tab = ReceiveTab()
Expand Down
46 changes: 32 additions & 14 deletions multiwallet_gui/seedpicker.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
from multiwallet_gui.helper import _clean_submisission, _msgbox_err

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

Expand Down Expand Up @@ -43,7 +44,7 @@ def __init__(self):
super().__init__()
self.layout = QVBoxLayout()

self.firstWordsLabel = QLabel("<b>First 23 Words of Your Seed</b>")
self.firstWordsLabel = QLabel("<b>First 23 Words of Your Seed Phrase</b>")
self.firstWordsLabel.setToolTip(
"Pull words out of a hat so you don't have to trust a random number generator."
)
Expand All @@ -52,7 +53,16 @@ def __init__(self):
"zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo"
)

# self.firstWordsSubmitButton = QPushButton(self)
# Network toggle
# https://www.tutorialspoint.com/pyqt/pyqt_qradiobutton_widget.htm
self.button_label = QLabel("<b>Bitcoin Network</b>")
self.button_label.setToolTip("We recommend practicing first on testnet.")
self.mainnet_button = QRadioButton("Mainnet (regular)")
# self.mainnet_button.toggled.connect(self.updateNetwork) # TODO: wire up any changes to reset the form
self.mainnet_button.setChecked(False)
self.testnet_button = QRadioButton("Testnet")
self.testnet_button.setChecked(True)

self.firstWordsSubmitButton = QPushButton("Calculate Full Seed")
self.firstWordsSubmitButton.setText("Calculate Full Seed")
self.firstWordsSubmitButton.clicked.connect(self.process_submit)
Expand All @@ -73,13 +83,19 @@ def __init__(self):
self.pubResultsEdit.setReadOnly(True)
self.pubResultsEdit.setHidden(True)

self.layout.addWidget(self.firstWordsLabel)
self.layout.addWidget(self.firstWordsEdit)
self.layout.addWidget(self.firstWordsSubmitButton)
self.layout.addWidget(self.privResultsLabel)
self.layout.addWidget(self.privResultsEdit)
self.layout.addWidget(self.pubResultsLabel)
self.layout.addWidget(self.pubResultsEdit)
for widget in (
self.firstWordsLabel,
self.firstWordsEdit,
self.button_label,
self.mainnet_button,
self.testnet_button,
self.firstWordsSubmitButton,
self.privResultsLabel,
self.privResultsEdit,
self.pubResultsLabel,
self.pubResultsEdit,
):
self.layout.addWidget(widget)

self.setLayout(self.layout)

Expand Down Expand Up @@ -128,12 +144,14 @@ def process_submit(self):
)

IS_TESTNET = True # TESTNET ONLY FOR NOW
if IS_TESTNET:
PATH = "m/48'/1'/0'/2'"
SLIP132_VERSION_BYTES = "02575483"
else:
if self.mainnet_button.isChecked():
# Mainnet
PATH = "m/48'/0'/0'/2'"
SLIP132_VERSION_BYTES = "02aa7ed3"
else:
# Testent
PATH = "m/48'/1'/0'/2'"
SLIP132_VERSION_BYTES = "02575483"

last_word = valid_checksum_words[0]
hd_priv = HDPrivateKey.from_mnemonic(first_words + " " + last_word)
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
buidl==0.1.9
buidl==0.2.1
PyQt5==5.15.1
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.4",
version="0.3.5",
author="Michael Flaxman",
author_email="[email protected]",
description="Stateless multisig bitcoin wallet",
Expand Down

0 comments on commit 42f1ebb

Please sign in to comment.