예제 #1
0
    def test_wallet_mainnet(self):
        wallet = Wallet(MASTER_PASSWORD)

        self.assertEqual(wallet.root_address,
                         ('', '19XyEM554GKKAPHihuGS4J3kCbFEBvqcYz'))
        self.assertEqual(wallet.address_from_path('0/1/2/3/4/5'),
                         ('0/1/2/3/4/5', '1F2AMKyeV2DCdehRfDj3Qq1jhaZS8MSzMq'))
예제 #2
0
    def test_wallet_testnet(self):
        wallet = Wallet(MASTER_PASSWORD, testnet=True)

        self.assertEqual(wallet.root_address,
                         ('', 'mp3vXQA3sHkZwVmLRUEotDG54aqwBVYTLd'))
        self.assertEqual(wallet.address_from_path('0/1/2/3/4/5'),
                         ('0/1/2/3/4/5', 'muY7eP4dJ3eTQmB3NnhREkE4ZaA92pgsAW'))
예제 #3
0
    def test_unique_hierarchical_path(self):
        wallet = Wallet(MASTER_PASSWORD)

        path, address = wallet.address_from_path()
        t = datetime.now()
        now = '%s/%s/%s/%s/%s' % (t.year, t.month, t.day, t.hour, t.minute)
        self.assertTrue(path.find(now) != -1)
예제 #4
0
    def test_unique_hierarchical_path(self):
        wallet = Wallet(MASTER_PASSWORD)

        path, address = wallet.address_from_path()
        t = datetime.utcnow()
        now = '%s/%s/%s/%s/%s' % (t.year, t.month, t.day, t.hour, t.minute)
        self.assertTrue(path.find(now) != -1)
    return address


def push_tx(tx):
    tx_id = spool._t.push(tx)
    print("Pushed tx %s" % tx_id)
    return tx_id


if __name__ == "__main__":
    cmd = sys.argv[1]

    FUND_WALLET_SECRET = os.environ.get('FUND_WALLET_SECRET')
    FEDERATION_WALLET_SECRET = os.environ.get('FED_WALLET_SECRET')

    fund_wallet = Wallet(FUND_WALLET_SECRET)
    fed_wallet = Wallet(FEDERATION_WALLET_SECRET)

    if cmd == 'fund':
        print("Funding federation wallet %s..." % fed_wallet.root_address[1])
        tx = fund_federation_wallet(fed_wallet, fund_wallet,
                                    FUND_WALLET_SECRET)
        txid = push_tx(tx)
        print("https://www.blocktrail.com/BTC/tx/%s" % txid)

    elif cmd == 'notarise':

        data = sys.argv[2]
        if (len(data) < 16):
            print("Data needs to be 16+ bytes")
            raise Exception
예제 #6
0
    def test_wallet_mainnet(self):
        wallet = Wallet(MASTER_PASSWORD)

        self.assertEqual(wallet.root_address, ('', '19XyEM554GKKAPHihuGS4J3kCbFEBvqcYz'))
        self.assertEqual(wallet.address_from_path('0/1/2/3/4/5'),
                         ('0/1/2/3/4/5', '1F2AMKyeV2DCdehRfDj3Qq1jhaZS8MSzMq'))
예제 #7
0
    def test_wallet_testnet(self):
        wallet = Wallet(MASTER_PASSWORD, testnet=True)

        self.assertEqual(wallet.root_address, ('', 'mp3vXQA3sHkZwVmLRUEotDG54aqwBVYTLd'))
        self.assertEqual(wallet.address_from_path('0/1/2/3/4/5'),
                         ('0/1/2/3/4/5', 'muY7eP4dJ3eTQmB3NnhREkE4ZaA92pgsAW'))
예제 #8
0
    def setUp(self):
        try:
            # flag to run the tests
            test = os.environ['TEST_SPOOL']
            if test == '2':
                username = os.environ['TESTNET_USERNAME']
                password = os.environ['TESTNET_PASSWORD']
                host = os.environ['TESTNET_HOST']
                port = os.environ['TESTNET_PORT']
            self.refill_pass = os.environ['TEST_REFILL_PASS']
            self.federation_pass = os.environ['TEST_FEDERATION_PASS']
            self.refill_root = Wallet(self.refill_pass,
                                      testnet=True).root_address
            self.federation_root = Wallet(self.federation_pass,
                                          testnet=True).root_address
        except KeyError:
            raise unittest.SkipTest(
                'TEST_REFILL_PASS and/or TEST_FEDERATION_PASS environment variables are not set.'
            )

        # set TEST_SPOOL=2 to test with bitcoind
        if test == '2':
            print('using bitcoind')
            self.t = Transactions(testnet=True,
                                  service='daemon',
                                  username=username,
                                  password=password,
                                  host=host,
                                  port=port)
            self.spool = Spool(testnet=True,
                               service='daemon',
                               username=username,
                               password=password,
                               host=host,
                               port=port)
        else:
            print('using blockr')
            self.t = Transactions(testnet=True)
            self.spool = Spool(testnet=True)

        self.user1_pass = self._get_pass()
        self.user2_pass = self._get_pass()
        self.user3_pass = self._get_pass()
        self.user1_root = Wallet(self.user1_pass, testnet=True).root_address
        self.user1_leaf = Wallet(self.user1_pass,
                                 testnet=True).address_from_path()
        self.user2_leaf = Wallet(self.user2_pass,
                                 testnet=True).address_from_path()
        self.user3_leaf = Wallet(self.user3_pass,
                                 testnet=True).address_from_path()
        self.file_hash = self._get_file_hash()

        print('user1_pass: '******'user2_pass: '******'user3_pass: '******'user1_root: ', self.user1_root)
        print('user1_leaf: ', self.user1_leaf)
        print('user2_leaf: ', self.user2_leaf)
        print('user3_leaf: ', self.user3_leaf)
        print('file_hash :', self.file_hash)

        self.spool._t.import_address(
            self.user1_root[1],
            "test",
        )
        self.spool._t.import_address(
            self.user1_leaf[1],
            "test",
        )
        self.spool._t.import_address(
            self.user2_leaf[1],
            "test",
        )
        self.spool._t.import_address(
            self.user3_leaf[1],
            "test",
        )
        self.spool._t.import_address(
            self.file_hash[0],
            "test",
        )
        self.spool._t.import_address(
            self.file_hash[1],
            "test",
        )