Skip to main content

Introduction

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 occurrences.

Query Information with Scripts

These events can be queried using the Go or JavaScript SDKs to extract useful notifications and information about the state of these processes.

QC Scripts

These scripts allow anyone to query information about the state of the QC contract.

Get Clusters

To return a struct representing the information associated with a collector cluster, can use the Get Cluster (QC.03) script with the following argument:

ArgumentTypeDescription
clusterIndexUInt16The index of the cluster to query

Get QC Enabled

To return a boolean representing if the QC is enabled, can use the Get QC Enabled (QC.04) script with no arguments.

Get Node Has Voted

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:

ArgumentTypeDescription
nodeIDStringThe node ID to check for

Get Voting Complete

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.

QC Events

Documentation coming soon

DKG Scripts

Get DKG Enabled

To return a boolean representing if the DKG is enabled, you can use the Get DKG Enabled (DKG.04) script with no arguments.

Get DKG Completed

To return a boolean representing if the dkg is complete, you can use the Get DKG Complete (DKG.05) script with no arguments.

Get Whiteboard Messages

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.

Get Final Submissions

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.

Get Node Has Submitted

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:

ArgumentTypeDescription
nodeIDStringThe node ID to check for

DKG Events


_10
/// Emitted when the admin enables the DKG
_10
access(all) event StartDKG()
_10
_10
/// Emitted when the admin ends the DKG after enough submissions have been recorded
_10
access(all) event EndDKG(finalSubmission: [String?]?)
_10
_10
/// Emitted when a consensus node has posted a message to the DKG whiteboard
_10
access(all) event BroadcastMessage(nodeID: String, content: String)