def new_transaction(): values = request.get_json() # Check that the required fields are in the POST'ed data required = ['sender', 'recipient', 'amount'] if not all(k in values for k in required): return 'Missing values', 400 # Create a new Transaction transaction = Transaction(values['sender'], values['recipient'], values['amount']) index = transaction.addToLocalDB() #index = blockchain.new_transaction(values['sender'], values['recipient'], values['amount']) response = {'message': f'Transaction will be added to Block {index-1}'} return jsonify(response), 201