Transactions

The class for creating transaction.

class Transaction(A)

The class for Transaction object

Arguments
  • rawTx – (optional) raw transaction in bytes or HEX encoded string, if no raw transaction provided well be created new empty transaction template.

  • format – (optional) “raw” or “decoded” format. Raw format is mean that all transaction represented in bytes for best performance. Decoded transaction is represented in human readable format using base68, hex, bech32, asm and opcodes. By default “decoded” format using.

  • version – (optional) transaction version for new template, by default is 2.

  • lockTime – (optional) transaction lock time for new template, by default is 0.

  • testnet – (optional) flag for testnet network, by default is false.

  • autoCommit – (optional) boolean, by default is true.

  • keepRawTx – (optional) boolean, by default is false.

Transaction.decode(testnet)

change Transaction object representation to “decoded” human readable format

Arguments
  • testnet – (optional) flag for testnet network, by default is false.

Transaction.encode()

change Transaction object representation to “raw” bytes format, all human readable part will be stripped.

Transaction.serialize(A)

get serialized Transaction

Arguments
  • segwit – (optional) flag for segwit representation of serialized transaction, by default true.

  • hex – (optional) if set to True return HEX encoded string, by default true.

Return str,bytes

serialized transaction in HEX or bytes.

Transaction.json()

get json Transaction representation