Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
19 changes: 19 additions & 0 deletions scripts/ton_wallet_generator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generate TON wallet

This is a typescript that generates a TON wallets and prints the mnemonic, secret and address to the console.
Copy link

Copilot AI Jan 30, 2026

Choose a reason for hiding this comment

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

Corrected grammar: 'a typescript' should be 'a TypeScript script' and 'a TON wallets' should be 'TON wallets'.

Suggested change
This is a typescript that generates a TON wallets and prints the mnemonic, secret and address to the console.
This is a TypeScript script that generates TON wallets and prints the mnemonic, secret and address to the console.

Copilot uses AI. Check for mistakes.
## Usage

```bash
npm install

npm run generate
```
## Examples

```bash
Mnemonic: unfair capable drastic increase bonus pledge ridge blue cube over fine daring frozen shrimp seat universe outside pen injury dumb enact artwork ship insane
Wallet Secret Key: 56cc895313f7abba1f2c6cd36d42e8737ced6138cba80f4381008a055ba9c30b135e61a6c3397e01ddf96af08d7a8f18eff8efcfc7a9ba5f7f05ce69f04a34ad
Public Key: 135e61a6c3397e01ddf96af08d7a8f18eff8efcfc7a9ba5f7f05ce69f04a34ad
Wallet v4 Address: EQDpKqfyCfFAmAtv7ihG2awG9psdAz1t-eFvi7gUJ13Z1GBY
Wallet v5 Address: EQByKwFuc1AFjCAWdGay-kLzoOmqsg0qaX44wU3FENX6PT2n
Comment on lines +14 to +18
Copy link

Copilot AI Jan 30, 2026

Choose a reason for hiding this comment

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

The example output contains sensitive cryptographic material (mnemonic and secret key). While these may be test values, including them in documentation could set a dangerous precedent. Consider using placeholder text or adding a prominent warning that these are example values only.

Suggested change
Mnemonic: unfair capable drastic increase bonus pledge ridge blue cube over fine daring frozen shrimp seat universe outside pen injury dumb enact artwork ship insane
Wallet Secret Key: 56cc895313f7abba1f2c6cd36d42e8737ced6138cba80f4381008a055ba9c30b135e61a6c3397e01ddf96af08d7a8f18eff8efcfc7a9ba5f7f05ce69f04a34ad
Public Key: 135e61a6c3397e01ddf96af08d7a8f18eff8efcfc7a9ba5f7f05ce69f04a34ad
Wallet v4 Address: EQDpKqfyCfFAmAtv7ihG2awG9psdAz1t-eFvi7gUJ13Z1GBY
Wallet v5 Address: EQByKwFuc1AFjCAWdGay-kLzoOmqsg0qaX44wU3FENX6PT2n
# Example output (values below are placeholders; never share your real mnemonic or keys)
Mnemonic: <your 24-word mnemonic phrase here>
Wallet Secret Key: <your wallet secret key here>
Public Key: <your public key here>
Wallet v4 Address: <your wallet v4 address here>
Wallet v5 Address: <your wallet v5 address here>

Copilot uses AI. Check for mistakes.
```
22 changes: 22 additions & 0 deletions scripts/ton_wallet_generator/generate-wallet.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// generate-wallet.ts
import { mnemonicNew, mnemonicToWalletKey } from "@ton/crypto";
import { WalletContractV4, WalletContractV5R1} from "@ton/ton";

async function main() {
const mnemonic = await mnemonicNew();
console.log("Mnemonic:", mnemonic.join(" "));

const key = await mnemonicToWalletKey(mnemonic);
const walletv4 = WalletContractV4.create({ workchain: 0, publicKey: key.publicKey });
const walletv5 = WalletContractV5R1.create({ workchain: 0, publicKey: key.publicKey });

console.log("Wallet Secret Key:", key.secretKey.toString("hex")); // Are we storing the hex in secrets manager?
Copy link

Copilot AI Jan 30, 2026

Choose a reason for hiding this comment

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

Logging secret keys to the console poses a security risk, as they may be captured in logs or terminal history. Consider implementing secure storage directly or adding a clear warning that this output should be handled securely and never committed to version control.

Suggested change
console.log("Wallet Secret Key:", key.secretKey.toString("hex")); // Are we storing the hex in secrets manager?
console.log("Wallet Secret Key generated. Handle and store it securely; it is not printed to the console.");

Copilot uses AI. Check for mistakes.
console.log("Public Key:", key.publicKey.toString("hex")); // Ask security to share this
console.log("Wallet v4 Address:", walletv4.address.toString({ bounceable: true }));
console.log("Wallet v5 Address:", walletv5.address.toString({ bounceable: true }));
}

main().catch((error) => {
console.error("Error:", error);
process.exit(1);
});
17 changes: 17 additions & 0 deletions scripts/ton_wallet_generator/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "ton-wallet-generator",
"version": "1.0.0",
"description": "Generate TON wallet addresses",
"main": "generate-wallet.ts",
"scripts": {
"generate": "npx ts-node generate-wallet.ts"
},
"dependencies": {
"@ton/crypto": "^3.3.0",
"@ton/ton": "^15.0.0"
},
"devDependencies": {
"ts-node": "^10.9.2",
"typescript": "^5.3.3"
}
}
14 changes: 14 additions & 0 deletions scripts/ton_wallet_generator/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"compilerOptions": {
"target": "ES2020",
"module": "commonjs",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"outDir": "./dist",
"resolveJsonModule": true
},
"include": ["*.ts"],
"exclude": ["node_modules"]
}
Loading