mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00

* Planning release * Clean up after move * Add exceptions.py * Add crypto.py * Adjust setup to package structure * Fix tests * Add test coverage * Comply to flake8 * Add test coverage * Transfer-tx fulfillments validation * Remove condition and fulfillment ids * Fix signing logic Specifically for transfer-tx with multiple inputs and outputs. * Compliance to legacy BDB models * Adjust fulfillment validation interface * Add serialization validation for txids * Use __eq__ to compare objects * Heavy refactor to comply with current implementation * Add Transaction.create * Correct fulfillment validation logic * Add Transaction.create for hashlock conditions * Add hashlock condition serialization * Transaction.transfer add single input and outputs * Small adjustments to transfer-tx interface * Create transfer-tx interface * Increase test coverage * Adjust fulfillment (de)serialization * Catch CC Error for Fulfillment * Allow custom thresholds * PR feedback * Fix tests * Rename Data to Metadata * Add Asset exceptions * Add basic Asset model * More renaming of payload => data * Add Asset into work-flow-functions * Add Asset amount to condition * add fulfillment exception * initial integration of asset * Make transaction.py compy to 79 chars * Make util.py comply to 79 chars * Make exceptions.py comply to 80 chars * Renaming inp to input_ * fix pep8 issues * Correct raised error * Remove resolved TODOs * prevent adding None as fulfillment / condition to Transaction * Small modifications to support new cryptoconditions * Improve documentation (#42) * Add doc strings for Fulfillment cls * Add doc strings for TransactionLink cls * Add doc strings for Condition cls * Add doc strings for Data cls * Add doc strings for Transaction cls * Add doc strings for Asset cls * Extract common implementation * Tx model: Add test for empty inputs * WIP: Implement sign tx * Add tests for: - Conditions; and - Fulfillments Mostly on the (de)serialization part. * Finalize serialization logic for tx class * Add Tests for tx serialization logic * Add fulfillment validation * Add ThresholdCondition support * WIP transfer * Clean up after move * Adjust setup to package structure * Fix tests * Add test coverage * Add test coverage * Transfer-tx fulfillments validation * Remove condition and fulfillment ids * Fix signing logic Specifically for transfer-tx with multiple inputs and outputs. * Fix test case * Compliance to legacy BDB models * Adjust fulfillment validation interface * Add serialization validation for txids * Use __eq__ to compare objects * Heavy refactor to comply with current implementation * Add Transaction.create * Add validation tests * Add Transaction.create for hashlock conditions * Add hashlock condition serialization * Transaction.transfer add single input and outputs * Small adjustments to transfer-tx interface * Create transfer-tx interface * Increase test coverage * Adjust fulfillment (de)serialization * Catch CC Error for Fulfillment * Allow custom thresholds * Rename Data to Metadata * Add basic Asset model * Add Asset into work-flow-functions * Add Asset amount to condition * initial integration of asset * Make tests comply to 79 chars per line * Fixed tests * fix pep8 issues * Correct raised error * Add test for asset initialization * Remove resolved TODOs * prevent adding None as fulfillment / condition to Transaction * Small modifications to support new cryptoconditions * Extract common tests * Copy conftest from bigchaindb-common - by @timdaub * Replace bigchaindb_common pkg by bigchaindb.common
50 lines
1.6 KiB
Python
50 lines
1.6 KiB
Python
"""A Python 3 script to write a file with a specified number
|
|
of keypairs, using bigchaindb.common.crypto.generate_key_pair()
|
|
The written file is always named keypairs.py and it should be
|
|
interpreted as a Python 2 script.
|
|
|
|
Usage:
|
|
$ python3 write_keypairs_file.py num_pairs
|
|
|
|
Using the list in other Python scripts:
|
|
# in a Python 2 script:
|
|
from keypairs import keypairs_list
|
|
# keypairs_list is a list of (sk, pk) tuples
|
|
# sk = signing key (private key)
|
|
# pk = verifying key (public key)
|
|
"""
|
|
|
|
import argparse
|
|
|
|
from bigchaindb.common import crypto
|
|
|
|
|
|
# Parse the command-line arguments
|
|
desc = 'Write a set of keypairs to keypairs.py'
|
|
parser = argparse.ArgumentParser(description=desc)
|
|
parser.add_argument('num_pairs',
|
|
help='number of keypairs to write',
|
|
type=int)
|
|
args = parser.parse_args()
|
|
num_pairs = int(args.num_pairs)
|
|
|
|
# Generate and write the keypairs to keypairs.py
|
|
print('Writing {} keypairs to keypairs.py...'.format(num_pairs))
|
|
with open('keypairs.py', 'w') as f:
|
|
f.write('# -*- coding: utf-8 -*-\n')
|
|
f.write('"""A set of keypairs for use in deploying\n')
|
|
f.write('BigchainDB servers with a predictable set of keys.\n')
|
|
f.write('"""\n')
|
|
f.write('\n')
|
|
f.write('from __future__ import unicode_literals\n')
|
|
f.write('\n')
|
|
f.write('keypairs_list = [')
|
|
for pair_num in range(num_pairs):
|
|
keypair = crypto.generate_key_pair()
|
|
spacer = '' if pair_num == 0 else ' '
|
|
f.write("{}('{}',\n '{}'),\n".format(
|
|
spacer, keypair[0], keypair[1]))
|
|
f.write(' ]\n')
|
|
|
|
print('Done.')
|