Transaction#

class defichain.transactions.rawtransactions.Transaction(inputs: [], outputs: [], lockTime: int = 0)#
static deserialize(network: Any, hex: str) Transaction#

Deserializes unsigned and signed transaction.

Creates the respective transaction object.

Limitations: Not all raw transactions can be deserialized for now. For example, it’s not possible to deserialize multi signature transactions.

Parameters:
  • network (Network) – (required) the corresponding network from the raw transaction

  • hex (str) – (required) the raw transaction as hexadecimal sting

Returns:

Transaction

sign(network: ~typing.Any, private_keys: [<class 'str'>]) Transaction#

Signs the raw transaction with the given private keys

Parameters:
  • network (Network) – (required) the corresponding network from the raw transaction

  • private_keys ([str]) – (required) a list of private keys. If there is only one private key in the list, it will be used to sign all inputs of the transaction. If you have inputs witch use different private keys, provide a separate private key for every input in the list. The private keys have to be provided in the same order as the inputs

Returns:

Transaction

verify() bool#

Verifies the correctness of all given entries in the given object

Returns:

“bool” - returns True if all entries are correct

to_json() {}#

Returns information about the transaction object in json format :return: “{}” - information about the object that was used to call this method