Data#
- class defichain.transactions.builder.modules.Data(builder)#
The methods of this module create transactions that write data to the blockchain.
The data can only be 76 bytes in size.
Only submittable via defichain node
You can only use a connection to a defichain node to submit this kind of transaction to the blockchain. The ocean network will refuse the transaction.
hex_data: transaction witch includes your own hexadecimal data
str_data: transaction witch includes your own string data
- hex_data(data: str, addressAmountTo=None, changeAddress: str | None = None, inputs=None) Transaction #
Creates a transaction witch includes your own hexadecimal data. The data can only be 76 bytes in size.
You can only use a connection to a defichain node to submit this kind of transaction to the blockchain. The ocean network will refuse the transaction.
>>> builder.data.hex_data("48656c6c6f2044656669676874657273") # includes hexadecimal data into the blockchain
- Parameters:
data (hex) – (required) hexadecimal data
addressAmountTo (Address Amounts) – (optional) json with specified address and amount to send
changeAddress (str) – (optional) address to which the remaining UTXO should be sent
inputs ([TxInput]) – (optional) additional inputs to spend
- Returns:
- str_data(data: str, addressAmountTo=None, changeAddress: str | None = None, inputs=None) Transaction #
Creates a transaction witch includes your own string data. The data can only be 76 bytes in size.
You can only use a connection to a defichain node to submit this kind of transaction to the blockchain. The ocean network will refuse the transaction.
The string data will automaticly be converted into hexadecimal data.
>>> builder.data.hex_data("Hello Defighters") # includes string data into the blockchain
- Parameters:
data (str) – (required) string data
addressAmountTo (Address Amounts) – (optional) json with specified address and amount to send
changeAddress (str) – (optional) address to which the remaining UTXO should be sent
inputs ([TxInput]) – (optional) additional inputs to spend
- Returns: