-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
Background
KeystoreFactory is a standalone command-line utility for generating wallet keystores and importing private keys, invoked via the --keystore-factory CLI flag from FullNode.jar.
The plugins module already contains several similar standalone tools:
ArchiveManifest- Archive manifest tool (main entry point)Toolkit- General purpose utilities, includingDbConvert,DbLite,DbCopy,DbMove,DbRoot, etc.
Problem Statement
KeystoreFactory is functionally a standalone utility tool, not core framework logic. Its current placement in the framework module:
- Blurs module boundaries:
frameworkshould contain core node logic, whilepluginshouses standalone tools - Increases framework coupling:
KeystoreFactoryhas no dependencies on framework-specific code beyond common modules - Inconsistent organization: Similar standalone tools already exist in
plugins
Rationale
Why should this feature exist?
Moving KeystoreFactory to plugins would:
- Improve code organization by grouping all standalone tools together
- Reduce framework module size
- Make the plugin module's purpose clearer as the home for auxiliary tools
- Follow the existing pattern of similar utilities
What are the use cases?
- Developers building custom tools: Clearer module structure makes it easier to understand where new tools should be placed
- Build optimization: Plugin tools can be built and distributed independently
- Code maintenance: Easier to locate and maintain standalone utilities
Who would benefit from this feature?
- Core developers maintaining the java-tron codebase
- Users who need keystore generation tools (clearer separation of concerns)
Proposed Solution
Move KeystoreFactory to plugins module as a subcommand of Toolkit
Following the existing pattern where db is a subcommand of Toolkit, KeystoreFactory should be added as another subcommand.
Source: framework/src/main/java/org/tron/program/KeystoreFactory.java
Destination: plugins/src/main/java/common/org/tron/plugins/KeystoreFactory.java
Specification
Changes Required:
- Move the class: Relocate
KeystoreFactory.javatoplugins/src/main/java/common/ - Update package: Change package from
org.tron.programtoorg.tron.plugins - Refactor to picocli: Add picocli annotations to support being a
Toolkitsubcommand (likeDbLite) - Register with Toolkit: Add
KeystoreFactoryas a subcommand inToolkit.java - Remove CLI flag: Remove
--keystore-factoryfromCLIParameter.javaandFullNode.java - Update documentation: Update user docs to reflect new invocation method
API Changes
Breaking Change: The --keystore-factory CLI flag will be removed from FullNode.jar.
New invocation method:
# Old method (no longer works after this change)
java -jar FullNode.jar --keystore-factory
# New method (as a Toolkit subcommand)
java -jar Toolkit.jar keystore-factoryScope of Impact
- Documentation
- Build system / Module structure
Backward Compatibility
- CLI interface changes - users need to update their invocation method
- No impact on keystore file format or functionality
Implementation
Do you have ideas regarding the implementation?
Yes, the implementation follows the existing DbLite subcommand pattern.
Are you willing to implement this feature?
- Yes, I can implement this feature
Metadata
Metadata
Assignees
Labels
Type
Projects
Status