Secure Wallet Source Code
免责申明
本内容仅供参考,市场行情波动巨大。请根据自身情况合理操作,作者不承担由此产生的任何损失。
This article is produced by the https://itrade.icu Quantitative Trading Lab.
This project provides a secure crypto wallet creation and decryption tool, enabling users to generate their own blockchain wallets while ensuring encrypted storage of private keys and passwords.
Introduction
- Wallet Creation: The
create.jsscript allows users to generate a wallet, automatically creating an encrypted private key, decryption key, and wallet password. Supports random generation or custom passwords. - Wallet Decryption: The
unravel.jsscript enables secure decryption of the wallet file to view and use the private key. - Security Management: Offers multiple wallet backup and storage recommendations to prevent asset loss due to private key loss.
- Dependency Management: Supports dependency installation via
npm,pnpm, oryarn, making it easy to use.
This tool is suitable for personal use or learning about blockchain wallet encryption and decryption mechanisms. It emphasizes operational security, recommending decryption in an offline environment to ensure private key safety.
Encryption and Decryption
create.js: Encrypts the walletunravel.js: Decrypts the wallet
Dependency Installation
Choose your preferred method for downloading dependencies; pnpm is recommended.
npm install
pnpm install
yarn install2
3
Wallet Creation
Run the following command to create a wallet:
node create.jsTwo Optional Methods for Wallet Creation
- Create a wallet using a random password:
(base) loser@loserdeMacBook-Pro safe-wallet % node create.js
✔ Enter a custom KEY value, or input R for random creation. · r
✔ Enter a custom IV value, or input R for random creation. · r
✔ Enter a custom PASSWORD value, or input R for random creation. · r
{ key: 'sBIIY)R?(3b&', iv: 'D.Tw%<AOuYff', password: 'UL6GT4H+9q*6' }
Wallet created successfully: 0xC640DbfE7CE8B30497276BF72604f0A4b78A5d0B2
3
4
5
6
- Create a wallet using a custom password:
(base) loser@loserdeMacBook-Pro safe-wallet % node create.js
✔ Enter a custom KEY value, or input R for random creation. · 123123
✔ Enter a custom IV value, or input R for random creation. · 123123
✔ Enter a custom PASSWORD value, or input R for random creation. · 123123
{ key: '123123', iv: '123123', password: '123123' }
Wallet created successfully: 0x256823E8DD9EE91B4ac9C259B350C85244bF2c972
3
4
5
6
Verification After Creation
Upon successful creation, three files will be generated in the ./address directory: *.key.iv, *.password, and *.wallet, corresponding to the encrypted wallet private key, decryption key, and wallet password, respectively.
Security Recommendations
It is recommended to back up the wallet private key in multiple locations to prevent loss, as a lost private key cannot be recovered.
- Use Tencent Cloud OSS (3.9¥/5 years) for storage, or save in multiple locations to avoid loss.

- Store in cloud drives, such as Baidu Netdisk, Alibaba Cloud Disk, etc.
- Store on external hard drives, such as Western Digital, Kingston, etc.
- Security Reminder: Avoid relying on a single storage method. Instead, save copies in multiple locations to prevent asset loss due to a single point of failure.
Wallet Decryption
Run the following command to decrypt the wallet:
- Fill in the corresponding wallet details in
unravel.jsfor the relevant variables:
# Enter the corresponding file names based on the wallet's suffix
const key_iv = ""
const password = ""
const wallet = ""2
3
4
- Run the following command to decrypt the wallet:
node unravel.jsYou can then view your wallet.
Security Recommendations
- Install dependencies before running the decryption.
- Run the decryption process offline to prevent hackers from accessing your wallet private key.
- Copy the wallet private key in segments to avoid it being intercepted by hackers.
