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

Drop support for BCH CashAddr #250

Merged
merged 3 commits into from
Dec 13, 2022
Merged
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
1 change: 0 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ or running from source using `pyenv` (see section `Running from source on old Li
as that's simpler to use and has everything included. Otherwise, if you
want to run from source, see section `Running from source on macOS`_ below.

Electrum ABC is a pure python application forked from Electron Cash.
If you want to use the Qt interface, install the Qt dependencies::

sudo apt-get install python3-pyqt5 python3-pyqt5.qtsvg
Expand Down
3 changes: 0 additions & 3 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ Initially transactions will show up as unverified because
Electrum ABC is downloading the blockchain headers to verify the transactions.
This can take up to 10 minutes, but is only done once.

Ensure you are running Electrum ABC and not Electron Cash by checking for
"Electrum ABC" in the title bar wording.

We STRONGLY recommend you get comfortable and only send a small amount of eCash
coins at first, to yourself, to confirm the network is processing your
transactions as expected.
Expand Down
2 changes: 1 addition & 1 deletion contrib/build-linux/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Source tarballs

Where `COMMIT_OR_TAG` is a git commit or branch or tag (eg `master`, `4.0.2`, etc).

2. A `.tar.gz` and a `.zip` file of Electron Cash will be placed in the `dist/` subdirectory.
2. A `.tar.gz` and a `.zip` file of Electrum ABC will be placed in the `dist/` subdirectory.


AppImage
Expand Down
4 changes: 2 additions & 2 deletions contrib/build-linux/appimage/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AppImage binary for Electron Cash
============================
AppImage binary for Electrum ABC
================================

✓ _This binary is reproducible: you should be able to generate
binaries that match the official releases (i.e. with the same sha256 hash)._
Expand Down
6 changes: 0 additions & 6 deletions contrib/build-wine/electrum-abc.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,6 @@ Section
WriteRegStr ${INSTDIR_REG_ROOT} "Software\Classes\ecash" "URL Protocol" ""
WriteRegStr ${INSTDIR_REG_ROOT} "Software\Classes\ecash" "DefaultIcon" "$\"$INSTDIR\electrumABC.ico, 0$\""
WriteRegStr ${INSTDIR_REG_ROOT} "Software\Classes\ecash\shell\open\command" "" "$\"$INSTDIR\${INTERNAL_NAME}.exe$\" $\"%1$\""
;Links bitcoincash: URI's to Electrum ABC
WriteRegStr ${INSTDIR_REG_ROOT} "Software\Classes\bitcoincash" "" "URL:bitcoincash Protocol"
WriteRegStr ${INSTDIR_REG_ROOT} "Software\Classes\bitcoincash" "URL Protocol" ""
WriteRegStr ${INSTDIR_REG_ROOT} "Software\Classes\bitcoincash" "DefaultIcon" "$\"$INSTDIR\electrumABC.ico, 0$\""
WriteRegStr ${INSTDIR_REG_ROOT} "Software\Classes\bitcoincash\shell\open\command" "" "$\"$INSTDIR\${INTERNAL_NAME}.exe$\" $\"%1$\""

;Adds an uninstaller possibilty to Windows Uninstall or change a program section
WriteRegStr ${INSTDIR_REG_ROOT} "${INSTDIR_REG_KEY}" "DisplayName" "$(^Name)"
Expand Down Expand Up @@ -240,7 +235,6 @@ Section "Uninstall"
RMDir "$SMPROGRAMS\${PRODUCT_NAME}"

DeleteRegKey ${INSTDIR_REG_ROOT} "Software\Classes\ecash"
DeleteRegKey ${INSTDIR_REG_ROOT} "Software\Classes\bitcoincash"
DeleteRegKey ${INSTDIR_REG_ROOT} "Software\${PRODUCT_NAME}"
DeleteRegKey ${INSTDIR_REG_ROOT} "${INSTDIR_REG_KEY}"
SectionEnd
Expand Down
8 changes: 1 addition & 7 deletions contrib/osx/make_osx
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ python3 setup.py install --user > /dev/null || fail "Could not build $PACKAGE"
info "Building binary"
pyinstaller --clean --noconfirm --ascii --name $VERSION contrib/osx/osx.spec || fail "Could not build binary"

info "Adding ecash & bitcoincash URI types to Info.plist"
info "Adding ecash URI type to Info.plist"
# NB: Make sure there are no trailing spaces after the '\' characters here
plutil -insert 'CFBundleURLTypes' \
-xml \
Expand All @@ -249,12 +249,6 @@ plutil -insert 'CFBundleURLTypes' \
' <key>CFBundleURLSchemes</key> '\
' <array><string>ecash</string></array> '\
'</dict> '\
'<dict> '\
' <key>CFBundleURLName</key> '\
' <string>bitcoincash</string> '\
' <key>CFBundleURLSchemes</key> '\
' <array><string>bitcoincash</string></array> '\
'</dict> '\
'</array>' \
-- dist/$PACKAGE.app/Contents/Info.plist \
|| fail "Could not add keys to Info.plist. Make sure the program 'plutil' exists and is installed."
Expand Down
10 changes: 5 additions & 5 deletions contrib/package_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
# SOFTWARE.

"""
This script automates all the work involved in packaging an external Electron Cash plugin.
This script automates all the work involved in packaging an external Electrum ABC plugin.

Future work:
* Make this work on the command-line.
Expand Down Expand Up @@ -65,7 +65,7 @@ def write_plugin_archive(metadata, source_package_path, archive_file_path):
# Copy the selected Python package into place.
dest_package_path = os.path.join(temp_path, package_directory_name)
shutil.copytree(source_package_path, dest_package_path)
# Python bytecode cannot be written into the zip archive as Electron Cash runs it.
# Python bytecode cannot be written into the zip archive as Electrum ABC runs it.
# So we precompile it before creating the archived form.
compileall.compile_dir(dest_package_path)
shutil.make_archive(suffixless_path, 'zip', temp_path)
Expand Down Expand Up @@ -119,7 +119,7 @@ def __init__(self):

self.directory_path = None

self.setWindowTitle('Electron Cash Plugin Packager')
self.setWindowTitle('Electrum ABC Plugin Packager')
self.setMinimumWidth(500)
self.setMaximumWidth(500)

Expand Down Expand Up @@ -155,8 +155,8 @@ def __init__(self):
self.minimumElectronCashVersionEdit = QtWidgets.QLineEdit()
self.minimumElectronCashVersionEdit.setPlaceholderText("3.2")
self.minimumElectronCashVersionEdit.setMaximumWidth(50)
self.minimumElectronCashVersionEdit.setToolTip("This is the lowest version of Electron Cash which this plugin can be installed with.")
groupLayout.addRow('Minimum Electron Cash Version', self.minimumElectronCashVersionEdit)
self.minimumElectronCashVersionEdit.setToolTip("This is the lowest version of Electrum ABC which this plugin can be installed with.")
groupLayout.addRow('Minimum Electrum ABC Version', self.minimumElectronCashVersionEdit)

availableVLayout = QtWidgets.QVBoxLayout()
self.qtAvailableCheckBox = QtWidgets.QCheckBox("Supports the Qt user interface")
Expand Down
12 changes: 6 additions & 6 deletions contrib/update_checker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
This directory contains the `releases.json` file that the Electrum ABC update checker uses to determine when a new version of the application is available.

#### Update Checker Overview
As of version 3.3.6 of Electron Cash, there is an update-checking facility built-in to the Qt desktop app. The facility basically functions as follows:
There is an update-checking facility built-in to the Qt desktop app. The facility basically functions as follows:

1. When the user selects "Check for updates...", Electrum ABC connects to the URL hard-coded in `gui/qt/update_checker.py` (currently: https://raw.github.com/Bitcoin-ABC/ElectrumABC/master/contrib/update_checker/releases.json)
2. It downloads `releases.json` (the file in this directory)
Expand All @@ -21,24 +21,24 @@ You need to update `releases.json` in this directory whenever a new version is r

This file contains a dictionary of:
```
{
{
"version string" : { "bitcoin address" : "signed message" }
}
```
- **"version string"** above is a version of the form MAJOR.MINOR.REV[variant], e.g. "3.3.5" or "3.3.5CS" (in the latter, 'CS' is the variant)
- And empty/omitted variant means "Electrum ABC Regular"
- The variant must match the variant in `lib/version.py`.


#### How To Update `releases.json`

1. Release Electron Cash as normal, updating the version in `lib/version.py`.
1. Release Electrum ABC as normal, updating the version in `lib/version.py`.
2. After release, or in tandem with releasing, edit `releases.json`
3. Make sure to replace the entry for the old version with a new entry.
3. Make sure to replace the entry for the old version with a new entry.
4. So for example if you were on verson "3.3.4" before and you are now releasing "3.3.5", look for "3.3.4" in `releases.json`, and update it to "3.3.5"
5. Sign the text "3.3.5" with one of the bitcoin addresses listed in `gui/qt/update_checker.py`. Paste this address and the signed message (replacing the old address and signed message) into the dictionary entry for "3.3.5" in `releases.json`.
6. Push the new commit with the updated `releases.json` to master. (Since currently the `update_checker.py` code looks for this file in master on github).

##### Example
*The old entry:*

Expand Down
11 changes: 7 additions & 4 deletions electroncash/address.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,14 +337,17 @@ class Address(namedtuple("AddressTuple", "hash160 kind")):

# Address formats
FMT_CASHADDR = "CashAddr"
FMT_CASHADDR_BCH = "CashAddr BCH"
FMT_LEGACY = "Legacy"

# We keep this for now for the address converter tool and hw wallets, but it
# can no longer be shown in the rest of the UI.
FMT_CASHADDR_BCH = "CashAddr BCH"

# Default to CashAddr
FMT_UI = FMT_CASHADDR
"""Current address format used in the UI"""

FMTS_UI = [FMT_CASHADDR, FMT_CASHADDR_BCH, FMT_LEGACY]
FMTS_UI = [FMT_CASHADDR, FMT_LEGACY]
"""All address formats that can be used in the UI"""

FMT_UI_IDX = FMTS_UI.index(FMT_UI)
Expand Down Expand Up @@ -432,8 +435,8 @@ def from_string(cls, string: str, *,
"""Construct from an address string.
This supports the following formats:
- legacy BTC addresses
- CashAddr with a "bitcoincash:" prefix
- CashAddr with a prefix omitted if this prefix is "bitcoincash:"
- CashAddr with a "ecash:" prefix
- CashAddr with a prefix omitted if this prefix is "ecash:"
- CashAddr with an arbitrary prefix, if support_arbitrary_prefix
is True

Expand Down
12 changes: 6 additions & 6 deletions electroncash/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,8 @@ def create(self, passphrase=None, password=None, encrypt_file=True, seed_type=No
@command('')
def restore(self, text, passphrase=None, password=None, encrypt_file=True, wallet_path=None):
"""Restore a wallet from text. Text can be a seed phrase, a master
public key, a master private key, a list of bitcoin cash addresses
or bitcoin cash private keys.
public key, a master private key, a list of eCash addresses
or private keys.
If you want to be prompted for an argument, type '?' or ':' (concealed)
"""
d = restore_wallet_from_text(text,
Expand Down Expand Up @@ -923,8 +923,8 @@ def help(self):
param_descriptions = {
'wallet_path': 'Wallet path(create/restore commands)',
'privkey': 'Private key. Type \'?\' to get a prompt.',
'destination': 'Bitcoin Cash address, contact or alias',
'address': 'Bitcoin Cash address',
'destination': 'eCash address, contact or alias',
'address': 'eCash address',
'seed': 'Seed phrase',
'txid': 'Transaction ID',
'pos': 'Position',
Expand Down Expand Up @@ -1012,10 +1012,10 @@ def help(self):
'requests_dir': 'directory where a bip70 file will be written.',
'ssl_privkey': 'Path to your SSL private key, needed to sign the request.',
'ssl_chain': 'Chain of SSL certificates, needed for signed requests. Put your certificate at the top and the root CA at the end',
'url_rewrite': 'Parameters passed to str.replace(), in order to create the r= part of bitcoincash: URIs. Example: \"(\'file:///var/www/\',\'https://electron-cash.org/\')\"',
'url_rewrite': 'Parameters passed to str.replace(), in order to create the r= part of ecash: URIs. Example: \"(\'file:///var/www/\',\'https://electron-cash.org/\')\"',
},
'listrequests':{
'url_rewrite': 'Parameters passed to str.replace(), in order to create the r= part of bitcoincash: URIs. Example: \"(\'file:///var/www/\',\'https://electron-cash.org/\')\"',
'url_rewrite': 'Parameters passed to str.replace(), in order to create the r= part of ecash: URIs. Example: \"(\'file:///var/www/\',\'https://electron-cash.org/\')\"',
}
}

Expand Down
5 changes: 5 additions & 0 deletions electroncash/migrate_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,11 @@ def update_config():
_logger.info("Updating the block explorer to the new default explorer.e.cash")
config["block_explorer"] = "eCash"

# We no longer support the BCH Cash Address format in the GUI as of 5.1.7
if config.get('address_format') == "CashAddr BCH":
_logger.info("Updating the Cash Addr format from bitcoincash: to ecash:")
config["address_format"] = "CashAddr"

# update version number, to avoid doing this again for this version
config["latest_version_used"] = VERSION_TUPLE
save_user_config(config, get_user_dir())
2 changes: 1 addition & 1 deletion electroncash/wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -2114,7 +2114,7 @@ def add_input_info(self, txin):
address = txin['address']
if self.is_mine(address):
txin['type'] = self.get_txin_type(address)
# Bitcoin Cash needs value to sign
# eCash needs value to sign
received, spent = self.get_addr_io(address)
item = received.get(txin['prevout_hash']+':%d'%txin['prevout_n'])
tx_height, value, is_cb = item
Expand Down
5 changes: 1 addition & 4 deletions electroncash_gui/qt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ def _check_and_warn_qt_version(self):


def eventFilter(self, obj, event):
''' This event filter allows us to open bitcoincash: URIs on macOS '''
''' This event filter allows us to open ecash: URIs on macOS '''
if event.type() == QtCore.QEvent.FileOpen:
if len(self.windows) >= 1:
self.windows[0].pay_to_URI(event.url().toString())
Expand Down Expand Up @@ -942,9 +942,6 @@ def notify(self, message):
def is_cashaddr(self) -> bool:
return bool(self.get_config_addr_format() == Address.FMT_CASHADDR)

def is_cashaddr_bch(self) -> bool:
return bool(self.get_config_addr_format() == Address.FMT_CASHADDR_BCH)

def get_config_addr_format(self) -> str:
return self.config.get('address_format', Address.FMT_CASHADDR)

Expand Down
17 changes: 4 additions & 13 deletions electroncash_gui/qt/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -1542,12 +1542,12 @@ def update_receive_qr(self):
if opret:
kwargs[arg] = opret

# Special case hack -- see #1473. Omit bitcoincash: prefix from
# Special case hack -- see #1473. Omit ecash: prefix from
# legacy address if no other params present in receive request.
if Address.FMT_UI == Address.FMT_LEGACY and not kwargs and not amount and not message:
uri = self.receive_address.to_ui_string_without_prefix()
else:
# Otherwise proceed as normal, prepending bitcoincash: to URI
# Otherwise proceed as normal, prepending ecash: to URI
uri = web.create_URI(self.receive_address, amount, message, **kwargs)

self.receive_qr.setData(uri)
Expand All @@ -1571,9 +1571,7 @@ def create_send_tab(self):
_("You may enter:"
"<ul>"
f"<li> {CURRENCY} <b>Address</b> <b>★</b>"
"<li> Bitcoin Cash <b>Address</b> <b>★</b>"
"<li> Bitcoin Legacy <b>Address</b> <b>★</b>"
"<li> <b>Cash Account</b> <b>★</b> e.g. <i>satoshi#123</i>"
"<li> <b>Contact name</b> <b>★</b> from the Contacts tab"
"<li> <b>OpenAlias</b> e.g. <i>satoshi@domain.com</i>"
"</ul><br>"
Expand Down Expand Up @@ -2460,7 +2458,7 @@ def pay_to_URI(self, URI):
if address or URI.strip().lower().split(':', 1)[0] in web.parseable_schemes():
# if address, set the payto field to the address.
# if *not* address, then we set the payto field to the empty string
# only IFF it was bitcoincash:, see issue #1131.
# only IFF it was ecash:, see issue Electron-Cash#1131.
self.payto_e.setText(address or '')
if message:
self.message_e.setText(message)
Expand Down Expand Up @@ -3299,7 +3297,7 @@ def _on_qr_reader_finished(success: bool, error: str, result):
return
if not result:
return
# if the user scanned a bitcoincash URI
# if the user scanned an ecash URI
if result.lower().startswith(networks.net.CASHADDR_PREFIX + ':'):
self.pay_to_URI(result)
return
Expand Down Expand Up @@ -4011,16 +4009,12 @@ def update_fiat(self):
def cashaddr_icon(self):
if self.gui_object.is_cashaddr():
return QIcon(":icons/tab_converter.svg")
elif self.gui_object.is_cashaddr_bch():
return QIcon(":icons/tab_converter_red.svg")
else:
return QIcon(":icons/tab_converter_bw.svg")

def cashaddr_status_tip(self):
if self.gui_object.is_cashaddr():
return _('Address Format') + ' - ' + _('CashAddr')
elif self.gui_object.is_cashaddr_bch():
return _('Address Format') + ' - ' + _('CashAddr') + ' BCH'
else:
return _('Address Format') + ' - ' + _('Legacy')

Expand Down Expand Up @@ -4402,9 +4396,6 @@ def on_fontconfig_chk():
cashaddr_cbox.addItem(QIcon(':icons/tab_converter.svg'),
_("CashAddr"),
Address.FMT_CASHADDR)
cashaddr_cbox.addItem(QIcon(':icons/tab_converter_red.svg'),
_("CashAddr") + " BCH",
Address.FMT_CASHADDR_BCH)
cashaddr_cbox.addItem(QIcon(':icons/tab_converter_bw.svg'),
_("Legacy"),
Address.FMT_LEGACY)
Expand Down
4 changes: 2 additions & 2 deletions electroncash_plugins/README.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Electron Cash - Plugins
=======================
Electrum ABC - Plugins
======================

The plugin system of Electrum ABC is designed to allow the development
of new features without increasing the core code of Electrum ABC.
Expand Down
6 changes: 4 additions & 2 deletions electroncash_plugins/ledger/ledger.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,8 +487,9 @@ def sign_transaction(self, tx, password, *, use_cache=False):
# Sign all inputs
inputIndex = 0
client_ledger.enableAlternate2fa(False)
cashaddr = Address.FMT_UI == Address.FMT_CASHADDR_BCH
cashaddr = Address.FMT_UI == Address.FMT_CASHADDR
if cashaddr and client_electrum.supports_cashaddr():
# For now the Ledger will show a bitcoincash: CashAddr
client_ledger.startUntrustedTransaction(True, inputIndex, chipInputs,
redeemScripts[inputIndex], cashAddr=True)
else:
Expand Down Expand Up @@ -550,7 +551,8 @@ def show_address(self, sequence):
address_path = self.get_derivation()[2:] + "/{:d}/{:d}".format(*sequence)
self.handler.show_message(_('Showing address on {}...').format(self.device))
try:
if Address.FMT_UI == Address.FMT_CASHADDR_BCH and self.get_client_electrum().supports_cashaddr():
if Address.FMT_UI == Address.FMT_CASHADDR and self.get_client_electrum().supports_cashaddr():
# For now the Ledger will show a bitcoincash: CashAddr
client.getWalletPublicKey(address_path, showOnScreen=True, cashAddr=True)
else:
client.getWalletPublicKey(address_path, showOnScreen=True)
Expand Down
2 changes: 1 addition & 1 deletion electrum-abc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
# pylint: disable=C0103
# pylint: enable=C0103
"""
Electron Cash - lightweight Bitcoin Cash client
Electrum ABC - lightweight eCash client
"""
from __future__ import annotations

Expand Down
2 changes: 1 addition & 1 deletion electrum-abc.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ StartupNotify=true
StartupWMClass=Electrum ABC
Terminal=false
Type=Application
MimeType=x-scheme-handler/bitcoincash;
MimeType=x-scheme-handler/ecash;
Actions=Testnet;

[Desktop Action Testnet]
Expand Down
3 changes: 1 addition & 2 deletions org.bitcoinabc.Electrum-ABC.appdata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<name>Electrum ABC</name>
<summary>Lightweight eCash Client</summary>
<description>
<p>Electrum ABC is an SPV wallet for Bitcoin Cash</p>
<p>Electrum ABC is an SPV wallet for eCash</p>
<p>Control your own private keys. Easily back up your wallet with a mnemonic seed phrase. Enjoy high security without downloading the blockchain or running a full node.</p>
</description>
<keywords>
Expand Down Expand Up @@ -34,6 +34,5 @@
</provides>
<mimetypes>
<mimetype>x-scheme-handler/ecash</mimetype>
<mimetype>x-scheme-handler/bitcoincash</mimetype>
</mimetypes>
</component>