Skip to content

Proof of Authority (hierachain/consensus/proof_of_authority.py)

Overview

Proof of Authority (PoA) is an identity-based consensus protocol optimized for Intra-Organization enterprise networks (single MainChain managing internal domain Sub-Chains). In HieraChain's two-tiered consensus architecture, SubChain instances always default to PoA for processing internal domain events at ultra-fast speeds (~0ms base latency) without requiring cross-organizational roundtrips.

For cross-organizational inter-MainChain consensus between independent enterprises, see Proof of Federation (PoF).


How It Works

The protocol operates based on trust in the identity of participating nodes: 1. Node Identity: Each Authority is assigned an authority_id and a unique signing key pair. 2. Round-Robin Schedule: The system uses a sequential algorithm to determine which node has the right to create the next block based on the block index (BlockIndex % TotalAuthorities). 3. Signature Verification: Each new block must be signed by the designated Authority. Other nodes verify this signature before accepting the block into the ledger.


Key Features

  • Breakthrough Performance


    Blocks are created instantly according to the configured cycle (block_interval), suitable for real-time response applications.

  • Identity Management


    Supports flexible addition/removal of Authorities through the API, allowing network configuration changes without system downtime.

  • Absolute Integrity


    Every block carries the digital signature of a verified organization, completely eliminating risks from anonymous or spoofed nodes.


Important Configuration Parameters

Parameter Description Default
block_interval Minimum time between two blocks. 10.0 seconds
max_authorities Maximum number of Authority nodes in the network. 100
require_signature Mandatory valid signature to accept a block. True

Deployment Example

from hierachain.consensus import ProofOfAuthority

# Initialize PoA protocol
poa = ProofOfAuthority()

# Authorize nodes to participate in consensus
poa.add_authority("node_hq", metadata={"org": "Headquarters", "pubkey": "..."})
poa.add_authority("node_branch_1", metadata={"org": "Branch 01", "pubkey": "..."})

# Check block creation permission for current node
if poa.can_create_block("node_hq"):
    # Proceed to close block...
    pass

Advantages and Limitations

  • Advantages: Resource-efficient (no powerful CPU needed for mining), high throughput, transparent governance.
  • Limitations: Lower decentralization compared to BFT, only suitable for networks with a certain level of trust between members.