本文整理汇总了Python中src.transaction.Transaction.unlock_inputs方法的典型用法代码示例。如果您正苦于以下问题:Python Transaction.unlock_inputs方法的具体用法?Python Transaction.unlock_inputs怎么用?Python Transaction.unlock_inputs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类src.transaction.Transaction
的用法示例。
在下文中一共展示了Transaction.unlock_inputs方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_transaction
# 需要导入模块: from src.transaction import Transaction [as 别名]
# 或者: from src.transaction.Transaction import unlock_inputs [as 别名]
def create_transaction(recipient, amount):
"""
creates a new transaction and add it to verified_transactions.json
:param recipient: public address of the recipient
:param amount: the amount of abc to be sent
:return: None
"""
# TODO: Send a success message to client
conf = Configuration()
try:
tx = Transaction()
tx.add_output(recipient, amount)
tx.unlock_inputs(get_private_key(), get_public_key("string"))
save_verified_transaction(tx.get_transaction_id(), tx.get_data())
conf.subtract_balance(tx.sum_of_outputs())
except ValueError as e:
# Will raise if insufficient utxos are found
raise ValueError("INSUFFICIENT FUNDS")