Masternode#

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

The methods of this module create masternode transactions

  1. createmasternode: transaction to create a masternode

  2. resignmasternode: transaction to resigning the masternode

  3. updatemasternode: transaction to change owner, operator or reward address of a masternode

createmasternode(operatorAddress: str, timeLock: int = 0, inputs=[]) Transaction#

Creates a transaction to create a masternode with the given operator address and time lock

>>> builder.masternode.createmasternode("8HZ4oMoussmoVRghTaSqmB4Q74wPeiCyHC") # create a masternode
Parameters:
  • operatorAddress (str) – (required) legacy address of the operator

  • timeLock (int) – (optional) time period to lock the masternode: 0 (default), 5, 10 years

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

Returns:

Transaction

resignmasternode(masternodeId: str, inputs=[]) Transaction#

Creates a transaction to resigning the masternode.

>>> builder.masternode.resignmasternode("4e5a3a891653b7ea017a0560f5c873bdf183f52a013606341faa2823c54a2d9c") # resign a masternode
Parameters:
  • masternodeId (str) – (required) masternode id

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

Returns:

Transaction

updatemasternode(masternodeId: str, ownerAddress: str | None = None, operatorAddress: str | None = None, rewardAddress: str | None = None, inputs=[]) Transaction#

Creates a transaction to change owner, operator or reward address of a masternode.

>>> builder.masternode.updatemasternode(rewardAddress="df1qtmk8nad9n03nwmanqfpug94h3jqjn3gyytl3gl") # update masternode reward address
Parameters:
  • masternodeId (str) – (required) masternode id

  • ownerAddress (str) – (optional) new owner address

  • operatorAddress (str) – (optional) new operator address

  • rewardAddress (str) – (optional) new reward address

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

Returns:

Transaction