Proposals#

class defichain.node.Proposals(node)#
creategovcfp(title: str, context: str, amount: float, payoutAddress: str, contextHash: str = None, cycles: int = None, inputs: [{}] = None) str#

Creates a Community Fund Proposal

Requires wallet passphrase to be set with walletpassphrase call.

Parameters:
  • title (str) – (required) The title of community fund request

  • context (str) – (required) The context field of community fund request

  • amount (float) – (required) Amount in DFI to request

  • payoutAddress (str) – (required) Any valid address for receiving

  • contextHash (str) – (optional) The hash of the content which context field point to of community fund request

  • cycles (int) – (optional) Defaulted to one cycle

  • inputs (json array) – (optional) Inputs

Returns:

“hash” (string) – The hex-encoded hash of broadcasted transaction

Example:
>>> node.proposals.creategovcfp("CFP Title", "CFP Context", 1000, "payoutAddress")
creategovvoc(title: str, context: str, contextHash: str = None, emergency: bool = False, inputs: [{}] = None) str#

Creates a Vote of Confidence

Requires wallet passphrase to be set with walletpassphrase call.

Parameters:
  • title (str) – (required) The title of vote of confidence

  • context (str) – (required) The context field for vote of confidence

  • contextHash (str) – (optional) The hash of the content which context field point to of vote of confidence request

  • emergency (bool) – (optional) Is this emergency VOC

  • inputs (json array) – (optional) Inputs

Returns:

“hash” (string) – The hex-encoded hash of broadcasted transaction

Example:
>>> node.proposals.creategovvoc("VOC Title", "VOC Title")
getgovproposal(proposalId: str) {}#

Returns real time information about proposal state.

Parameters:

proposalId (str) – (required) The proposal id

Returns:

{id:{…},…} – (json) Json object with proposal vote information

Example:
>>> node.proposals.getgovproposal("txid")
listgovproposals(type: str = 'all', status: str = 'all') {}#

Returns information about proposals.

Parameters:
  • type (str) – (optional) cfp/voc/all (default = all)

  • status (str) – (optional) voting/rejected/completed/all (default = all)

Returns:

{id:{…},…} – (json) Json object with proposals information

Example:
>>> node.proposals.listgovproposals()
listgovproposalvotes(proposalId: str, masternode: str = 'mine', cycle: int = 0) {}#

Returns information about proposal votes.

Parameters:
  • proposalId (str) – (required) The proposal id

  • masternode (str) – (optional) mine/all/id (default = mine)

  • cycle (int) – (optional) cycle: 0 (show current), cycle: N (show cycle N), cycle: -1 (show all) (default = 0)

Returns:

{id:{…},…} – (json) Json object with proposal vote information

Example:
>>> node.proposals.listgovproposalvotes("txid")
votegov(proposalId: str, masternodeId: str, decision: str, inputs: [{}] = None) str#

Vote for community proposal Requires wallet passphrase to be set with walletpassphrase call.

Parameters:
  • proposalId (str) – (required) The proposal txid

  • masternodeId (str) – (required) The masternode id which made the vote

  • decision (str) – (required) The vote decision (yes/no/neutral)

  • inputs (json array) – (optional) Inputs

Returns:

“hash” (string) – The hex-encoded hash of broadcasted transaction

Example:
>>> node.proposals.votegov("txid", "masternodeId", "yes")