mirror of
https://git.wownero.com/lza_menace/wownero-python.git
synced 2024-08-15 03:25:25 +00:00
Add offline subaddress generation
This commit is contained in:
parent
6c1f667840
commit
d0a2d35176
11 changed files with 409 additions and 32 deletions
|
@ -1,4 +1,3 @@
|
|||
import warnings
|
||||
from . import prio
|
||||
from .transaction import PaymentManager
|
||||
|
||||
|
@ -16,6 +15,7 @@ class Account(object):
|
|||
:param index: the account's index within the wallet
|
||||
"""
|
||||
index = None
|
||||
wallet = None
|
||||
|
||||
def __init__(self, backend, index):
|
||||
self.index = index
|
||||
|
|
72
monero/backends/offline.py
Normal file
72
monero/backends/offline.py
Normal file
|
@ -0,0 +1,72 @@
|
|||
from .. import exceptions
|
||||
from ..account import Account
|
||||
from ..address import Address
|
||||
from ..seed import Seed
|
||||
|
||||
|
||||
class WalletIsOffline(exceptions.BackendException):
|
||||
pass
|
||||
|
||||
|
||||
class OfflineWallet(object):
|
||||
"""
|
||||
Offline backend for Monero wallet. Provides support for address generation.
|
||||
"""
|
||||
_address = None
|
||||
_svk = None
|
||||
_ssk = None
|
||||
|
||||
def __init__(self, address, view_key=None, spend_key=None):
|
||||
self._address = Address(address)
|
||||
self._svk = view_key or self._svk
|
||||
self._ssk = spend_key or self._ssk
|
||||
|
||||
def height(self):
|
||||
raise WalletIsOffline()
|
||||
|
||||
def spend_key(self):
|
||||
return self._ssk
|
||||
|
||||
def view_key(self):
|
||||
return self._svk
|
||||
|
||||
def seed(self):
|
||||
return Seed(self._ssk)
|
||||
|
||||
def accounts(self):
|
||||
return [Account(self, 0)]
|
||||
|
||||
def new_account(self, label=None):
|
||||
raise WalletIsOffline()
|
||||
|
||||
def addresses(self, account=0):
|
||||
if account == 0:
|
||||
return [self._address]
|
||||
raise WalletIsOffline()
|
||||
|
||||
def new_address(self, account=0, label=None):
|
||||
raise WalletIsOffline()
|
||||
|
||||
def balances(self, account=0):
|
||||
raise WalletIsOffline()
|
||||
|
||||
def transfers_in(self, account, pmtfilter):
|
||||
raise WalletIsOffline()
|
||||
|
||||
def transfers_out(self, account, pmtfilter):
|
||||
raise WalletIsOffline()
|
||||
|
||||
def export_outputs(self):
|
||||
raise WalletIsOffline()
|
||||
|
||||
def import_outputs(self, outputs_hex):
|
||||
raise WalletIsOffline()
|
||||
|
||||
def export_key_images(self):
|
||||
raise WalletIsOffline()
|
||||
|
||||
def import_key_images(self, key_images):
|
||||
raise WalletIsOffline()
|
||||
|
||||
def transfer(self, *args, **kwargs):
|
||||
raise WalletIsOffline()
|
|
@ -49,6 +49,13 @@ def xrecover(y):
|
|||
if x % 2 != 0: x = q-x
|
||||
return x
|
||||
|
||||
def compress(P):
|
||||
zinv = inv(P[2])
|
||||
return (P[0] * zinv % q, P[1] * zinv % q)
|
||||
|
||||
def decompress(P):
|
||||
return (P[0], P[1], 1, P[0]*P[1] % q)
|
||||
|
||||
By = 4 * inv(5)
|
||||
Bx = xrecover(By)
|
||||
B = [Bx%q, By%q]
|
||||
|
@ -62,6 +69,20 @@ def edwards(P, Q):
|
|||
y3 = (y1*y2+x1*x2) * inv(1-d*x1*x2*y1*y2)
|
||||
return [x3%q, y3%q]
|
||||
|
||||
def add(P, Q):
|
||||
A = (P[1]-P[0])*(Q[1]-Q[0]) % q
|
||||
B = (P[1]+P[0])*(Q[1]+Q[0]) % q
|
||||
C = 2 * P[3] * Q[3] * d % q
|
||||
D = 2 * P[2] * Q[2] % q
|
||||
E = B-A
|
||||
F = D-C
|
||||
G = D+C
|
||||
H = B+A
|
||||
return (E*F, G*H, F*G, E*H)
|
||||
|
||||
def add_compressed(P, Q):
|
||||
return compress(add(decompress(P), decompress(Q)))
|
||||
|
||||
def scalarmult(P, e):
|
||||
if e == 0: return [0, 1]
|
||||
Q = scalarmult(P, e//2)
|
||||
|
@ -92,14 +113,6 @@ def Hint(m):
|
|||
h = H(m)
|
||||
return sum(2**i * bit(h, i) for i in range(2*b))
|
||||
|
||||
def signature(m, sk, pk):
|
||||
h = H(sk)
|
||||
a = 2**(b-2) + sum(2**i * bit(h, i) for i in range(3, b-2))
|
||||
r = Hint(intlist2bytes([indexbytes(h, j) for j in range(b//8, b//4)]) + m)
|
||||
R = scalarmult(B, r)
|
||||
S = (r + Hint(encodepoint(R)+pk+m) * a) % l
|
||||
return encodepoint(R) + encodeint(S)
|
||||
|
||||
def isoncurve(P):
|
||||
x = P[0]
|
||||
y = P[1]
|
||||
|
@ -116,28 +129,29 @@ def decodepoint(s):
|
|||
if not isoncurve(P): raise Exception("decoding point that is not on curve")
|
||||
return P
|
||||
|
||||
def checkvalid(s, m, pk):
|
||||
if len(s) != b//4: raise Exception("signature length is wrong")
|
||||
if len(pk) != b//8: raise Exception("public-key length is wrong")
|
||||
R = decodepoint(s[0:b//8])
|
||||
A = decodepoint(pk)
|
||||
S = decodeint(s[b//8:b//4])
|
||||
h = Hint(encodepoint(R) + pk + m)
|
||||
if scalarmult(B, S) != edwards(R, scalarmult(A, h)):
|
||||
raise Exception("signature does not pass verification")
|
||||
|
||||
# This is from https://github.com/monero-project/mininero by Shen Noether with The Monero Project
|
||||
def scalarmultbase(e):
|
||||
if e == 0: return [0, 1]
|
||||
Q = scalarmult(B, e//2)
|
||||
Q = edwards(Q, Q)
|
||||
if e & 1: Q = edwards(Q, B)
|
||||
return Q
|
||||
# These are unused but let's keep them
|
||||
#def signature(m, sk, pk):
|
||||
# h = H(sk)
|
||||
# a = 2**(b-2) + sum(2**i * bit(h, i) for i in range(3, b-2))
|
||||
# r = Hint(intlist2bytes([indexbytes(h, j) for j in range(b//8, b//4)]) + m)
|
||||
# R = scalarmult(B, r)
|
||||
# S = (r + Hint(encodepoint(R)+pk+m) * a) % l
|
||||
# return encodepoint(R) + encodeint(S)
|
||||
#
|
||||
#def checkvalid(s, m, pk):
|
||||
# if len(s) != b//4: raise Exception("signature length is wrong")
|
||||
# if len(pk) != b//8: raise Exception("public-key length is wrong")
|
||||
# R = decodepoint(s[0:b//8])
|
||||
# A = decodepoint(pk)
|
||||
# S = decodeint(s[b//8:b//4])
|
||||
# h = Hint(encodepoint(R) + pk + m)
|
||||
# if scalarmult(B, S) != edwards(R, scalarmult(A, h)):
|
||||
# raise Exception("signature does not pass verification")
|
||||
|
||||
def public_from_secret(k):
|
||||
keyInt = decodeint(k)
|
||||
aG = scalarmultbase(keyInt)
|
||||
return encodepoint(aG)
|
||||
aB = scalarmult(B, keyInt)
|
||||
return encodepoint(aB)
|
||||
|
||||
def public_from_secret_hex(hk):
|
||||
return hexlify(public_from_secret(unhexlify(hk))).decode()
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
from binascii import hexlify, unhexlify
|
||||
from sha3 import keccak_256
|
||||
import struct
|
||||
|
||||
from . import address
|
||||
from . import base58
|
||||
from . import ed25519
|
||||
from . import prio
|
||||
from .transaction import Payment, PaymentManager
|
||||
|
||||
|
@ -36,6 +43,7 @@ class Wallet(object):
|
|||
self.accounts = self.accounts or []
|
||||
idx = 0
|
||||
for _acc in self._backend.accounts():
|
||||
_acc.wallet = self
|
||||
try:
|
||||
if self.accounts[idx]:
|
||||
continue
|
||||
|
@ -184,6 +192,38 @@ class Wallet(object):
|
|||
"""
|
||||
return self.accounts[0].new_address(label=label)
|
||||
|
||||
def get_address(self, major, minor):
|
||||
"""
|
||||
Calculates sub-address for account index (`major`) and address index within
|
||||
the account (`minor`).
|
||||
|
||||
:rtype: :class:`BaseAddress <monero.address.BaseAddress>`
|
||||
"""
|
||||
master_address = self.address()
|
||||
if major == minor == 0:
|
||||
return master_address
|
||||
master_svk = unhexlify(self.view_key())
|
||||
master_psk = unhexlify(self.address().spend_key())
|
||||
# m = Hs("SubAddr\0" || master_svk || major || minor)
|
||||
hsdata = b''.join([
|
||||
b'SubAddr\0', master_svk,
|
||||
struct.pack('<I', major), struct.pack('<I', minor)])
|
||||
m = keccak_256(hsdata).digest()
|
||||
# TODO: OK, the hash is calculated correctly. What's missing here is ed25519 math
|
||||
# to do the following:
|
||||
# D = master_psk + m * B
|
||||
D = ed25519.add_compressed(
|
||||
ed25519.decodepoint(master_psk),
|
||||
ed25519.scalarmult(ed25519.B, ed25519.decodeint(m)))
|
||||
# C = master_svk * D
|
||||
C = ed25519.scalarmult(D, ed25519.decodeint(master_svk))
|
||||
netbyte = bytearray([
|
||||
42 if master_address.is_mainnet() else \
|
||||
63 if master_address.is_testnet() else 36])
|
||||
data = netbyte + ed25519.encodepoint(D) + ed25519.encodepoint(C)
|
||||
checksum = keccak_256(data).digest()[:4]
|
||||
return address.SubAddress(base58.encode(hexlify(data + checksum)))
|
||||
|
||||
def transfer(self, address, amount,
|
||||
priority=prio.NORMAL, payment_id=None, unlock_time=0,
|
||||
relay=True):
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
from . import test_ed25519
|
||||
from . import test_address
|
||||
from . import test_numbers
|
||||
from . import test_seed
|
||||
from . import test_transaction
|
||||
from . import test_wallet
|
||||
from . import test_offline
|
||||
from . import test_jsonrpcwallet
|
||||
from . import test_seed
|
||||
|
|
62
tests/data/mainnet-subaddrs.json
Normal file
62
tests/data/mainnet-subaddrs.json
Normal file
|
@ -0,0 +1,62 @@
|
|||
[
|
||||
[
|
||||
"47ewoP19TN7JEEnFKUJHAYhGxkeTRH82sf36giEp9AcNfDBfkAtRLX7A6rZz18bbNHPNV7ex6WYbMN3aKisFRJZ8Ebsmgef",
|
||||
"84LooD7i35SFppgf4tQ453Vi3q5WexSUXaVgut69ro8MFnmHwuezAArEZTZyLr9fS6QotjqkSAxSF6d1aDgsPoX849izJ7m",
|
||||
"89U1fxtSjwuF1UQmC1bYspT8dMgQLc9433VUrjcaLQ9w4dK6Jb1Wc3YdwejuCmdY451Z3eRiXg3zcSE2aQLGhsYECo2bsiQ",
|
||||
"88pqQ8Vwjwpiw3HA8Xvr575gakn4KH3MvCmt2HgAn2ywc8YxhpKFjbJQsX7eR7hMBSUKRJ6VGzZBsQMoHKcVf6fDVSvKb5y",
|
||||
"89h4ii3UQoKEF2ytqEaG1cSPinEiwc5iRiRL6JomXGijiag4bo93jjuFmyfBj9kiE1ZU2dE8Y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"85oDKs2QpUWHZ99hR4rFThSBujnMDAREvEUb2ooLgZGd6sY1vkMUGETSK7gYWBmwWEM61XxpXuj8cSnh4dCsGVVTB4LUY4q",
|
||||
"86q2xdB6MUP8YeFPuS4aqVNkKMxwmKczrSN2mg3FN7JNVbMYjcw3FyNSbL5GCqrBdPHWpk9efKyw9LkNuXfRm3rY915j85s",
|
||||
"83jHFZ9RBJk33dMinJ7HJFCbVF49v5cdZev873iQvABTSme6pEBF3AR2MmrkjcUuv6NZi1UV79UYf1QFhy21iF9EUua9nVW",
|
||||
"8BWsU8ezPMf6adzVvxFurLekoARoFJLieAm6aycTwuAo6AGu1sMfdtW1diHhYgogq9Soon7YwAnPT2pk9cEsZgq19qmHS8M",
|
||||
"87EVWV1MCF3C3j9tYBP7YTcU8ML8nXHSWXkDWBuXPXjkVXpGMEUqdYfGshSdHUUgYca2upy6zTo6v9oX8Qt4Kje5CpACB65"
|
||||
],
|
||||
[
|
||||
"82vEjyhAtn58qSkoMKcdG4XFMxHbRwatbBvLcHEL774f2RoDR9yduUhPCPR864RGrgXM2awr6SjeJChCW3jv3BtEMrQpkbp",
|
||||
"85mB3RjnZEoUC1mi4TxvRi8HEb3FqJf974sEzmsGPrQVMF8GDiEqY3PMgQuqjZsDY9MzCpQPQT5SmGkWYyWpzrRG9yP57ip",
|
||||
"865XMywqZgufky63ZWPU5DALsUd33nsn2NhsznUoBsNDUgxz9upvUQsUkwmJ2RZVZef31VdV82qKRe7BkfNsmWvRVogrAN9",
|
||||
"87tJKsNVuACb6tbz2mz6VdPBAKZzCDrrCC2ywdqh1FCRCHpjMNRAP4c2uLWX6nboyjVP6sTU1YR5UYCBkqLgpVWQSBeumvd",
|
||||
"8Br4ZBkj6AVEWnvyqMuoE5AJMYtNncqy5PcKew88mTGPJSCVZyoHvSvDK9cTSQ5cZ1Un9tjScY718bHqEUauPhQC7fA4Abv",
|
||||
"8677kud5PZ3fTMwQryC1Tw7HMLKLYpPkQE9zLbyuZTGB3vumdfD6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5F8X7bgU",
|
||||
"83HnemUBptw1MAzUpCuU1PaMDzpj17K4sFdcCPDMmvXAKcC4BdHwHib3xmARdCeMr1ZVVZUgWTzusjBsKoEoSKnoFrrfEgf",
|
||||
"85xU6QncBsjiBeiUVs7df5dRBH6dLwN7m1oLC1ZnQAuQ2vKbTmczL4wegnaFZLKtWhCtDbWQYgStwj2raHUcfDtaDZEfKx9",
|
||||
"87DRqkCNPW11XWeyozsToXae5nSKxPDEY3my3gFQ1Yb7RXqsEWZ5BbWaDgcfMCnjd5RQUDoDqe8MkMeHNvsCMGdtKyLsfJL",
|
||||
"8BBboWcfWXNh2fNTNiMUZeaYABYQe9DNm9MPHKywogFnHk3VxTk2yNAHYisjeZ5LoFZerCpGwuburgknDjUXa2P13DRaegi"
|
||||
],
|
||||
[
|
||||
"87Schz4up6jEpfbHjia2q7VzruvGdhLnJPkyLDrWJnuzBg7KuPPBQk32utS6xA8crgW8PPVqoLT3tLyRPfemT4j4GosT7w2",
|
||||
"8BWmh7TkZeNewjSHauaWLFYyNuaSzFTNRNrcwUoFixMB2j1B8MdtcnpRf5sRtv6AgXhrkJvW75TdA1gHTC1iZq9vLXirMNS",
|
||||
"89mcRTWF1XCeu7dWaQr5C1S3fZ6pyWki2jRVhaybgwf34d8rgkUsaDvj6DwLeziLar787tsMBxfQgUFfhsSLek1PNCkE8JA",
|
||||
"89bfr4NXY4D8jczTGpVxn5YhUbDohyJ6E3RQ3vzie4NMAwdU7EmCj9n82bn7k8z7krZsih2yhtUHhiwRBm9QofSU166F453",
|
||||
"87bGcZzkTwLUJRTjuG7yhdUe195Er5aqY3yaUWZwrgRMUn6MTDG3euP9TwuM1TqqRMPAquhF7abayidBrr64mTJj5LELx9T",
|
||||
"84kGzr5mv65UrNzqYnwjkxiiGEciCYeiE3fMZMfRLZt1LN9hc5idZT3cXyF6VKhcseYND4hA7Db3mabxvoUTPGHh4FGDUX7",
|
||||
"89XMhHqZDsCBES3uSznQT1gbqi6GnfFLfAaeftGoqtDd5ei6ovBQk128ic1NWFkXGLCPK6BHRxBJ64tpa8uasR1h2XX1Viw",
|
||||
"85ENJqzHuycgLL64xqxvDhbRhekk9pXCt86AEVBqUFo4Rqxfe7ffyHYZrhryXpgZtV7ceFDY8N53bh7beRecb2NxKvtM7CP",
|
||||
"84qSwP2XSTK7ijaDwtFUd6eF3NqQfW8ET31oL13GGv4XRpA35aFqYUUcXspsSJYeNXQxGJGCzEcLsCRoYM9ok2ta9MBhgUv",
|
||||
"84nTtTGVwaCcCVe7uUSkshC9Mbbt4EEXkYnJ1uQJrH4xE7YHLAeyJUTiFRJ19dAQwU8qehtrUEWc5AkcTAbqUuowMEhBLmP"
|
||||
]
|
||||
]
|
62
tests/data/stagenet-subaddrs.json
Normal file
62
tests/data/stagenet-subaddrs.json
Normal file
|
@ -0,0 +1,62 @@
|
|||
[
|
||||
[
|
||||
"52jzuBBUMty3xPL3JsQxGP74LDuV6E1LS8Zda1PbdqQjGzFmH6N9ep9McbFKMALujVT9S5mKpbEgC5VPhfoAiVj8LdAqbp6",
|
||||
"7AeQwvrLtPeYoXVPRkEu8oEL7N9wnqHjYKwSvTf6YKbHgYmw6AJMsjggzVLo21egMK9qcoV1mxCTfP4FbaGb7JEMDfpLetk",
|
||||
"73YMtNiQmazP56aYSAR2SjT6uCfCNEBFnfYc4PHUUJaqC8urLbipC1Z3NUUqoraQV4PJmLRHV81cnadnoUAcLiqD8jQB4mL",
|
||||
"7Ab6cPPwU97LD8HwX1X8QSJGLtkLq4vYHG5RFYiLXAvvX74yHoMxPGYXPchEmeQaVGjT72mXBYouNA8HLSvnxdP9LD931f3",
|
||||
"73g1pYwHUuPYLW7AbvpGAJGhyJBUEZyiGhMbh3WPMHp8gLAhk8vN4Z7dKEorEiredWZSfC6zbKy8qMSzA51pHL6M8TT2ECH",
|
||||
"77P8NdNM9gZVYEy8ieogWY8oDr5tpkBb3AvHSy4pPPktJMGjBeQsKzjb4K2k4g8hkM6vZrgSuH6UC1Diq27upfCSJBUk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A3pDSSEEu8nLiDDzdXZfmR2MDUP5Wu544WjRS2nce2nrZhPZ3saEmHKtWXxxp9tfbPhJ",
|
||||
"759k7wLcsG8WGxc8QucsumgRTD8dApgUnh2WMyYYzg5UGGojtGUq4W6ZMZer7hn5vx6Nj8toj9eSUfJ8mXfWXYcSBr3szU1",
|
||||
"76gfDy2DkWZdkCQUbaxkqWDKvo1GE7AY6CLgv9D98ddkHiU2rszQWDi5jamMwhfPx4b16KSxogQJRZNeTaU2cR2i7PMKsiW"
|
||||
]
|
||||
]
|
62
tests/data/testnet-subaddrs.json
Normal file
62
tests/data/testnet-subaddrs.json
Normal file
|
@ -0,0 +1,62 @@
|
|||
[
|
||||
[
|
||||
"9wuKTHsxGiwEsMp2fYzJiVahyhU2aZi1oZ6R6fK5U64uRa1Pxi8diZh2S1GJFqYXRRhcbfzfWiPD819zKEZkXTMwP7hMs5N",
|
||||
"BaU3yLuDqdcETYzeF7vFSVEKNR4sSGxBV1Evrw5yNBf2VMiuAwfDmiF3RHqLHkaA5A6RGiNNRUqvtaqhMtdjA1SQ1tnQV8D",
|
||||
"BZSWhWTMA8TEJRZL4MopGLBrN2P9jAjnfTwbN2mRhFHmfUkZwpzJ4anKb1Wd2BjrUDSzzsbSt2bxAeXRvXvNsPT58TEDMh7",
|
||||
"BYe3G2jNpAdb2m5eD1y76Q7pd4WibxqvbfBhyo5sNgNUBPfac2Mu5M3FhdKmHVsMECQFR9bbWpf3TRXwEqeqK25JEnKskbc",
|
||||
"Bfs6mpyksF93RX1eDPhY3TWWKQKUvJUcygjhv8pVyNtifcTJMQw54gVGZYkk7P4nAyYeHb2Fjus7B1opGkeqdJ3t5SXkCAL",
|
||||
"Be1Vp5Y1TGs6eKF4UiqenUfQKkAMuytWzTd5oGQBVxKrRYJr99r1jZ6TeXgBXqpZ3AEuYDnLD639JYSdUK5GfkHxFA31x9m",
|
||||
"BejKhUoDTZiVfs1jqNtUSDAmGPi9xSXhVVHNStkzj4cv5GWsG8DcXUZNccY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VfnFnpTpekoskkxkCAxfLw9dbcNawLFJxD6jr",
|
||||
"Bbi4mDqnUyBTKCMLWs3V8hKjbhGKGNxHzUCmAm89xDC5DwLJNE3SZ6BcatJ4cdBFNYApw7nuoU2hZi9UXngM2GXTLJpMVWd",
|
||||
"BfRbRVP2aZDMM9Bm9375djX1VxfTNZKDRDtoSJt4XcdYDWxLnEXxer32DDvQHCidCBYPu7qVUdTUjQ4Nc6kqJcQ4NMV6D9a"
|
||||
]
|
||||
]
|
|
@ -1,3 +1,5 @@
|
|||
import json
|
||||
import os
|
||||
import unittest
|
||||
|
||||
from monero.address import Address, SubAddress, IntegratedAddress, address
|
||||
|
@ -147,7 +149,7 @@ class Tests(object):
|
|||
self.assertRaises(TypeError, sa.with_payment_id, self.pid)
|
||||
|
||||
|
||||
class AddressTestCase(unittest.TestCase, Tests):
|
||||
class AddressTestCase(Tests, unittest.TestCase):
|
||||
addr = '47ewoP19TN7JEEnFKUJHAYhGxkeTRH82sf36giEp9AcNfDBfkAtRLX7A6rZz18bbNHPNV7ex6WYbMN3aKisFRJZ8Ebsmgef'
|
||||
ssk = 'e0fe01d5794e240a26609250c0d7e01673219eececa3f499d5cfa20a75739b0a'
|
||||
svk = '6d9056aa2c096bfcd2f272759555e5764ba204dd362604a983fa3e0aafd35901'
|
||||
|
@ -163,7 +165,7 @@ class AddressTestCase(unittest.TestCase, Tests):
|
|||
iaddr_invalid = '4HMcpBpe4ddJEEnFKUJHAYhGxkyTRH82sf36giEp9AcNfDBfkAtRLX7A6rZz18bbNHPNV7ex6WYbMN3aKisFRJZ8M7yKhzQhKW3ECCLWQw'
|
||||
|
||||
|
||||
class TestnetAddressTestCase(AddressTestCase, Tests):
|
||||
class TestnetAddressTestCase(Tests, unittest.TestCase):
|
||||
addr = '9wuKTHsxGiwEsMp2fYzJiVahyhU2aZi1oZ6R6fK5U64uRa1Pxi8diZh2S1GJFqYXRRhcbfzfWiPD819zKEZkXTMwP7hMs5N'
|
||||
ssk = '4f5b7af2c1942067ba33d34318b9735cb46ab5d50b75294844c82a9dd872c201'
|
||||
svk = '60cf228f2bf7f6a70643afe9468fde254145dbd3aab4072ede14bf8bae914103'
|
||||
|
@ -179,7 +181,7 @@ class TestnetAddressTestCase(AddressTestCase, Tests):
|
|||
iaddr_invalid = 'A7bzU6hSszTEsMp2fYzJiVahyhU2aZi2oZ6R6fK5U64uRa1Pxi8diZh2S1GJFqYXRRhcbfzfWiPD819zKEZkXTMwZqGSmLeBXqMEBnZVkh'
|
||||
|
||||
|
||||
class StagenetAddressTestCase(AddressTestCase, Tests):
|
||||
class StagenetAddressTestCase(Tests, unittest.TestCase):
|
||||
addr = '52jzuBBUMty3xPL3JsQxGP74LDuV6E1LS8Zda1PbdqQjGzFmH6N9ep9McbFKMALujVT9S5mKpbEgC5VPhfoAiVj8LdAqbp6'
|
||||
ssk = 'a8733c61797115db4ec8a5ce39fb811f81dd4ec163b880526683e059c7e62503'
|
||||
svk = 'fd5c0d25f8f994268079a4f7844274dc870a7c2b88fbfc24ba318375e1d9430f'
|
||||
|
|
8
tests/test_ed25519.py
Normal file
8
tests/test_ed25519.py
Normal file
|
@ -0,0 +1,8 @@
|
|||
import unittest
|
||||
from monero import ed25519
|
||||
|
||||
class Ed25519TestCase(unittest.TestCase):
|
||||
def test_comp_decomp(self):
|
||||
pts = [(0,0), (1,1), (3,5), (5,3), (7,11), (11,7)]
|
||||
for p in pts:
|
||||
self.assertEqual(p, ed25519.compress(ed25519.decompress(p)))
|
53
tests/test_offline.py
Normal file
53
tests/test_offline.py
Normal file
|
@ -0,0 +1,53 @@
|
|||
import json
|
||||
import os
|
||||
import unittest
|
||||
|
||||
from monero.backends.offline import OfflineWallet
|
||||
from monero.wallet import Wallet
|
||||
from tests.utils import classproperty
|
||||
|
||||
|
||||
class Tests(object):
|
||||
@classproperty
|
||||
def __test__(cls):
|
||||
return issubclass(cls, unittest.TestCase)
|
||||
|
||||
def setUp(self):
|
||||
self.subaddresses = json.load(open(os.path.join(
|
||||
os.path.dirname(__file__),
|
||||
'data',
|
||||
'{}-subaddrs.json'.format(self.net))))
|
||||
self.wallet = Wallet(OfflineWallet(self.addr, view_key=self.svk))
|
||||
|
||||
def test_subaddresses(self):
|
||||
major = 0
|
||||
for acc in self.subaddresses:
|
||||
minor = 0
|
||||
for subaddr in acc:
|
||||
self.assertEqual(
|
||||
self.wallet.get_address(major, minor),
|
||||
subaddr,
|
||||
msg='major={}, minor={}'.format(major,minor))
|
||||
minor += 1
|
||||
major += 1
|
||||
|
||||
|
||||
class AddressTestCase(Tests, unittest.TestCase):
|
||||
addr = '47ewoP19TN7JEEnFKUJHAYhGxkeTRH82sf36giEp9AcNfDBfkAtRLX7A6rZz18bbNHPNV7ex6WYbMN3aKisFRJZ8Ebsmgef'
|
||||
ssk = 'e0fe01d5794e240a26609250c0d7e01673219eececa3f499d5cfa20a75739b0a'
|
||||
svk = '6d9056aa2c096bfcd2f272759555e5764ba204dd362604a983fa3e0aafd35901'
|
||||
net = 'mainnet'
|
||||
|
||||
|
||||
class TestnetAddressTestCase(Tests, unittest.TestCase):
|
||||
addr = '9wuKTHsxGiwEsMp2fYzJiVahyhU2aZi1oZ6R6fK5U64uRa1Pxi8diZh2S1GJFqYXRRhcbfzfWiPD819zKEZkXTMwP7hMs5N'
|
||||
ssk = '4f5b7af2c1942067ba33d34318b9735cb46ab5d50b75294844c82a9dd872c201'
|
||||
svk = '60cf228f2bf7f6a70643afe9468fde254145dbd3aab4072ede14bf8bae914103'
|
||||
net = 'testnet'
|
||||
|
||||
|
||||
class StagenetAddressTestCase(Tests, unittest.TestCase):
|
||||
addr = '52jzuBBUMty3xPL3JsQxGP74LDuV6E1LS8Zda1PbdqQjGzFmH6N9ep9McbFKMALujVT9S5mKpbEgC5VPhfoAiVj8LdAqbp6'
|
||||
ssk = 'a8733c61797115db4ec8a5ce39fb811f81dd4ec163b880526683e059c7e62503'
|
||||
svk = 'fd5c0d25f8f994268079a4f7844274dc870a7c2b88fbfc24ba318375e1d9430f'
|
||||
net = 'stagenet'
|
Loading…
Reference in a new issue