Ejemplo n.º 1
0
    def test_XMSS_get_address_random(self):
        xmss1 = merkle.XMSS(signatures=1, SEED=None)
        xmss2 = merkle.XMSS(signatures=1, SEED=None)

        self.assertEqual(xmss1.signatures, 1)
        self.assertEqual(xmss2.signatures, 1)
        self.assertNotEqual(xmss1.root, xmss2.root)
        self.assertNotEqual(xmss1.address, xmss2.address)
Ejemplo n.º 2
0
    def test_XMSS_get_address_known(self):
        xmss = merkle.XMSS(signatures=1, SEED=TestMerkle.S_1)
        self.assertEqual(xmss.signatures, 1)
        self.assertEqual(
            xmss.root,
            '18e9198ac177807cc249e29b3d0cdda14b688d2cb8387e782239c0a565faee35')
        self.assertEqual(
            xmss.address,
            'Q385d6b85063d6f3593f6de6982bb9dd9c8fc92fc54ed67879f6c92c6cf53473d124a'
        )

        new = merkle.XMSS(signatures=5, SEED=None)
        self.assertEqual(new.signatures, 5)
        self.assertIsNotNone(new.address)
Ejemplo n.º 3
0
 def xmss_getnewaddress(
     self,
     signatures=8000,
     SEED=None,
     type='WOTS+'
 ):  # new address format returns a stateful XMSS class object
     return merkle.XMSS(signatures, SEED)
Ejemplo n.º 4
0
    def getnewaddress(self,
                      signatures=8000,
                      type=ADDRESS_TYPE_XMSS,
                      SEED=None):
        """
        Get a new wallet address
        The address format is a list of two items [address, data structure from random_mss call]
        :param signatures:
        :param type:
        :param SEED:
        :return: a wallet address
        """
        addr = []
        if type == Wallet.ADDRESS_TYPE_XMSS:
            new = merkle.XMSS(signatures=signatures, SEED=SEED)
            addr.append(new.address)
            addr.append(new)
        elif type == Wallet.ADDRESS_TYPE_WOTS:
            new = merkle.random_wmss(signatures=signatures)
            addr.append(self.chain.roottoaddr(new[0].merkle_root))
            addr.append(new)
        elif type == Wallet.ADDRESS_TYPE_LDOTS:
            new = merkle.random_ldmss(signatures=signatures)
            addr.append(self.chain.roottoaddr(new[0].merkle_root))
            addr.append(new)
        else:
            raise Exception('OTS type not recognised')

        return addr
Ejemplo n.º 5
0
from __future__ import print_function
import json

from qrlcore import merkle

num_accounts = 100
file_name = "aws_wallet"

wallets = {}
for i in range(num_accounts):
    print("Generating (", i + 1, "/", num_accounts, ")")
    wallet = merkle.XMSS(signatures=4096, SEED=None)
    wallets[wallet.address] = wallet.mnemonic

f = open(file_name, 'w')
with open(file_name, 'w') as f:
    json.dump(wallets, f)  # , encoding = "ISO-8859-1")