def wallet_create(ctx, password, force): kp = KeyPair.generate() kf = ctx.obj.get(CTX_KEY_PATH) if not force and os.path.exists(kf): click.confirm(f'Key file {kf} already exists, overwrite?', abort=True) if password is None: password = click.prompt("Enter the wallet password", default='', hide_input=True) kp.save_to_file(kf, password) _pp([('Wallet address', kp.get_address()), ('Wallet path', os.path.abspath(kf))], title='Wallet created')
def test_create_transaction_signing(): client = EpochClient() new_keypair = KeyPair.generate() receiver_address = new_keypair.get_address() keypair = KeyPair.read_from_dir('/home/tom/data/aeternity/epoch/_build/dev1/rel/epoch/data/aecore/keys/', 'secret') transaction = client.create_spend_transaction(receiver_address, 10) signed_transaction, b58signature = keypair.sign_transaction(transaction) result = client.send_signed_transaction(signed_transaction) assert result == {} current_block = client.get_latest_block() # make sure this works for very short block times client.wait_for_next_block(polling_interval=0.01) next_block = client.get_latest_block() # find the transaction that is the spend transaction we just submitted spend_tx = next(tx for tx in next_block.transactions if type(tx.tx) == SpendTx) assert spend_tx.signatures[0] == b58signature
def test_create_transaction_signing(): client = EpochClient() # generate a new keypair new_keypair = KeyPair.generate() receiver_address = new_keypair.get_address() # get the test keypair keypair = KeyPair.from_public_private_key_strings(PUBLIC_KEY, PRIVATE_KEY) # create a spend transaction transaction = client.create_spend_transaction(PUBLIC_KEY, receiver_address, 321) signed_transaction, b58signature = keypair.sign_transaction(transaction) # post the transaction result = client.send_signed_transaction(signed_transaction) assert result is not None assert result.tx_hash is not None print(result) # make sure this works for very short block times client.wait_for_next_block(polling_interval=0.01) spend_tx = client.get_transaction_by_transaction_hash(result.tx_hash, tx_encoding='json') assert spend_tx.transaction['signatures'][0] == b58signature
def test_transfer_ownership(): client = EpochClient() name = AEName(random_domain()) name.full_claim_blocking(keypair) assert name.status == AEName.Status.CLAIMED client.wait_for_next_block() new_key_pair = KeyPair.generate() # put some coins into the account so the account is in the state tree # otherwise it couldn't become the owner of an address. client.spend(keypair, new_key_pair.get_address(), 1) client.wait_for_next_block() # now transfer the name to the other account name.transfer_ownership(keypair, new_key_pair.get_address()) assert name.status == AEName.Status.TRANSFERRED client.wait_for_next_block() # try changing the target using that new keypair name.update_status() name.update(new_key_pair, target=keypair.get_address()) client.wait_for_next_block() name.update_status() assert name.pointers != [], 'Pointers should not be empty' assert name.pointers['account_pubkey'] == new_key_pair.get_address()
if len(args) != 4: print( 'You must specify <amount>, <receipient> and <wallet-path>. ' 'Tip: escape the receipient address in single quotes to make ' 'sure that your shell does not get confused with the dollar-sign') sys.exit(1) password = getpass('Wallet password: '******'Transaction sent. Your balance will change once it was included in ' 'the blockchain.') sys.exit(1) elif main_arg == 'generate': # generate wallet keypair = KeyPair.generate() try: path = popargs(args, '--path') except ValueError: print('You must specify the --path argument') sys.exit(1) keypair.save_to_folder(path) address = keypair.get_address() print('You wallet has been generated:') print('Address: %s' % address) print('Saved to: %s' % path) elif main_arg == 'wallet': wallet_path = args[2] password = getpass('Wallet password: '******'Address: %s' % keypair.get_address())
def _get_burn_key(cls): keypair = KeyPair.generate() keypair.signing_key