def test_transform_create(b, user_private_key, user_public_key): tx = util.create_tx(user_public_key, user_public_key, None, 'CREATE') tx = util.transform_create(tx) tx = util.sign_tx(tx, b.me_private) assert tx['transaction']['current_owner'] == b.me assert tx['transaction']['new_owner'] == user_public_key assert util.verify_signature(tx)
def create_transaction(current_owner, new_owner, tx_input, operation, payload=None): """Create a new transaction Refer to the documentation of ``bigchaindb.util.create_tx`` """ return util.create_tx(current_owner, new_owner, tx_input, operation, payload)
def create_transaction(owner_before, owner_after, tx_input, operation, payload=None): """Create a new transaction Refer to the documentation of ``bigchaindb.util.create_tx`` """ return util.create_tx(owner_before, owner_after, tx_input, operation, payload)
def test_transform_create(b, user_sk, user_vk): from bigchaindb import util tx = util.create_tx(user_vk, user_vk, None, 'CREATE') tx = util.transform_create(tx) tx = util.sign_tx(tx, b.me_private) assert tx['transaction']['fulfillments'][0]['current_owners'][0] == b.me assert tx['transaction']['conditions'][0]['new_owners'][0] == user_vk assert util.verify_signature(tx)
def create(self, payload=None): """Issue a transaction to create an asset. Args: payload (dict): the payload for the transaction. Return: The transaction pushed to the Federation. """ tx = util.create_tx(self.public_key, self.public_key, None, operation='CREATE', payload=payload) signed_tx = util.sign_tx(tx, self.private_key) return self._push(signed_tx)
def transfer(self, new_owner, tx_input, payload=None): """Issue a transaction to transfer an asset. Args: new_owner (str): the public key of the new owner tx_input (str): the id of the transaction to use as input payload (dict, optional): the payload for the transaction. Return: The transaction pushed to the Federation. """ tx = util.create_tx(self.public_key, new_owner, tx_input, operation='TRANSFER', payload=payload) signed_tx = util.sign_tx(tx, self.private_key) return self._push(signed_tx)