consensus_algorithm Enum
#include <tkcrypt/common.hpp>
Namespace: kc
Overview
The consensus_algorithm
enum specifies the consensus protocol to use in ledger transactions. These algorithms define how multiple participants reach agreement in distributed consensus protocols.
Since: v3.0
Values
Value | Numeric | Description |
---|---|---|
|
0 |
No consensus algorithm specified |
|
1 |
One-phase commit protocol (Commit only) |
|
2 |
Two-phase commit protocol (Propose/Commit) |
|
3 |
Three-phase commit protocol (Propose/PreCommit/Commit) |
Usage
#include <keychain/keychain_headers.hpp>
// Create a three-phase consensus transaction
kc::transaction tx = gateway.create_transaction(
persona,
kc::consensus_algorithm::three_phase_commit,
quorum,
tags,
variables
);
// Start a ledger consensus with two-phase commit
kc::transaction ledger_tx = gateway.ledger_start(
persona,
kc::consensus_algorithm::two_phase_commit,
participants,
tags,
variables
);
Protocol Details
See Also
-
consensus_stage - Stages within consensus protocols
-
transaction - Consensus transaction implementation
-
Gateway Ledger Operations - Using consensus in gateway