Repository navigation
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
- StatusShow more project fieldsDone
Activity
halibobo1205 commentedon Mar 26, 2026
Agree with removing
KeystoreFactoryfrom framework — it doesn't belong there.But moving it to plugins isn't that simple.
KeystoreFactory→WalletUtils→ crypto module → common module, which drags in libp2p, prometheus, aspectj, and a bunch of unrelated stuff. PlusWalletUtilscallsArgs.getInstance(), pulling in Spring as well. Toolkit.jar would get significantly bloated, which kind of defeats the purpose.Also worth noting that removing
KeystoreFactoryfrom theframeworkwould barely reduce the size of FullNode.jar — it's just one small class, and all its dependencies (WalletUtils, crypto, common, etc.) are already used by the node itself. So there's no real packaging benefit on the framework side either.Since this is a breaking change anyway, why not just remove
KeystoreFactoryand point users to wallet-cli? It already covers keystore generation and private key import. Framework gets cleaned up, Toolkit stays lean.Federico2014 commentedon Mar 26, 2026
@halibobo1205 , thank you very much for your suggestion.
I’ve tried this migration: the
keystorecan be moved from theframeworkmodule to thecryptomodule, and plugins only need to add a dependency on thecryptomodule. Unnecessary modules such as libp2p, prometheus, and aspectj can also be excluded:After completing the migration, the Toolkit.jar size increased from 49 MB to 56 MB, which is not a significant increase. Completely removing
KeystoreFactoryfromjava-tronis also an option worth considering.lxcmyf commentedon Mar 26, 2026
@Federico2014
Will the old FullNode.jar --keystore-factory entry be kept for a transition period, or will it be removed immediately once this feature is merged?
Since some existing scripts or operational tools may already depend on the old invocation method, an abrupt CLI change could break automation.
Federico2014 commentedon Mar 26, 2026
@lxcmyf The current implementation removes
java -jar FullNode.jar --keystore-factoryimmediately. If this causes any negative impact, we could consider introducing a transition period.Alternatively, could we identify which scripts and operational tools depend on the old CLI usage and update them all accordingly?
lxcmyf commentedon Apr 7, 2026
@Federico2014
Thanks for the clarification.
Some scripts depending on
--keystore-factorymay not only exist internally — users may also rely on this CLI entry in their own automation. If it is removed immediately, they might only notice after upgrading.Providing a short transition path (e.g., deprecation notice or temporary compatibility) could make the migration clearer for external users.
Federico2014 commentedon Apr 14, 2026
@lxcmyf Good point. In #6637, the
--keystore-factoryflag is preserved with a transition period:java -jar FullNode.jar --keystore-factorycontinues to work as beforeToolkit.jar keystorehelpcommand also shows the new invocation methodSo existing scripts and automation will not break on upgrade — users will see a clear notice and can migrate at their own pace before the flag is removed in a future release.