You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
sip: 51
title: Enhanced Economic Clustering Implementation
description: Improvements to the Economic Clustering algorithm for better fork resistance and chain security
author: gittrekt (@gittrekt)
discussions-to:
status: Draft
type: Standards Track
category: Core
created: 2024-10-15
requires: N/A
Abstract
This SIP proposes enhancements to the Economic Clustering (EC) algorithm in Signum to improve fork resistance and overall chain security. The changes include more robust verification of transaction timestamps, integration of economic weight in fork choice, and improved block validation processes.
Motivation
The current Economic Clustering implementation has some limitations in its ability to prevent certain types of attacks and ensure the selection of the most economically significant chain. This proposal aims to address these issues by incorporating more factors into the fork choice rule and improving the overall robustness of the EC algorithm.
Specification
The key changes to the Economic Clustering implementation are as follows:
Enhanced Transaction Timestamp Verification:
Implement a more stringent check for transaction timestamps to prevent transactions from the far past or future.
Use AtConstants.averageBlockMinutes() to dynamically adjust the allowed time difference based on the current block height (Previously 15 seconds. Updated blockTime * 0.5 - May require changes here to just block time)
Economic Weight Calculation:
Introduce a new method calculateEconomicWeight() in the BlockService interface.
Economic weight of a block is calculated as the sum of transaction amounts and fees, with a minimum weight (1) to account for empty blocks.
Fork Choice Rule Enhancement:
Incorporate both cumulative difficulty and economic weight in determining the valid chain.
Calculate a "fork strength" metric as the product of cumulative difficulty and cumulative economic weight.
Improved Block Validation:
Implement more thorough checks during block validation, including duplicate transaction detection and public key verification for all transactions in a block.
Constants Adjustment:
Introduce new constants EC_VERIFICATION_DEPTH (10 blocks) to fine-tune the EC algorithm look-back behaviour.
Rationale
These changes aim to make the Economic Clustering algorithm more resistant to various attack vectors, and add an ability for the main chain to better decide when to fork:
Incorporating economic weight into the fork choice rule ensures that the chain with the most economic activity is preferred, aligning with the original intent of EC (Economic Majority when in context of Bitcoin).
The improved block validation process makes it harder for malicious actors to introduce invalid blocks into the chain. Would also make it so that if a pool operator attempted to insert an invalid block all nodes would be able to invalidate it based on past blocks.
The new fork validation process provides several additional benefits:
Cumulative Difficulty and Economic Weight: By considering both the cumulative difficulty and the economic weight of a fork, we ensure that the chosen chain represents not just the most work done (as in pure Proof-of-Work systems) but also the most economically significant chain. This makes it harder for an attacker to create a viable fork without also controlling a significant portion of the network's economic activity.
Depth-Based Verification: By verifying a chain of blocks (up to EC_VERIFICATION_DEPTH) rather than just the immediate parent, we increase the cost and difficulty of creating a malicious fork. An attacker would need to create a longer chain of valid blocks, each with sufficient difficulty and economic weight.
Duplicate Transaction Detection: The new process checks for duplicate transactions within a block, preventing a form of double-spending where the same transaction is included multiple times in a single block.
Public Key Verification: By verifying the public key for each transaction in a block, we add an extra layer of security against transaction forgery.
Flexible Timestamp Allowance: The use of AtConstants.averageBlockMinutes() allows the acceptable time difference to adjust based on network conditions, providing more flexibility while still preventing timestamp manipulation attacks.
These improvements collectively make the Signum blockchain more resistant to various forms of attack, including long-range attacks, economic attacks, and certain forms of transaction manipulation. They also ensure that the network converges on the most economically significant chain, which is a key goal of the Economic Clustering concept.
Backwards Compatibility
I believe this change is not backwards compatible and will most likely require a hard fork to implement. All nodes will need to upgrade to continue participating in the network post-fork.
Test Cases
Test cases should cover the following scenarios:
Verification of transactions with various timestamps
Calculation of economic weight for blocks with different transaction compositions
Fork choice in scenarios with varying difficulty and economic weight
Block validation with valid and invalid transaction sets
Reference Implementation
The reference implementation can be found in the EconomicClustering.java, BlockServiceImpl.java, and related files in the Signum node repository.
The text was updated successfully, but these errors were encountered:
sip: 51
title: Enhanced Economic Clustering Implementation
description: Improvements to the Economic Clustering algorithm for better fork resistance and chain security
author: gittrekt (@gittrekt)
discussions-to:
status: Draft
type: Standards Track
category: Core
created: 2024-10-15
requires: N/A
Abstract
This SIP proposes enhancements to the Economic Clustering (EC) algorithm in Signum to improve fork resistance and overall chain security. The changes include more robust verification of transaction timestamps, integration of economic weight in fork choice, and improved block validation processes.
Motivation
The current Economic Clustering implementation has some limitations in its ability to prevent certain types of attacks and ensure the selection of the most economically significant chain. This proposal aims to address these issues by incorporating more factors into the fork choice rule and improving the overall robustness of the EC algorithm.
Specification
The key changes to the Economic Clustering implementation are as follows:
Enhanced Transaction Timestamp Verification:
AtConstants.averageBlockMinutes()
to dynamically adjust the allowed time difference based on the current block height (Previously 15 seconds. Updated blockTime * 0.5 - May require changes here to just block time)Economic Weight Calculation:
calculateEconomicWeight()
in theBlockService
interface.Fork Choice Rule Enhancement:
Improved Block Validation:
Constants Adjustment:
EC_VERIFICATION_DEPTH
(10 blocks) to fine-tune the EC algorithm look-back behaviour.Rationale
These changes aim to make the Economic Clustering algorithm more resistant to various attack vectors, and add an ability for the main chain to better decide when to fork:
The new fork validation process provides several additional benefits:
Cumulative Difficulty and Economic Weight: By considering both the cumulative difficulty and the economic weight of a fork, we ensure that the chosen chain represents not just the most work done (as in pure Proof-of-Work systems) but also the most economically significant chain. This makes it harder for an attacker to create a viable fork without also controlling a significant portion of the network's economic activity.
Depth-Based Verification: By verifying a chain of blocks (up to EC_VERIFICATION_DEPTH) rather than just the immediate parent, we increase the cost and difficulty of creating a malicious fork. An attacker would need to create a longer chain of valid blocks, each with sufficient difficulty and economic weight.
Duplicate Transaction Detection: The new process checks for duplicate transactions within a block, preventing a form of double-spending where the same transaction is included multiple times in a single block.
Public Key Verification: By verifying the public key for each transaction in a block, we add an extra layer of security against transaction forgery.
Flexible Timestamp Allowance: The use of AtConstants.averageBlockMinutes() allows the acceptable time difference to adjust based on network conditions, providing more flexibility while still preventing timestamp manipulation attacks.
These improvements collectively make the Signum blockchain more resistant to various forms of attack, including long-range attacks, economic attacks, and certain forms of transaction manipulation. They also ensure that the network converges on the most economically significant chain, which is a key goal of the Economic Clustering concept.
Backwards Compatibility
I believe this change is not backwards compatible and will most likely require a hard fork to implement. All nodes will need to upgrade to continue participating in the network post-fork.
Test Cases
Test cases should cover the following scenarios:
Reference Implementation
The reference implementation can be found in the
EconomicClustering.java
,BlockServiceImpl.java
, and related files in the Signum node repository.The text was updated successfully, but these errors were encountered: