Merge pull request #1 from kodxana/master

BTC to LBC
This commit is contained in:
Thomas Zarebczan 2018-12-21 15:02:50 -05:00 committed by GitHub
commit c1eef023dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 86 additions and 115 deletions

View file

@ -93,7 +93,7 @@ exe_standalone = EXE(
a.scripts, a.scripts,
a.binaries, a.binaries,
a.datas, a.datas,
name=os.path.join('build\\pyi.win32\\electrum', cmdline_name + ".exe"), name=os.path.join('build\\pyi.win32\\electrum-lbry', cmdline_name + ".exe"),
debug=False, debug=False,
strip=None, strip=None,
upx=False, upx=False,
@ -106,7 +106,7 @@ exe_portable = EXE(
a.scripts, a.scripts,
a.binaries, a.binaries,
a.datas + [ ('is_portable', 'README.md', 'DATA' ) ], a.datas + [ ('is_portable', 'README.md', 'DATA' ) ],
name=os.path.join('build\\pyi.win32\\electrum', cmdline_name + "-portable.exe"), name=os.path.join('build\\pyi.win32\\electrum-lbry', cmdline_name + "-portable.exe"),
debug=False, debug=False,
strip=None, strip=None,
upx=False, upx=False,
@ -120,7 +120,7 @@ exe_dependent = EXE(
pyz, pyz,
a.scripts, a.scripts,
exclude_binaries=True, exclude_binaries=True,
name=os.path.join('build\\pyi.win32\\electrum', cmdline_name), name=os.path.join('build\\pyi.win32\\electrum-lbry', cmdline_name),
debug=False, debug=False,
strip=None, strip=None,
upx=False, upx=False,

View file

@ -20,7 +20,7 @@ RUN dpkg --add-architecture i386 && \
wine-stable-i386:i386=3.0.1~bionic \ wine-stable-i386:i386=3.0.1~bionic \
wine-stable:amd64=3.0.1~bionic \ wine-stable:amd64=3.0.1~bionic \
winehq-stable:amd64=3.0.1~bionic \ winehq-stable:amd64=3.0.1~bionic \
git=1:2.17.1-1ubuntu0.3 \ git \
p7zip-full=16.02+dfsg-6 \ p7zip-full=16.02+dfsg-6 \
make=4.1-9.1ubuntu1 \ make=4.1-9.1ubuntu1 \
mingw-w64=5.0.3-1 \ mingw-w64=5.0.3-1 \

View file

@ -6,7 +6,7 @@
;-------------------------------- ;--------------------------------
;Variables ;Variables
!define PRODUCT_NAME "Electrum" !define PRODUCT_NAME "LBRY_Wallet"
!define PRODUCT_WEB_SITE "https://github.com/spesmilo/electrum" !define PRODUCT_WEB_SITE "https://github.com/spesmilo/electrum"
!define PRODUCT_PUBLISHER "Electrum Technologies GmbH" !define PRODUCT_PUBLISHER "Electrum Technologies GmbH"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
@ -16,7 +16,7 @@
;Name and file ;Name and file
Name "${PRODUCT_NAME}" Name "${PRODUCT_NAME}"
OutFile "dist/electrum-setup.exe" OutFile "dist/electrum-lbry-setup.exe"
;Default installation folder ;Default installation folder
InstallDir "$PROGRAMFILES\${PRODUCT_NAME}" InstallDir "$PROGRAMFILES\${PRODUCT_NAME}"
@ -122,14 +122,14 @@ Section
;Create desktop shortcut ;Create desktop shortcut
DetailPrint "Creating desktop shortcut..." DetailPrint "Creating desktop shortcut..."
CreateShortCut "$DESKTOP\${PRODUCT_NAME}.lnk" "$INSTDIR\electrum-${PRODUCT_VERSION}.exe" "" CreateShortCut "$DESKTOP\${PRODUCT_NAME}.lnk" "$INSTDIR\electrum-lbry-${PRODUCT_VERSION}.exe" ""
;Create start-menu items ;Create start-menu items
DetailPrint "Creating start-menu items..." DetailPrint "Creating start-menu items..."
CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}" CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}"
CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall.lnk" "$INSTDIR\Uninstall.exe" "" "$INSTDIR\Uninstall.exe" 0 CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall.lnk" "$INSTDIR\Uninstall.exe" "" "$INSTDIR\Uninstall.exe" 0
CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\${PRODUCT_NAME}.lnk" "$INSTDIR\electrum-${PRODUCT_VERSION}.exe" "" "$INSTDIR\electrum-${PRODUCT_VERSION}.exe" 0 CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\${PRODUCT_NAME}.lnk" "$INSTDIR\electrum-lbry-${PRODUCT_VERSION}.exe" "" "$INSTDIR\electrum-lbry-${PRODUCT_VERSION}.exe" 0
CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\${PRODUCT_NAME} Testnet.lnk" "$INSTDIR\electrum-${PRODUCT_VERSION}.exe" "--testnet" "$INSTDIR\electrum-${PRODUCT_VERSION}.exe" 0 CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\${PRODUCT_NAME} Testnet.lnk" "$INSTDIR\electrum-lbry-${PRODUCT_VERSION}.exe" "--testnet" "$INSTDIR\electrum-lbry-${PRODUCT_VERSION}.exe" 0
;Links bitcoin: URI's to Electrum ;Links bitcoin: URI's to Electrum
@ -167,7 +167,7 @@ Section "Uninstall"
Delete "$SMPROGRAMS\${PRODUCT_NAME}\*.*" Delete "$SMPROGRAMS\${PRODUCT_NAME}\*.*"
RMDir "$SMPROGRAMS\${PRODUCT_NAME}" RMDir "$SMPROGRAMS\${PRODUCT_NAME}"
DeleteRegKey HKCU "Software\Classes\bitcoin" DeleteRegKey HKCU "Software\Classes\lbc"
DeleteRegKey HKCU "Software\${PRODUCT_NAME}" DeleteRegKey HKCU "Software\${PRODUCT_NAME}"
DeleteRegKey HKCU "${PRODUCT_UNINST_KEY}" DeleteRegKey HKCU "${PRODUCT_UNINST_KEY}"
SectionEnd SectionEnd

View file

@ -110,7 +110,7 @@ class BaseWizard(object):
('standard', _("Standard wallet")), ('standard', _("Standard wallet")),
('2fa', _("Wallet with two-factor authentication")), ('2fa', _("Wallet with two-factor authentication")),
('multisig', _("Multi-signature wallet")), ('multisig', _("Multi-signature wallet")),
('imported', _("Import Bitcoin addresses or private keys")), ('imported', _("Import LBRY Credits addresses or private keys")),
] ]
choices = [pair for pair in wallet_kinds if pair[0] in wallet_types] choices = [pair for pair in wallet_kinds if pair[0] in wallet_types]
self.choice_dialog(title=title, message=message, choices=choices, run_next=self.on_wallet_type) self.choice_dialog(title=title, message=message, choices=choices, run_next=self.on_wallet_type)
@ -183,8 +183,8 @@ class BaseWizard(object):
def import_addresses_or_keys(self): def import_addresses_or_keys(self):
v = lambda x: keystore.is_address_list(x) or keystore.is_private_key_list(x) v = lambda x: keystore.is_address_list(x) or keystore.is_private_key_list(x)
title = _("Import Bitcoin Addresses") title = _("Import LBRY Credits Addresses")
message = _("Enter a list of Bitcoin addresses (this will create a watching-only wallet), or a list of private keys.") message = _("Enter a list of LBRY Credits addresses (this will create a watching-only wallet), or a list of private keys.")
self.add_xpub_dialog(title=title, message=message, run_next=self.on_import, self.add_xpub_dialog(title=title, message=message, run_next=self.on_import,
is_valid=v, allow_multi=True, show_wif_help=True) is_valid=v, allow_multi=True, show_wif_help=True)
@ -340,14 +340,14 @@ class BaseWizard(object):
# There is no general standard for HD multisig. # There is no general standard for HD multisig.
# For legacy, this is partially compatible with BIP45; assumes index=0 # For legacy, this is partially compatible with BIP45; assumes index=0
# For segwit, a custom path is used, as there is no standard at all. # For segwit, a custom path is used, as there is no standard at all.
default_choice_idx = 2 default_choice_idx = 0
choices = [ choices = [
('standard', 'legacy multisig (p2sh)', "m/45'/0"), ('standard', 'legacy multisig (p2sh)', "m/45'/0"),
('p2wsh-p2sh', 'p2sh-segwit multisig (p2wsh-p2sh)', purpose48_derivation(0, xtype='p2wsh-p2sh')), ('p2wsh-p2sh', 'p2sh-segwit multisig (p2wsh-p2sh)', purpose48_derivation(0, xtype='p2wsh-p2sh')),
('p2wsh', 'native segwit multisig (p2wsh)', purpose48_derivation(0, xtype='p2wsh')), ('p2wsh', 'native segwit multisig (p2wsh)', purpose48_derivation(0, xtype='p2wsh')),
] ]
else: else:
default_choice_idx = 2 default_choice_idx = 0
choices = [ choices = [
('standard', 'legacy (p2pkh)', bip44_derivation(0, bip43_purpose=44)), ('standard', 'legacy (p2pkh)', bip44_derivation(0, bip43_purpose=44)),
('p2wpkh-p2sh', 'p2sh-segwit (p2wpkh-p2sh)', bip44_derivation(0, bip43_purpose=49)), ('p2wpkh-p2sh', 'p2sh-segwit (p2wpkh-p2sh)', bip44_derivation(0, bip43_purpose=49)),
@ -544,10 +544,10 @@ class BaseWizard(object):
_("The type of addresses used by your wallet will depend on your seed."), _("The type of addresses used by your wallet will depend on your seed."),
_("Segwit wallets use bech32 addresses, defined in BIP173."), _("Segwit wallets use bech32 addresses, defined in BIP173."),
_("Please note that websites and other wallets may not support these addresses yet."), _("Please note that websites and other wallets may not support these addresses yet."),
_("Thus, you might want to keep using a non-segwit wallet in order to be able to receive bitcoins during the transition period.") _("Thus, you might want to keep using a non-segwit wallet in order to be able to receive LBRY Credits during the transition period.")
]) ])
choices = [ choices = [
('create_segwit_seed', _('Segwit')),
('create_standard_seed', _('Legacy')), ('create_standard_seed', _('Legacy')),
] ]
self.choice_dialog(title=title, message=message, choices=choices, run_next=self.run) self.choice_dialog(title=title, message=message, choices=choices, run_next=self.run)

View file

@ -91,7 +91,7 @@ def command(s):
wallet = args[0].wallet wallet = args[0].wallet
password = kwargs.get('password') password = kwargs.get('password')
if c.requires_wallet and wallet is None: if c.requires_wallet and wallet is None:
raise Exception("wallet not loaded. Use 'electrum daemon load_wallet'") raise Exception("wallet not loaded. Use 'electrum-lbry daemon load_wallet'")
if c.requires_password and password is None and wallet.has_password(): if c.requires_password and password is None and wallet.has_password():
return {'error': 'Password required' } return {'error': 'Password required' }
return func(*args, **kwargs) return func(*args, **kwargs)
@ -156,8 +156,8 @@ class Commands:
@command('') @command('')
def restore(self, text, passphrase=None, password=None, encrypt_file=True): def restore(self, text, passphrase=None, password=None, encrypt_file=True):
"""Restore a wallet from text. Text can be a seed phrase, a master """Restore a wallet from text. Text can be a seed phrase, a master
public key, a master private key, a list of bitcoin addresses public key, a master private key, a list of lbry credits addresses
or bitcoin private keys. If you want to be prompted for your or lbry credits private keys. If you want to be prompted for your
seed, type '?' or ':' (concealed) """ seed, type '?' or ':' (concealed) """
storage = WalletStorage(self.config.get_wallet_path()) storage = WalletStorage(self.config.get_wallet_path())
if storage.file_exists(): if storage.file_exists():
@ -366,7 +366,7 @@ class Commands:
@command('') @command('')
def dumpprivkeys(self): def dumpprivkeys(self):
"""Deprecated.""" """Deprecated."""
return "This command is deprecated. Use a pipe instead: 'electrum listaddresses | electrum getprivatekeys - '" return "This command is deprecated. Use a pipe instead: 'electrum-lbry listaddresses | electrum-lbry getprivatekeys - '"
@command('') @command('')
def validateaddress(self, address): def validateaddress(self, address):
@ -536,7 +536,7 @@ class Commands:
@command('w') @command('w')
def setlabel(self, key, label): def setlabel(self, key, label):
"""Assign a label to an item. Item may be a bitcoin address or a """Assign a label to an item. Item may be a LBRY Credits address or a
transaction ID""" transaction ID"""
self.wallet.set_label(key, label) self.wallet.set_label(key, label)
@ -616,7 +616,7 @@ class Commands:
PR_PAID: 'Paid', PR_PAID: 'Paid',
PR_EXPIRED: 'Expired', PR_EXPIRED: 'Expired',
} }
out['amount (BTC)'] = format_satoshis(out.get('amount')) out['amount (LBC)'] = format_satoshis(out.get('amount'))
out['status'] = pr_str[out.get('status', PR_UNKNOWN)] out['status'] = pr_str[out.get('status', PR_UNKNOWN)]
return out return out
@ -756,8 +756,8 @@ def eval_bool(x: str) -> bool:
param_descriptions = { param_descriptions = {
'privkey': 'Private key. Type \'?\' to get a prompt.', 'privkey': 'Private key. Type \'?\' to get a prompt.',
'destination': 'Bitcoin address, contact or alias', 'destination': 'LBRY Credits address, contact or alias',
'address': 'Bitcoin address', 'address': 'LBRY Credits address',
'seed': 'Seed phrase', 'seed': 'Seed phrase',
'txid': 'Transaction ID', 'txid': 'Transaction ID',
'pos': 'Position', 'pos': 'Position',
@ -767,8 +767,8 @@ param_descriptions = {
'pubkey': 'Public key', 'pubkey': 'Public key',
'message': 'Clear text message. Use quotes if it contains spaces.', 'message': 'Clear text message. Use quotes if it contains spaces.',
'encrypted': 'Encrypted message', 'encrypted': 'Encrypted message',
'amount': 'Amount to be sent (in BTC). Type \'!\' to send the maximum available.', 'amount': 'Amount to be sent (in LBC). Type \'!\' to send the maximum available.',
'requested_amount': 'Requested amount (in BTC).', 'requested_amount': 'Requested amount (in LBC).',
'outputs': 'list of ["address", amount]', 'outputs': 'list of ["address", amount]',
'redeem_script': 'redeem script (hexadecimal)', 'redeem_script': 'redeem script (hexadecimal)',
} }
@ -786,7 +786,7 @@ command_options = {
'labels': ("-l", "Show the labels of listed addresses"), 'labels': ("-l", "Show the labels of listed addresses"),
'nocheck': (None, "Do not verify aliases"), 'nocheck': (None, "Do not verify aliases"),
'imax': (None, "Maximum number of inputs"), 'imax': (None, "Maximum number of inputs"),
'fee': ("-f", "Transaction fee (in BTC)"), 'fee': ("-f", "Transaction fee (in LBC)"),
'from_addr': ("-F", "Source address (must be a wallet address; use sweep to spend from non-wallet address)."), 'from_addr': ("-F", "Source address (must be a wallet address; use sweep to spend from non-wallet address)."),
'change_addr': ("-c", "Change address. Default is a spare address, or the source address if it's not in the wallet"), 'change_addr': ("-c", "Change address. Default is a spare address, or the source address if it's not in the wallet"),
'nbits': (None, "Number of bits of entropy"), 'nbits': (None, "Number of bits of entropy"),
@ -840,10 +840,10 @@ config_variables = {
'requests_dir': 'directory where a bip70 file will be written.', 'requests_dir': 'directory where a bip70 file will be written.',
'ssl_privkey': 'Path to your SSL private key, needed to sign the request.', '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', '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 bitcoin: URIs. Example: \"(\'file:///var/www/\',\'https://electrum.org/\')\"', 'url_rewrite': 'Parameters passed to str.replace(), in order to create the r= part of lbry credits: URIs. Example: \"(\'file:///var/www/\',\'https://electrum.org/\')\"',
}, },
'listrequests':{ 'listrequests':{
'url_rewrite': 'Parameters passed to str.replace(), in order to create the r= part of bitcoin: URIs. Example: \"(\'file:///var/www/\',\'https://electrum.org/\')\"', 'url_rewrite': 'Parameters passed to str.replace(), in order to create the r= part of lbry credits: URIs. Example: \"(\'file:///var/www/\',\'https://electrum.org/\')\"',
} }
} }
@ -920,12 +920,12 @@ def add_global_options(parser):
def get_parser(): def get_parser():
# create main parser # create main parser
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
epilog="Run 'electrum help <command>' to see the help for a command") epilog="Run 'electrum-lbry help <command>' to see the help for a command")
add_global_options(parser) add_global_options(parser)
subparsers = parser.add_subparsers(dest='cmd', metavar='<command>') subparsers = parser.add_subparsers(dest='cmd', metavar='<command>')
# gui # gui
parser_gui = subparsers.add_parser('gui', description="Run Electrum's Graphical User Interface.", help="Run GUI (default)") parser_gui = subparsers.add_parser('gui', description="Run Electrum's Graphical User Interface.", help="Run GUI (default)")
parser_gui.add_argument("url", nargs='?', default=None, help="bitcoin URI (or bip70 file)") parser_gui.add_argument("url", nargs='?', default=None, help="lbry credits URI (or bip70 file)")
parser_gui.add_argument("-g", "--gui", dest="gui", help="select graphical user interface", choices=['qt', 'kivy', 'text', 'stdio']) parser_gui.add_argument("-g", "--gui", dest="gui", help="select graphical user interface", choices=['qt', 'kivy', 'text', 'stdio'])
parser_gui.add_argument("-o", "--offline", action="store_true", dest="offline", default=False, help="Run offline") parser_gui.add_argument("-o", "--offline", action="store_true", dest="offline", default=False, help="Run offline")
parser_gui.add_argument("-m", action="store_true", dest="hide_gui", default=False, help="hide GUI on startup") parser_gui.add_argument("-m", action="store_true", dest="hide_gui", default=False, help="hide GUI on startup")

View file

@ -51,7 +51,7 @@ class BitcoinMainnet(AbstractNet):
WIF_PREFIX = 0x1c WIF_PREFIX = 0x1c
ADDRTYPE_P2PKH = 0x55 ADDRTYPE_P2PKH = 0x55
ADDRTYPE_P2SH = 0x7A ADDRTYPE_P2SH = 0x7A
SEGWIT_HRP = "bc" SEGWIT_HRP = "lbc"
GENESIS = "9c89283ba0f3227f6c03b70216b9f665f0118d5e0fa729cedf4fb34d6a34f463" GENESIS = "9c89283ba0f3227f6c03b70216b9f665f0118d5e0fa729cedf4fb34d6a34f463"
DEFAULT_PORTS = {'t': '50001', 's': '50002'} DEFAULT_PORTS = {'t': '50001', 's': '50002'}
DEFAULT_SERVERS = read_json('servers.json', {}) DEFAULT_SERVERS = read_json('servers.json', {})
@ -80,7 +80,7 @@ class BitcoinTestnet(AbstractNet):
WIF_PREFIX = 0xef WIF_PREFIX = 0xef
ADDRTYPE_P2PKH = 111 ADDRTYPE_P2PKH = 111
ADDRTYPE_P2SH = 196 ADDRTYPE_P2SH = 196
SEGWIT_HRP = "tb" SEGWIT_HRP = "tlbc"
GENESIS = "000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943" GENESIS = "000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943"
DEFAULT_PORTS = {'t': '51001', 's': '51002'} DEFAULT_PORTS = {'t': '51001', 's': '51002'}
DEFAULT_SERVERS = read_json('servers_testnet.json', {}) DEFAULT_SERVERS = read_json('servers_testnet.json', {})
@ -105,7 +105,7 @@ class BitcoinTestnet(AbstractNet):
class BitcoinRegtest(BitcoinTestnet): class BitcoinRegtest(BitcoinTestnet):
SEGWIT_HRP = "bcrt" SEGWIT_HRP = "blbc"
GENESIS = "0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206" GENESIS = "0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206"
DEFAULT_SERVERS = read_json('servers_regtest.json', {}) DEFAULT_SERVERS = read_json('servers_regtest.json', {})
CHECKPOINTS = [] CHECKPOINTS = []
@ -113,7 +113,7 @@ class BitcoinRegtest(BitcoinTestnet):
class BitcoinSimnet(BitcoinTestnet): class BitcoinSimnet(BitcoinTestnet):
SEGWIT_HRP = "sb" SEGWIT_HRP = "slbc"
GENESIS = "683e86bd5c6d110d91b94b97137ba6bfe02dbbdb8e3dff722a669b5d69d77af6" GENESIS = "683e86bd5c6d110d91b94b97137ba6bfe02dbbdb8e3dff722a669b5d69d77af6"
DEFAULT_SERVERS = read_json('servers_regtest.json', {}) DEFAULT_SERVERS = read_json('servers_regtest.json', {})
CHECKPOINTS = [] CHECKPOINTS = []

View file

@ -90,7 +90,7 @@ class Contacts(dict):
'type': 'openalias', 'type': 'openalias',
'validated': validated 'validated': validated
} }
raise Exception("Invalid Bitcoin address or alias", k) raise Exception("Invalid LBRY Credits address or alias", k)
def resolve_openalias(self, url): def resolve_openalias(self, url):
# support email-style addresses, per the OA standard # support email-style addresses, per the OA standard
@ -100,7 +100,7 @@ class Contacts(dict):
except DNSException as e: except DNSException as e:
print_error(f'Error resolving openalias: {repr(e)}') print_error(f'Error resolving openalias: {repr(e)}')
return None return None
prefix = 'btc' prefix = 'lbc'
for record in records: for record in records:
string = to_string(record.strings[0], 'utf8') string = to_string(record.strings[0], 'utf8')
if string.startswith('oa1:' + prefix): if string.startswith('oa1:' + prefix):
@ -130,4 +130,3 @@ class Contacts(dict):
if _type != 'address': if _type != 'address':
data.pop(k) data.pop(k)
return data return data

View file

@ -306,7 +306,7 @@ class ECPubkey(object):
def msg_magic(message: bytes) -> bytes: def msg_magic(message: bytes) -> bytes:
from .bitcoin import var_int from .bitcoin import var_int
length = bfh(var_int(len(message))) length = bfh(var_int(len(message)))
return b"\x18Bitcoin Signed Message:\n" + length + message return b"\x18LBRYcrd Signed Message:\n" + length + message
def verify_message_with_address(address: str, sig65: bytes, message: bytes): def verify_message_with_address(address: str, sig65: bytes, message: bytes):

View file

@ -131,7 +131,7 @@ class BitcoinAverage(ExchangeBase):
async def get_rates(self, ccy): async def get_rates(self, ccy):
json = await self.get_json('apiv2.bitcoinaverage.com', '/indices/global/ticker/short') json = await self.get_json('apiv2.bitcoinaverage.com', '/indices/global/ticker/short')
return dict([(r.replace("BTC", ""), Decimal(json[r]['last'])) return dict([(r.replace("LBC", ""), Decimal(json[r]['last']))
for r in json if r != 'timestamp']) for r in json if r != 'timestamp'])
def history_ccys(self): def history_ccys(self):
@ -160,8 +160,8 @@ class BitcoinVenezuela(ExchangeBase):
async def get_rates(self, ccy): async def get_rates(self, ccy):
json = await self.get_json('api.bitcoinvenezuela.com', '/') json = await self.get_json('api.bitcoinvenezuela.com', '/')
rates = [(r, json['BTC'][r]) for r in json['BTC'] rates = [(r, json['LBC'][r]) for r in json['LBC']
if json['BTC'][r] is not None] # Giving NULL for LTC if json['LBC'][r] is not None] # Giving NULL for LTC
return dict(rates) return dict(rates)
def history_ccys(self): def history_ccys(self):
@ -169,8 +169,8 @@ class BitcoinVenezuela(ExchangeBase):
async def request_history(self, ccy): async def request_history(self, ccy):
json = await self.get_json('api.bitcoinvenezuela.com', json = await self.get_json('api.bitcoinvenezuela.com',
"/historical/index.php?coin=BTC") "/historical/index.php?coin=LBC")
return json[ccy +'_BTC'] return json[ccy +'_LBC']
class Bitbank(ExchangeBase): class Bitbank(ExchangeBase):

View file

@ -151,7 +151,7 @@ class ElectrumWindow(App):
self.send_screen.set_URI(uri) self.send_screen.set_URI(uri)
def on_new_intent(self, intent): def on_new_intent(self, intent):
if intent.getScheme() != 'bitcoin': if intent.getScheme() != 'lbrycredits':
return return
uri = intent.getDataString() uri = intent.getDataString()
self.set_URI(uri) self.set_URI(uri)
@ -272,7 +272,7 @@ class ElectrumWindow(App):
App.__init__(self)#, **kwargs) App.__init__(self)#, **kwargs)
title = _('Electrum App') title = _('Electrum-LBRY App')
self.electrum_config = config = kwargs.get('config', None) self.electrum_config = config = kwargs.get('config', None)
self.language = config.get('language', 'en') self.language = config.get('language', 'en')
self.network = network = kwargs.get('network', None) # type: Network self.network = network = kwargs.get('network', None) # type: Network
@ -336,7 +336,7 @@ class ElectrumWindow(App):
if is_address(data): if is_address(data):
self.set_URI(data) self.set_URI(data)
return return
if data.startswith('bitcoin:'): if data.startswith('lbrycredits:'):
self.set_URI(data) self.set_URI(data)
return return
# try to decode transaction # try to decode transaction
@ -775,7 +775,7 @@ class ElectrumWindow(App):
from plyer import notification from plyer import notification
icon = (os.path.dirname(os.path.realpath(__file__)) icon = (os.path.dirname(os.path.realpath(__file__))
+ '/../../' + self.icon) + '/../../' + self.icon)
notification.notify('Electrum', message, notification.notify('Electrum-LBRY', message,
app_icon=icon, app_name='Electrum') app_icon=icon, app_name='Electrum')
except ImportError: except ImportError:
Logger.Error('Notification: needs plyer; `sudo pip install plyer`') Logger.Error('Notification: needs plyer; `sudo pip install plyer`')

View file

@ -3,5 +3,5 @@
<action android:name="android.nfc.action.NDEF_DISCOVERED"/> <action android:name="android.nfc.action.NDEF_DISCOVERED"/>
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" /> <category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="bitcoin" /> <data android:scheme="lbrycredits" />
</intent-filter> </intent-filter>

View file

@ -834,7 +834,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
self.receive_address_e = ButtonsLineEdit() self.receive_address_e = ButtonsLineEdit()
self.receive_address_e.addCopyButton(self.app) self.receive_address_e.addCopyButton(self.app)
self.receive_address_e.setReadOnly(True) self.receive_address_e.setReadOnly(True)
msg = _('Bitcoin address where the payment should be received. Note that each payment request uses a different Bitcoin address.') msg = _('LBRY Credits address where the payment should be received. Note that each payment request uses a different LBRY Credits address.')
self.receive_address_label = HelpLabel(_('Receiving address'), msg) self.receive_address_label = HelpLabel(_('Receiving address'), msg)
self.receive_address_e.textChanged.connect(self.update_receive_qr) self.receive_address_e.textChanged.connect(self.update_receive_qr)
self.receive_address_e.setFocusPolicy(Qt.ClickFocus) self.receive_address_e.setFocusPolicy(Qt.ClickFocus)
@ -864,8 +864,8 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
msg = ' '.join([ msg = ' '.join([
_('Expiration date of your request.'), _('Expiration date of your request.'),
_('This information is seen by the recipient if you send them a signed payment request.'), _('This information is seen by the recipient if you send them a signed payment request.'),
_('Expired requests have to be deleted manually from your list, in order to free the corresponding Bitcoin addresses.'), _('Expired requests have to be deleted manually from your list, in order to free the corresponding LBRY Credits addresses.'),
_('The bitcoin address never expires and will always be part of this electrum wallet.'), _('The LBRY Credits address never expires and will always be part of this electrum wallet.'),
]) ])
grid.addWidget(HelpLabel(_('Request expires'), msg), 3, 0) grid.addWidget(HelpLabel(_('Request expires'), msg), 3, 0)
grid.addWidget(self.expires_combo, 3, 1) grid.addWidget(self.expires_combo, 3, 1)
@ -1091,7 +1091,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
self.amount_e = BTCAmountEdit(self.get_decimal_point) self.amount_e = BTCAmountEdit(self.get_decimal_point)
self.payto_e = PayToEdit(self) self.payto_e = PayToEdit(self)
msg = _('Recipient of the funds.') + '\n\n'\ msg = _('Recipient of the funds.') + '\n\n'\
+ _('You may enter a Bitcoin address, a label from your list of contacts (a list of completions will be proposed), or an alias (email-like address that forwards to a Bitcoin address)') + _('You may enter a LBRY Credits address, a label from your list of contacts (a list of completions will be proposed), or an alias (email-like address that forwards to a Bitcoin address)')
payto_label = HelpLabel(_('Pay to'), msg) payto_label = HelpLabel(_('Pay to'), msg)
grid.addWidget(payto_label, 1, 0) grid.addWidget(payto_label, 1, 0)
grid.addWidget(self.payto_e, 1, 1, 1, -1) grid.addWidget(self.payto_e, 1, 1, 1, -1)
@ -1138,7 +1138,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
hbox.addStretch(1) hbox.addStretch(1)
grid.addLayout(hbox, 4, 4) grid.addLayout(hbox, 4, 4)
msg = _('Bitcoin transactions are in general not free. A transaction fee is paid by the sender of the funds.') + '\n\n'\ msg = _('LBRY Credits transactions are in general not free. A transaction fee is paid by the sender of the funds.') + '\n\n'\
+ _('The amount of fee can be decided freely by the sender. However, transactions with low fees take more time to be processed.') + '\n\n'\ + _('The amount of fee can be decided freely by the sender. However, transactions with low fees take more time to be processed.') + '\n\n'\
+ _('A suggested fee is automatically added to this field. You may override it. The suggested fee increases with the size of the transaction.') + _('A suggested fee is automatically added to this field. You may override it. The suggested fee increases with the size of the transaction.')
self.fee_e_label = HelpLabel(_('Fee'), msg) self.fee_e_label = HelpLabel(_('Fee'), msg)
@ -2739,7 +2739,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
fee_widgets.append((fee_type_label, fee_type_combo)) fee_widgets.append((fee_type_label, fee_type_combo))
feebox_cb = QCheckBox(_('Edit fees manually')) feebox_cb = QCheckBox(_('Edit fees manually'))
feebox_cb.setChecked(self.config.get('show_fee', False)) feebox_cb.setChecked(self.config.get('show_fee', True))
feebox_cb.setToolTip(_("Show fee edit box in send tab.")) feebox_cb.setToolTip(_("Show fee edit box in send tab."))
def on_feebox(x): def on_feebox(x):
self.config.set_key('show_fee', x == Qt.Checked) self.config.set_key('show_fee', x == Qt.Checked)

View file

@ -18,6 +18,7 @@ _sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor.FileDescriptor( DESCRIPTOR = _descriptor.FileDescriptor(
name='paymentrequest.proto', name='paymentrequest.proto',
package='payments', package='payments',
syntax='proto2',
serialized_pb=_b('\n\x14paymentrequest.proto\x12\x08payments\"+\n\x06Output\x12\x11\n\x06\x61mount\x18\x01 \x01(\x04:\x01\x30\x12\x0e\n\x06script\x18\x02 \x02(\x0c\"\xa3\x01\n\x0ePaymentDetails\x12\x15\n\x07network\x18\x01 \x01(\t:\x04main\x12!\n\x07outputs\x18\x02 \x03(\x0b\x32\x10.payments.Output\x12\x0c\n\x04time\x18\x03 \x02(\x04\x12\x0f\n\x07\x65xpires\x18\x04 \x01(\x04\x12\x0c\n\x04memo\x18\x05 \x01(\t\x12\x13\n\x0bpayment_url\x18\x06 \x01(\t\x12\x15\n\rmerchant_data\x18\x07 \x01(\x0c\"\x95\x01\n\x0ePaymentRequest\x12\"\n\x17payment_details_version\x18\x01 \x01(\r:\x01\x31\x12\x16\n\x08pki_type\x18\x02 \x01(\t:\x04none\x12\x10\n\x08pki_data\x18\x03 \x01(\x0c\x12\"\n\x1aserialized_payment_details\x18\x04 \x02(\x0c\x12\x11\n\tsignature\x18\x05 \x01(\x0c\"\'\n\x10X509Certificates\x12\x13\n\x0b\x63\x65rtificate\x18\x01 \x03(\x0c\"i\n\x07Payment\x12\x15\n\rmerchant_data\x18\x01 \x01(\x0c\x12\x14\n\x0ctransactions\x18\x02 \x03(\x0c\x12#\n\trefund_to\x18\x03 \x03(\x0b\x32\x10.payments.Output\x12\x0c\n\x04memo\x18\x04 \x01(\t\">\n\nPaymentACK\x12\"\n\x07payment\x18\x01 \x02(\x0b\x32\x11.payments.Payment\x12\x0c\n\x04memo\x18\x02 \x01(\tB(\n\x1eorg.bitcoin.protocols.paymentsB\x06Protos') serialized_pb=_b('\n\x14paymentrequest.proto\x12\x08payments\"+\n\x06Output\x12\x11\n\x06\x61mount\x18\x01 \x01(\x04:\x01\x30\x12\x0e\n\x06script\x18\x02 \x02(\x0c\"\xa3\x01\n\x0ePaymentDetails\x12\x15\n\x07network\x18\x01 \x01(\t:\x04main\x12!\n\x07outputs\x18\x02 \x03(\x0b\x32\x10.payments.Output\x12\x0c\n\x04time\x18\x03 \x02(\x04\x12\x0f\n\x07\x65xpires\x18\x04 \x01(\x04\x12\x0c\n\x04memo\x18\x05 \x01(\t\x12\x13\n\x0bpayment_url\x18\x06 \x01(\t\x12\x15\n\rmerchant_data\x18\x07 \x01(\x0c\"\x95\x01\n\x0ePaymentRequest\x12\"\n\x17payment_details_version\x18\x01 \x01(\r:\x01\x31\x12\x16\n\x08pki_type\x18\x02 \x01(\t:\x04none\x12\x10\n\x08pki_data\x18\x03 \x01(\x0c\x12\"\n\x1aserialized_payment_details\x18\x04 \x02(\x0c\x12\x11\n\tsignature\x18\x05 \x01(\x0c\"\'\n\x10X509Certificates\x12\x13\n\x0b\x63\x65rtificate\x18\x01 \x03(\x0c\"i\n\x07Payment\x12\x15\n\rmerchant_data\x18\x01 \x01(\x0c\x12\x14\n\x0ctransactions\x18\x02 \x03(\x0c\x12#\n\trefund_to\x18\x03 \x03(\x0b\x32\x10.payments.Output\x12\x0c\n\x04memo\x18\x04 \x01(\t\">\n\nPaymentACK\x12\"\n\x07payment\x18\x01 \x02(\x0b\x32\x11.payments.Payment\x12\x0c\n\x04memo\x18\x02 \x01(\tB(\n\x1eorg.bitcoin.protocols.paymentsB\x06Protos')
) )
_sym_db.RegisterFileDescriptor(DESCRIPTOR) _sym_db.RegisterFileDescriptor(DESCRIPTOR)
@ -54,6 +55,7 @@ _OUTPUT = _descriptor.Descriptor(
], ],
options=None, options=None,
is_extendable=False, is_extendable=False,
syntax='proto2',
extension_ranges=[], extension_ranges=[],
oneofs=[ oneofs=[
], ],
@ -126,6 +128,7 @@ _PAYMENTDETAILS = _descriptor.Descriptor(
], ],
options=None, options=None,
is_extendable=False, is_extendable=False,
syntax='proto2',
extension_ranges=[], extension_ranges=[],
oneofs=[ oneofs=[
], ],
@ -184,6 +187,7 @@ _PAYMENTREQUEST = _descriptor.Descriptor(
], ],
options=None, options=None,
is_extendable=False, is_extendable=False,
syntax='proto2',
extension_ranges=[], extension_ranges=[],
oneofs=[ oneofs=[
], ],
@ -214,6 +218,7 @@ _X509CERTIFICATES = _descriptor.Descriptor(
], ],
options=None, options=None,
is_extendable=False, is_extendable=False,
syntax='proto2',
extension_ranges=[], extension_ranges=[],
oneofs=[ oneofs=[
], ],
@ -265,6 +270,7 @@ _PAYMENT = _descriptor.Descriptor(
], ],
options=None, options=None,
is_extendable=False, is_extendable=False,
syntax='proto2',
extension_ranges=[], extension_ranges=[],
oneofs=[ oneofs=[
], ],
@ -302,6 +308,7 @@ _PAYMENTACK = _descriptor.Descriptor(
], ],
options=None, options=None,
is_extendable=False, is_extendable=False,
syntax='proto2',
extension_ranges=[], extension_ranges=[],
oneofs=[ oneofs=[
], ],

View file

@ -20,10 +20,9 @@ FEE_DEPTH_TARGETS = [10000000, 5000000, 2000000, 1000000, 500000, 200000, 100000
# satoshi per kbyte # satoshi per kbyte
FEERATE_MAX_DYNAMIC = 1500000 FEERATE_MAX_DYNAMIC = 1500000
FEERATE_WARNING_HIGH_FEE = 600000 FEERATE_WARNING_HIGH_FEE = 600000
FEERATE_FALLBACK_STATIC_FEE = 150000 FEERATE_FALLBACK_STATIC_FEE = 50000
FEERATE_DEFAULT_RELAY = 1000 FEERATE_DEFAULT_RELAY = 50000
FEERATE_STATIC_VALUES = [1000, 2000, 5000, 10000, 20000, 30000, FEERATE_STATIC_VALUES = [50000, 50000,]
50000, 70000, 100000, 150000, 200000, 300000]
config = None config = None
@ -202,7 +201,7 @@ class SimpleConfig(PrintError):
base_unit = self.user_config.get('base_unit') base_unit = self.user_config.get('base_unit')
if isinstance(base_unit, str): if isinstance(base_unit, str):
self._set_key_in_user_config('base_unit', None) self._set_key_in_user_config('base_unit', None)
map_ = {'btc':8, 'mbtc':5, 'ubtc':2, 'bits':2, 'sat':0} map_ = {'lbc':8, 'mlbc':5, 'ulbc':2, 'lbcs':2, 'dewey':0}
decimal_point = map_.get(base_unit.lower()) decimal_point = map_.get(base_unit.lower())
self._set_key_in_user_config('decimal_point', decimal_point) self._set_key_in_user_config('decimal_point', decimal_point)

View file

@ -56,9 +56,9 @@ def inv_dict(d):
return {v: k for k, v in d.items()} return {v: k for k, v in d.items()}
base_units = {'BTC':8, 'mBTC':5, 'bits':2, 'sat':0} base_units = {'LBC':8, 'mLBC':5, 'deweys':2, 'dewey':0}
base_units_inverse = inv_dict(base_units) base_units_inverse = inv_dict(base_units)
base_units_list = ['BTC', 'mBTC', 'bits', 'sat'] # list(dict) does not guarantee order base_units_list = ['LBC', 'mLBC', 'deweys', 'dewey'] # list(dict) does not guarantee order
DECIMAL_POINT_DEFAULT = 5 # mBTC DECIMAL_POINT_DEFAULT = 5 # mBTC
@ -620,41 +620,7 @@ def time_difference(distance_in_time, include_seconds):
return "over %d years" % (round(distance_in_minutes / 525600)) return "over %d years" % (round(distance_in_minutes / 525600))
mainnet_block_explorers = { mainnet_block_explorers = {
'Bitupper Explorer': ('https://bitupper.com/en/explorer/bitcoin/', 'LBRY Explorer': ('https://explorer.lbry.io/',
{'tx': 'transactions/', 'addr': 'addresses/'}),
'Biteasy.com': ('https://www.biteasy.com/blockchain/',
{'tx': 'transactions/', 'addr': 'addresses/'}),
'Bitflyer.jp': ('https://chainflyer.bitflyer.jp/',
{'tx': 'Transaction/', 'addr': 'Address/'}),
'Blockchain.info': ('https://blockchain.info/',
{'tx': 'tx/', 'addr': 'address/'}),
'blockchainbdgpzk.onion': ('https://blockchainbdgpzk.onion/',
{'tx': 'tx/', 'addr': 'address/'}),
'Blockr.io': ('https://btc.blockr.io/',
{'tx': 'tx/info/', 'addr': 'address/info/'}),
'Blockstream.info': ('https://blockstream.info/',
{'tx': 'tx/', 'addr': 'address/'}),
'Blocktrail.com': ('https://www.blocktrail.com/BTC/',
{'tx': 'tx/', 'addr': 'address/'}),
'BTC.com': ('https://chain.btc.com/',
{'tx': 'tx/', 'addr': 'address/'}),
'Chain.so': ('https://www.chain.so/',
{'tx': 'tx/BTC/', 'addr': 'address/BTC/'}),
'Insight.is': ('https://insight.bitpay.com/',
{'tx': 'tx/', 'addr': 'address/'}),
'TradeBlock.com': ('https://tradeblock.com/blockchain/',
{'tx': 'tx/', 'addr': 'address/'}),
'BlockCypher.com': ('https://live.blockcypher.com/btc/',
{'tx': 'tx/', 'addr': 'address/'}),
'Blockchair.com': ('https://blockchair.com/bitcoin/',
{'tx': 'transaction/', 'addr': 'address/'}),
'blockonomics.co': ('https://www.blockonomics.co/',
{'tx': 'api/tx?txid=', 'addr': '#/search?q='}),
'OXT.me': ('https://oxt.me/',
{'tx': 'transaction/', 'addr': 'address/'}),
'smartbit.com.au': ('https://www.smartbit.com.au/',
{'tx': 'tx/', 'addr': 'address/'}),
'system default': ('blockchain:/',
{'tx': 'tx/', 'addr': 'address/'}), {'tx': 'tx/', 'addr': 'address/'}),
} }