Transactions¶
The class for creating transaction.
-
class
pybtc.Transaction(raw_tx=None, tx_format='decoded', version=1, lock_time=0, testnet=False)[source]¶ The class for Transaction object
Parameters: - raw_tx – (optional) raw transaction in bytes or HEX encoded string, if no raw transaction provided well be created new empty transaction template.
- tx_format – “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 (int) – transaction version for new template, by default 1.
- lock_time (int) – transaction lock time for new template, by default 0.
- testnet (boolean) – address type for “decoded” transaction representation.
-
decode(testnet=None)[source]¶ change Transacion object representation to “decoded” human readable format
Parameters: testnet (bool) – (optional) address type for “decoded” transaction representation, by default None. if None used type from transaction property “format”.
-
encode()[source]¶ change Transaction object representation to “raw” bytes format, all human readable part will be stripped.