Exemple #1
0
def new_wallet():
	random_gen = Crypto.Random.new().read
	private_key = RSA.generate(1024, random_gen)
	public_key = private_key.publickey()

	private_key = binascii.hexlify(private_key.exportKey(format='DER')).decode('ascii')
	public_key = binascii.hexlify(public_key.exportKey(format='DER')).decode('ascii')



	address 	= create_address(public_key)
	response = {
		'private_key': 	private_key,
		'public_key': 	public_key,
		'address'	:	address
	}
	array={}
	array['private_key']=private_key
	array['public_key']=public_key

	array['address']=address
	array['timestamp']=strftime("%Y-%m-%d %H:%M:%S", gmtime())

	wallet = Wallet(array)
	wallet.save_wallet()
	wallet.broadcast_wallet()


	return jsonify(response), 200