|
|
@ -43,8 +43,17 @@ from electrum.util import NotEnoughFunds |
|
|
|
from electrum.storage import STO_EV_USER_PW |
|
|
|
|
|
|
|
# signing_xpub is hardcoded so that the wallet can be restored from seed, without TrustedCoin's server |
|
|
|
signing_xpub = "xpub661MyMwAqRbcGnMkaTx2594P9EDuiEqMq25PM2aeG6UmwzaohgA6uDmNsvSUV8ubqwA3Wpste1hg69XHgjUuCD5HLcEp2QPzyV1HMrPppsL" |
|
|
|
billing_xpub = "xpub6DTBdtBB8qUmH5c77v8qVGVoYk7WjJNpGvutqjLasNG1mbux6KsojaLrYf2sRhXAVU4NaFuHhbD9SvVPRt1MB1MaMooRuhHcAZH1yhQ1qDU" |
|
|
|
def get_signing_xpub(): |
|
|
|
if NetworkConstants.TESTNET: |
|
|
|
return "tpubD6NzVbkrYhZ4XdmyJQcCPjQfg6RXVUzGFhPjZ7uvRC8JLcS7Hw1i7UTpyhp9grHpak4TyK2hzBJrujDVLXQ6qB5tNpVx9rC6ixijUXadnmY" |
|
|
|
else: |
|
|
|
return "xpub661MyMwAqRbcGnMkaTx2594P9EDuiEqMq25PM2aeG6UmwzaohgA6uDmNsvSUV8ubqwA3Wpste1hg69XHgjUuCD5HLcEp2QPzyV1HMrPppsL" |
|
|
|
|
|
|
|
def get_billing_xpub(): |
|
|
|
if NetworkConstants.TESTNET: |
|
|
|
return "tpubD6NzVbkrYhZ4X11EJFTJujsYbUmVASAYY7gXsEt4sL97AMBdypiH1E9ZVTpdXXEy3Kj9Eqd1UkxdGtvDt5z23DKsh6211CfNJo8bLLyem5r" |
|
|
|
else: |
|
|
|
return "xpub6DTBdtBB8qUmH5c77v8qVGVoYk7WjJNpGvutqjLasNG1mbux6KsojaLrYf2sRhXAVU4NaFuHhbD9SvVPRt1MB1MaMooRuhHcAZH1yhQ1qDU" |
|
|
|
|
|
|
|
SEED_PREFIX = version.SEED_PREFIX_2FA |
|
|
|
|
|
|
@ -307,7 +316,7 @@ def make_xpub(xpub, s): |
|
|
|
|
|
|
|
def make_billing_address(wallet, num): |
|
|
|
long_id, short_id = wallet.get_user_id() |
|
|
|
xpub = make_xpub(billing_xpub, long_id) |
|
|
|
xpub = make_xpub(get_billing_xpub(), long_id) |
|
|
|
version, _, _, _, c, cK = deserialize_xpub(xpub) |
|
|
|
cK, c = bitcoin.CKD_pub(cK, c, num) |
|
|
|
return bitcoin.public_key_to_p2pkh(cK) |
|
|
@ -484,7 +493,7 @@ class TrustedCoinPlugin(BasePlugin): |
|
|
|
storage.put('x1/', k1.dump()) |
|
|
|
storage.put('x2/', k2.dump()) |
|
|
|
long_user_id, short_id = get_user_id(storage) |
|
|
|
xpub3 = make_xpub(signing_xpub, long_user_id) |
|
|
|
xpub3 = make_xpub(get_signing_xpub(), long_user_id) |
|
|
|
k3 = keystore.from_xpub(xpub3) |
|
|
|
storage.put('x3/', k3.dump()) |
|
|
|
|
|
|
@ -501,7 +510,7 @@ class TrustedCoinPlugin(BasePlugin): |
|
|
|
xpub2 = wizard.storage.get('x2/')['xpub'] |
|
|
|
# Generate third key deterministically. |
|
|
|
long_user_id, short_id = get_user_id(wizard.storage) |
|
|
|
xpub3 = make_xpub(signing_xpub, long_user_id) |
|
|
|
xpub3 = make_xpub(get_signing_xpub(), long_user_id) |
|
|
|
# secret must be sent by the server |
|
|
|
try: |
|
|
|
r = server.create(xpub1, xpub2, email) |
|
|
|