本文整理汇总了Python中bigchaindb.Bigchain.get_owned_ids方法的典型用法代码示例。如果您正苦于以下问题:Python Bigchain.get_owned_ids方法的具体用法?Python Bigchain.get_owned_ids怎么用?Python Bigchain.get_owned_ids使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bigchaindb.Bigchain
的用法示例。
在下文中一共展示了Bigchain.get_owned_ids方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: print
# 需要导入模块: from bigchaindb import Bigchain [as 别名]
# 或者: from bigchaindb.Bigchain import get_owned_ids [as 别名]
print(json.dumps(tx_retrieved, sort_keys=True, indent=4, separators=(',', ':')))
print(testuser1_pub)
print(b.me)
print(tx_retrieved['id'])
"""
Transfer the Digital Asset
"""
# create a second testuser
testuser2_priv, testuser2_pub = crypto.generate_key_pair()
# retrieve the transaction with condition id
tx_retrieved_id = b.get_owned_ids(testuser1_pub).pop()
print(json.dumps(tx_retrieved_id, sort_keys=True, indent=4, separators=(',', ':')))
# create a transfer transaction
tx_transfer = b.create_transaction(testuser1_pub, testuser2_pub, tx_retrieved_id, 'TRANSFER')
# sign the transaction
tx_transfer_signed = b.sign_transaction(tx_transfer, testuser1_priv)
b.validate_transaction(tx_transfer_signed)
# write the transaction
b.write_transaction(tx_transfer_signed)
sleep(8)
示例2: print
# 需要导入模块: from bigchaindb import Bigchain [as 别名]
# 或者: from bigchaindb.Bigchain import get_owned_ids [as 别名]
__author__ = 'PC-LiNing'
from bigchaindb import Bigchain
b=Bigchain()
testuser1_pub='3EQyWna5Gniok73MXdT8m9kgSx6DuRYWUbmehCe4cmXU'
testuser1_priv='EZYk1RJtMkySRwNtpiY7AeGQyYLaeu5XsrJHzzVBL3wn'
testuser2_pub='9ooi6zKXdLVmM2ZyUZjRTWcW3TXt2CtnHSbVZnXLxHJM'
testuser2_priv='AZQ1Y4odynAuYEkSQhVKGqNKU4Zp5QidoLwmkfZCjYqL'
tx_retrieved_id1=b.get_owned_ids(testuser1_pub)
print(tx_retrieved_id1)
print("pop:")
print(tx_retrieved_id1.pop())
print('####')
tx_retrieved_id2=b.get_owned_ids(testuser2_pub)
print(tx_retrieved_id2)
print("pop:")
print(tx_retrieved_id2.pop())
示例3:
# 需要导入模块: from bigchaindb import Bigchain [as 别名]
# 或者: from bigchaindb.Bigchain import get_owned_ids [as 别名]
__author__ = 'PC-LiNing'
from bigchaindb import Bigchain
b=Bigchain()
testuser1_pub='3EQyWna5Gniok73MXdT8m9kgSx6DuRYWUbmehCe4cmXU'
testuser1_priv='EZYk1RJtMkySRwNtpiY7AeGQyYLaeu5XsrJHzzVBL3wn'
testuser2_pub='9ooi6zKXdLVmM2ZyUZjRTWcW3TXt2CtnHSbVZnXLxHJM'
testuser2_priv='AZQ1Y4odynAuYEkSQhVKGqNKU4Zp5QidoLwmkfZCjYqL'
# node create transaction for A,-50
testuser1_last=b.get_owned_ids(testuser1_pub).pop()
payload_A = {
"msg" : "node send -50 to A,is -50",
"issue" : "cost",
"category" : "currency",
"amount" : 50,
"asset":"",
# final owner 's account
"account":300,
"previous":testuser1_last['txid'],
"trader":testuser2_pub
}
tx_create= b.create_transaction(b.me, testuser1_pub, None, 'CREATE', payload=payload_A)
tx_create_signed = b.sign_transaction(tx_create, b.me_private)
if b.is_valid_transaction(tx_create_signed):
b.write_transaction(tx_create_signed)