UTXO#

class defichain.transactions.builder.modules.UTXO(builder)#

The methods of this module create UTXO transactions.

  1. send: send just one specified amount from the builder address to another address

  2. sendall: send all utxo from the builder address to another address

  3. sendmany: send specified amounts from the builder address to multiple different addresses.

send(amount: float | int, addressTo: str, changeAddress: str = None, inputs=[]) Transaction#

Creates a transaction that sends the specified amount of UTXO to the specified address and returns the remaining UTXO from the input to the sender address if not changed

>>> builder.utxo.send(1, "df1qw8c57c3c4u7k2h4gv2d5x4jr4qgq6cugg33g6e") # sends one UTXO DFI to the specified address
Parameters:
  • amount (float | int) – (required) amount of UTXO to send

  • addressTo (str) – (required) address to send the UTXO to

  • changeAddress (str) – (optional) address to which the remaining UTXO should be sent

  • inputs ([TxInput]) – (optional) additional inputs to spend

Returns:

Transaction

sendall(addressTo: str, inputs=[]) Transaction#

Creates a transaction that sends all UTXO to the specified address

>>> builder.utxo.sendall("df1qw8c57c3c4u7k2h4gv2d5x4jr4qgq6cugg33g6e") # sends all UTXO DFI to the specified address
Parameters:
  • addressTo (str) – (required) address to send the UTXO to

  • inputs ([TxInput]) – (optional) additional inputs to spend

Returns:

Transaction

sendmany(addressAmountTo: {}, changeAddress=None, inputs=[]) Transaction#

Creates a transaction that sends the specified amount of UTXO to the specified addresses. Returns the remaining UTXO from the input to the sender address if not changed

>>> builder.utxo.sendmany({"df1qw8c57c3c4u7k2h4gv2d5x4jr4qgq6cugg33g6e": "1@DFI", "df1qzfwy63ggj5jfpul7r04kn2ss8kjz2sda57fa4m": "1@DFI"}) # sends each address one UTXO DFI
Parameters:
  • addressAmountTo (Address Amounts) – (required) json with specified address and amount to send

  • changeAddress (str) – (required) address to which the remaining UTXO should be sent

  • inputs ([TxInput]) – (optional) additional inputs to spend

Returns:

Transaction