The Cluster Quorum Certificate (QC) and Distributed Key Generation (DKG) protocol smart contracts store a lot of different state, and the state is constantly changing. As an external party, there are two ways to keep track of these state changes. You can either use Cadence scripts to query the state of the contract at any given time, or you can monitor events that are emitted by the contracts to be notified of any important occurances.
These events can be queried using the Go or JavaScript SDKs to extract useful notifications and information about the state of these processes.
These scripts allow anyone to query information about the state of the QC contract.
To return a struct representing the information associated with a collector cluster, can use the Get Cluster (QC.03) script with the following argument:
Argument | Type | Description |
---|---|---|
clusterIndex | UInt16 | The index of the cluster to query |
To return a boolean representing if the QC is enabled, can use the Get QC Enabled (QC.04) script with no arguments.
To return a boolean representing if a node has voted for the current QC, you can use the Get Node Has Voted (QC.05) script with the following argument:
Argument | Type | Description |
---|---|---|
nodeID | String | The node ID to check for |
To return a boolean representing if the voting for the QC phase is complete, can use the Get Voting Complete (QC.06) script with no arguments.
Documentation coming soon
To return a boolean representing if the DKG is enabled, you can use the Get DKG Enabled (DKG.04) script with no arguments.
To return a boolean representing if the dkg is complete, you can use the Get DKG Complete (DKG.05) script with no arguments.
To return an array of structs representing all the whiteboard messages, you can use the Get DKG Whiteboard Messages (DKG.06) script with no arguments.
To return an array of key vectors for the nodes' final submissions, you can use the Get Final Submissions (DKG.07) script with no arguments.
To return a boolean representing if a node has sent their final submission for the DKG, you can use the Get Node Has Submitted (DKG.08) script with the following argument:
Argument | Type | Description |
---|---|---|
nodeID | String | The node ID to check for |
1/// Emitted when the admin enables the DKG2pub event StartDKG()34/// Emitted when the admin ends the DKG after enough submissions have been recorded5pub event EndDKG(finalSubmission: [String?]?)67/// Emitted when a consensus node has posted a message to the DKG whiteboard8pub event BroadcastMessage(nodeID: String, content: String)