Skip to content
Open
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
177 changes: 177 additions & 0 deletions nep-3-seconds.mediawiki
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
<NEP: xxx>
Title: Reduce Block Time and Gas Generation Rate
Author: Jimmy Liao <[email protected]>, Vitor Nazário Coelho <[email protected]>, Fernando Díaz Toledano <[email protected]>, Roman Khimov <[email protected]>, Christopher Schuchardt <[email protected]>
Type: Standard
Status: Draft
Created: 2025-02-11
Replaces: N/A
Hardfork: Echidna

==Abstract==

This NEP proposes two significant changes to the Neo N3 network parameters:
1. Reducing the block time from 15 seconds to 3 seconds
2. Reducing the GAS generation rate per block from 5 GAS to 1 GAS

==Motivation==

The primary motivations for these changes are:
1. Improve transaction throughput and user experience
2. Maintain a stable GAS/NEO ratio in the ecosystem
3. Better compete with other high-performance blockchain platforms

==Specification==

===Block Time Reduction===
* Current value: 15 seconds
* Proposed value: 3 seconds
* Implementation:
* Move block time configuration from dBFT plugin to Policy native contract
* Allow the council to configure block time through the Policy contract
* Consensus mechanism will read block time from the Policy contract

===GAS Generation Rate Reduction===
* Current value: 5 GAS per block
* Proposed value: 1 GAS per block
* Implementation:
* Retain the existing governance model where council controls GasPerBlock
* Council will need to adjust GasPerBlock separately after block time changes
* Coordination between the two changes will be managed through governance

===Policy Contract Enhancement===
* New native method: `SetBlockTime(BigInteger milliseconds)`
* Allows council to set block time through the Policy contract
* Parameters:
* `milliseconds`: The new block time in milliseconds

===Native Contract Interface===

The block time configuration method will be added to the <code>PolicyContract</code> native contract in hardfork <code>Echidna</code> with the following interface:

<pre>
{
"name": "setBlockTime",
"safe": false,
"parameters": [
{
"name": "milliseconds",
"type": "Integer"
}
],
"returntype": "Boolean"
}
</pre>

===Method Specification===

The <code>setBlockTime</code> method MUST follow these rules:

1. Permission Requirements:
* MUST only be callable by the Neo Council through a committee multi-signature transaction
* MUST fail if called by any other entity

2. Input Requirements:
* <code>milliseconds</code> MUST be a positive integer representing block time in milliseconds
* <code>milliseconds</code> MUST be greater than or equal to 1000 (1 second)

3. Behavior:
* MUST update the block time configuration
* MUST take effect immediately after the transaction is executed
* Consensus nodes MUST use the new block time for the next consensus round

4. Return Value:
* Returns true if the operation is successful
* Returns false if any validation fails

5. Effect on Contracts:
* Contract executions MUST adapt to the new block time for all time-related calculations
* The consensus mechanism MUST read the block time from the Policy contract for each consensus round

Copy link
Member

@superboyiii superboyiii Mar 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
===Events===
====SetBlockGenTime====
<pre>
{
"name": "SetBlockGenTime",
"parameters": [
{
"name": "milliseconds",
"type": "Integer"
}
]
}
</pre>

We'd better add an eventlog in the end of the method.

===Hardfork Activation===
* The hardfork will:
* Add the new `SetBlockTime` method to the Policy contract
* Move block time configuration from consensus settings to Policy contract
* Initially set the default block time to 15 seconds (current value)
* After hardfork activation, the council will:
* Call the new method to set the block time to 3 seconds
* Adjust the GasPerBlock value separately to 1 GAS
* Careful coordination will be needed to ensure economic balance

==Rationale==

The reduction in block time from 15 to 3 seconds will:
* Reduce transaction confirmation waiting times
* Improve DApp responsiveness and user experience
* Better compete with other high-performance blockchains

The reduction in GAS generation from 5 to 1 GAS per block will:
* Maintain economic balance despite increased block production
* Preserve the intended tokenomics of the Neo ecosystem
* Prevent potential GAS oversupply and value dilution

== Affected Configurations ==

* Block Time Configuration:
* Current: Hardcoded in consensus settings (MillisecondsPerBlock: 15000)
* Proposed: Configurable via Policy contract with initial value of 15000
* Target after council update: 3000 (3 seconds)
* MaxTransactionsPerBlock: 512 => 256
* GasPerBlock:
* Current: 5 GAS
* Proposed: Remains configurable by council via existing mechanisms
* Target after council update: 1 GAS
* MaxValidUntilBlockIncrement: 100 => 500

==Backwards Compatibility==

This change requires a hard fork as it modifies fundamental network parameters. All nodes must upgrade to maintain network consensus.

==Test Cases==

The following scenarios should be tested:
1. Network stability under 3-second block times
2. Transaction processing under high load
3. Node synchronization with faster blocks
4. GAS generation and distribution accuracy
5. Smart contract execution under new timing constraints

==Potential Issues and Mitigations==

1. Network Stability
* Issue: Faster block times may increase network overhead
* Mitigation: Implement improved network optimization and node requirements

2. Smart Contract Timing
* Issue: Some contracts may assume 15-second blocks
* Mitigation: Provide migration guidelines and testing framework

3. Network Synchronization
* Issue: Faster blocks may impact node sync speed
* Mitigation: Implement enhanced sync protocols

4. Governance Coordination
* Issue: Non-atomic updates between block time and GAS generation rate
* Mitigation: Careful governance coordination to adjust both settings in close succession

5. Contract Dependency on Block Time
* Issue: Contracts relying on block time for time-related calculations will be affected
* Mitigation: Documentation and tools to help developers update affected contracts

==Implementation==

The implementation requires modifications to:
1. Policy native contract to add the new `SetBlockTime` method
2. Consensus mechanism to read block time from Policy contract
3. Neo native contract to coordinate with the new timing system

A phased implementation approach is recommended:
1. TestNet deployment and testing (2 weeks)
2. MainNet deployment preparation (2 weeks)
3. Hard fork coordination and execution
4. Council governance actions after hardfork:
* Call `SetBlockTime(3000)` to set new block time
* Adjust GasPerBlock to 1 GAS using existing governance mechanisms

==Reference Implementation==

CSharp implementation: https://github.com/neo-project/neo/pull/3622