Esempio n. 1
0
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)
Esempio n. 3
0
    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)
Esempio n. 4
0
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)
Esempio n. 5
0
    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)
Esempio n. 6
0
    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)
Esempio n. 7
0
    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)
Esempio n. 8
0
    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)