예제 #1
0
def cosign(args):
	try:
		backup_mpk = MasterKey.from_key(args.private)
	except EncodingError:
		backup_mpk = MasterKey.from_seed_hex(args.private)
	batch = Batch.from_file(args.load)
	batch.validate()  # todo - validation
	original_merkle_root = batch.merkle_root
	batch.sign(master_private_key=backup_mpk)
	if batch.merkle_root != original_merkle_root:
		batch.to_file(args.save)
	else:
		print "! All signatures failed: wrong private key used, or malformed batch"
예제 #2
0
def get_test_master_keys():
	return [MasterKey.from_seed_hex(seed_hex) for seed_hex in hex_seeds]
예제 #3
0
def get_test_master_xpub_keys():
	return [MasterKey.from_hwif(hwif) for hwif in xpub_strings]
예제 #4
0
except IOError:
	insecure_seed_base = ''.join([random.choice('0123456789abcdef') for i in range(0, 128)])  # please do not use this in production or you'll lose your coins
	with open(SEED_FILE, 'w') as fp:
		fp.write(insecure_seed_base)

def __rotate(string, times=1):
	for i in range(0, times):
		letters = list(string)
		letters.append(letters.pop(0))
		string = ''.join(letters)
	return string


# creating seeds
hex_seeds = [insecure_seed_base, __rotate(insecure_seed_base, 1), __rotate(insecure_seed_base, 2), __rotate(insecure_seed_base, 3)]
xpub_strings = [str(MasterKey.from_seed_hex(seed_hex).hwif()) for seed_hex in hex_seeds]


def get_test_master_keys():
	return [MasterKey.from_seed_hex(seed_hex) for seed_hex in hex_seeds]


def get_test_hex_seeds():
	return hex_seeds


def get_test_master_xpub_keys():
	return [MasterKey.from_hwif(hwif) for hwif in xpub_strings]


def get_test_master_xpub_strings():