jaelis-node 1.9.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +147 -433
- package/bin/jaelis-node.js +79 -504
- package/lib/index.js +31 -2740
- package/lib/node.js +271 -0
- package/lib/rpc.js +315 -0
- package/lib/storage.js +198 -0
- package/lib/sync.js +366 -0
- package/package.json +19 -53
- package/config/default.json +0 -74
- package/config/mainnet.json +0 -30
- package/config/testnet.json +0 -26
- package/lib/JAELIS-VM/lib/adapters/evm-adapter.js +0 -454
- package/lib/JAELIS-VM/lib/adapters/index.js +0 -411
- package/lib/JAELIS-VM/lib/adapters/svm-adapter.js +0 -457
- package/lib/JAELIS-VM/lib/compiler/jir-compiler.js +0 -1097
- package/lib/JAELIS-VM/lib/execution/engine.js +0 -1183
- package/lib/JAELIS-VM/lib/index.js +0 -440
- package/lib/JAELIS-VM/lib/integration/jaelis-integration.js +0 -543
- package/lib/JAELIS-VM/lib/serialization/serializer.js +0 -819
- package/lib/JAELIS-VM/lib/state/state-manager.js +0 -1116
- package/lib/JAELIS-VM/lib/translator/bytecode-translator.js +0 -1222
- package/lib/JAELIS-VM/lib/unified/cross-chain-deploy.js +0 -1678
- package/lib/JAELIS-VM/lib/unified/cross-chain-state.js +0 -836
- package/lib/JAELIS-VM/lib/unified/dynamic-contracts.js +0 -1127
- package/lib/JAELIS-VM/lib/unified/index.js +0 -456
- package/lib/JAELIS-VM/lib/unified/jaelis-abi.js +0 -1150
- package/lib/JAELIS-VM/lib/unified/unified-compiler.js +0 -1350
- package/lib/JAELIS-VM/node_modules/.bin/download-cbor-prebuilds +0 -12
- package/lib/JAELIS-VM/node_modules/.bin/download-cbor-prebuilds.cmd +0 -17
- package/lib/JAELIS-VM/node_modules/.bin/download-cbor-prebuilds.ps1 +0 -28
- package/lib/JAELIS-VM/node_modules/.bin/download-msgpackr-prebuilds +0 -12
- package/lib/JAELIS-VM/node_modules/.bin/download-msgpackr-prebuilds.cmd +0 -17
- package/lib/JAELIS-VM/node_modules/.bin/download-msgpackr-prebuilds.ps1 +0 -28
- package/lib/JAELIS-VM/node_modules/.bin/node-gyp-build-optional-packages +0 -12
- package/lib/JAELIS-VM/node_modules/.bin/node-gyp-build-optional-packages-optional +0 -12
- package/lib/JAELIS-VM/node_modules/.bin/node-gyp-build-optional-packages-optional.cmd +0 -17
- package/lib/JAELIS-VM/node_modules/.bin/node-gyp-build-optional-packages-optional.ps1 +0 -28
- package/lib/JAELIS-VM/node_modules/.bin/node-gyp-build-optional-packages-test +0 -12
- package/lib/JAELIS-VM/node_modules/.bin/node-gyp-build-optional-packages-test.cmd +0 -17
- package/lib/JAELIS-VM/node_modules/.bin/node-gyp-build-optional-packages-test.ps1 +0 -28
- package/lib/JAELIS-VM/node_modules/.bin/node-gyp-build-optional-packages.cmd +0 -17
- package/lib/JAELIS-VM/node_modules/.bin/node-gyp-build-optional-packages.ps1 +0 -28
- package/lib/JAELIS-VM/node_modules/.package-lock.json +0 -127
- package/lib/JAELIS-VM/node_modules/@cbor-extract/cbor-extract-win32-x64/README.md +0 -1
- package/lib/JAELIS-VM/node_modules/@cbor-extract/cbor-extract-win32-x64/index.js +0 -0
- package/lib/JAELIS-VM/node_modules/@cbor-extract/cbor-extract-win32-x64/node.abi115.node +0 -0
- package/lib/JAELIS-VM/node_modules/@cbor-extract/cbor-extract-win32-x64/node.napi.node +0 -0
- package/lib/JAELIS-VM/node_modules/@cbor-extract/cbor-extract-win32-x64/package.json +0 -17
- package/lib/JAELIS-VM/node_modules/@msgpackr-extract/msgpackr-extract-win32-x64/README.md +0 -1
- package/lib/JAELIS-VM/node_modules/@msgpackr-extract/msgpackr-extract-win32-x64/index.js +0 -0
- package/lib/JAELIS-VM/node_modules/@msgpackr-extract/msgpackr-extract-win32-x64/node.abi115.node +0 -0
- package/lib/JAELIS-VM/node_modules/@msgpackr-extract/msgpackr-extract-win32-x64/node.napi.node +0 -0
- package/lib/JAELIS-VM/node_modules/@msgpackr-extract/msgpackr-extract-win32-x64/package.json +0 -17
- package/lib/JAELIS-VM/node_modules/cbor-extract/LICENSE +0 -21
- package/lib/JAELIS-VM/node_modules/cbor-extract/README.md +0 -5
- package/lib/JAELIS-VM/node_modules/cbor-extract/bin/download-prebuilds.js +0 -11
- package/lib/JAELIS-VM/node_modules/cbor-extract/binding.gyp +0 -60
- package/lib/JAELIS-VM/node_modules/cbor-extract/index.js +0 -1
- package/lib/JAELIS-VM/node_modules/cbor-extract/package.json +0 -50
- package/lib/JAELIS-VM/node_modules/cbor-extract/src/extract.cpp +0 -198
- package/lib/JAELIS-VM/node_modules/cbor-x/LICENSE +0 -21
- package/lib/JAELIS-VM/node_modules/cbor-x/README.md +0 -380
- package/lib/JAELIS-VM/node_modules/cbor-x/SECURITY.md +0 -11
- package/lib/JAELIS-VM/node_modules/cbor-x/benchmark.md +0 -73
- package/lib/JAELIS-VM/node_modules/cbor-x/browser.js +0 -11
- package/lib/JAELIS-VM/node_modules/cbor-x/decode.d.ts +0 -2
- package/lib/JAELIS-VM/node_modules/cbor-x/decode.js +0 -1300
- package/lib/JAELIS-VM/node_modules/cbor-x/dist/decode-no-eval.cjs +0 -1244
- package/lib/JAELIS-VM/node_modules/cbor-x/dist/decode-no-eval.cjs.map +0 -1
- package/lib/JAELIS-VM/node_modules/cbor-x/dist/index-no-eval.cjs +0 -2509
- package/lib/JAELIS-VM/node_modules/cbor-x/dist/index-no-eval.cjs.map +0 -1
- package/lib/JAELIS-VM/node_modules/cbor-x/dist/index-no-eval.min.js +0 -2
- package/lib/JAELIS-VM/node_modules/cbor-x/dist/index-no-eval.min.js.map +0 -1
- package/lib/JAELIS-VM/node_modules/cbor-x/dist/index.js +0 -2508
- package/lib/JAELIS-VM/node_modules/cbor-x/dist/index.js.map +0 -1
- package/lib/JAELIS-VM/node_modules/cbor-x/dist/index.min.js +0 -2
- package/lib/JAELIS-VM/node_modules/cbor-x/dist/index.min.js.map +0 -1
- package/lib/JAELIS-VM/node_modules/cbor-x/dist/node.cjs +0 -2629
- package/lib/JAELIS-VM/node_modules/cbor-x/dist/node.cjs.map +0 -1
- package/lib/JAELIS-VM/node_modules/cbor-x/dist/test.js +0 -3343
- package/lib/JAELIS-VM/node_modules/cbor-x/dist/test.js.map +0 -1
- package/lib/JAELIS-VM/node_modules/cbor-x/encode.d.ts +0 -1
- package/lib/JAELIS-VM/node_modules/cbor-x/encode.js +0 -1231
- package/lib/JAELIS-VM/node_modules/cbor-x/index.d.ts +0 -79
- package/lib/JAELIS-VM/node_modules/cbor-x/index.js +0 -3
- package/lib/JAELIS-VM/node_modules/cbor-x/iterators.js +0 -85
- package/lib/JAELIS-VM/node_modules/cbor-x/node-index.js +0 -24
- package/lib/JAELIS-VM/node_modules/cbor-x/package.json +0 -94
- package/lib/JAELIS-VM/node_modules/cbor-x/rollup.config.js +0 -88
- package/lib/JAELIS-VM/node_modules/cbor-x/stream.js +0 -61
- package/lib/JAELIS-VM/node_modules/cbor-x/webpack.config.js +0 -19
- package/lib/JAELIS-VM/node_modules/detect-libc/LICENSE +0 -201
- package/lib/JAELIS-VM/node_modules/detect-libc/README.md +0 -163
- package/lib/JAELIS-VM/node_modules/detect-libc/index.d.ts +0 -14
- package/lib/JAELIS-VM/node_modules/detect-libc/lib/detect-libc.js +0 -313
- package/lib/JAELIS-VM/node_modules/detect-libc/lib/elf.js +0 -39
- package/lib/JAELIS-VM/node_modules/detect-libc/lib/filesystem.js +0 -51
- package/lib/JAELIS-VM/node_modules/detect-libc/lib/process.js +0 -24
- package/lib/JAELIS-VM/node_modules/detect-libc/package.json +0 -44
- package/lib/JAELIS-VM/node_modules/msgpackr/LICENSE +0 -21
- package/lib/JAELIS-VM/node_modules/msgpackr/README.md +0 -372
- package/lib/JAELIS-VM/node_modules/msgpackr/SECURITY.md +0 -11
- package/lib/JAELIS-VM/node_modules/msgpackr/benchmark.md +0 -67
- package/lib/JAELIS-VM/node_modules/msgpackr/dist/index-no-eval.cjs +0 -2407
- package/lib/JAELIS-VM/node_modules/msgpackr/dist/index-no-eval.cjs.map +0 -1
- package/lib/JAELIS-VM/node_modules/msgpackr/dist/index-no-eval.min.js +0 -2
- package/lib/JAELIS-VM/node_modules/msgpackr/dist/index-no-eval.min.js.map +0 -1
- package/lib/JAELIS-VM/node_modules/msgpackr/dist/index.js +0 -2406
- package/lib/JAELIS-VM/node_modules/msgpackr/dist/index.js.map +0 -1
- package/lib/JAELIS-VM/node_modules/msgpackr/dist/index.min.js +0 -2
- package/lib/JAELIS-VM/node_modules/msgpackr/dist/index.min.js.map +0 -1
- package/lib/JAELIS-VM/node_modules/msgpackr/dist/node.cjs +0 -3320
- package/lib/JAELIS-VM/node_modules/msgpackr/dist/node.cjs.map +0 -1
- package/lib/JAELIS-VM/node_modules/msgpackr/dist/test.js +0 -4540
- package/lib/JAELIS-VM/node_modules/msgpackr/dist/test.js.map +0 -1
- package/lib/JAELIS-VM/node_modules/msgpackr/dist/unpack-no-eval.cjs +0 -1250
- package/lib/JAELIS-VM/node_modules/msgpackr/dist/unpack-no-eval.cjs.map +0 -1
- package/lib/JAELIS-VM/node_modules/msgpackr/index.d.cts +0 -91
- package/lib/JAELIS-VM/node_modules/msgpackr/index.d.ts +0 -91
- package/lib/JAELIS-VM/node_modules/msgpackr/index.js +0 -5
- package/lib/JAELIS-VM/node_modules/msgpackr/iterators.js +0 -87
- package/lib/JAELIS-VM/node_modules/msgpackr/node-index.js +0 -25
- package/lib/JAELIS-VM/node_modules/msgpackr/pack.d.cts +0 -1
- package/lib/JAELIS-VM/node_modules/msgpackr/pack.d.ts +0 -1
- package/lib/JAELIS-VM/node_modules/msgpackr/pack.js +0 -1141
- package/lib/JAELIS-VM/node_modules/msgpackr/package.json +0 -104
- package/lib/JAELIS-VM/node_modules/msgpackr/rollup.config.js +0 -88
- package/lib/JAELIS-VM/node_modules/msgpackr/stream.js +0 -57
- package/lib/JAELIS-VM/node_modules/msgpackr/struct.js +0 -815
- package/lib/JAELIS-VM/node_modules/msgpackr/test-worker.js +0 -3
- package/lib/JAELIS-VM/node_modules/msgpackr/unpack.d.cts +0 -2
- package/lib/JAELIS-VM/node_modules/msgpackr/unpack.d.ts +0 -2
- package/lib/JAELIS-VM/node_modules/msgpackr/unpack.js +0 -1221
- package/lib/JAELIS-VM/node_modules/msgpackr-extract/LICENSE +0 -21
- package/lib/JAELIS-VM/node_modules/msgpackr-extract/README.md +0 -5
- package/lib/JAELIS-VM/node_modules/msgpackr-extract/bin/download-prebuilds.js +0 -13
- package/lib/JAELIS-VM/node_modules/msgpackr-extract/binding.gyp +0 -63
- package/lib/JAELIS-VM/node_modules/msgpackr-extract/index.js +0 -1
- package/lib/JAELIS-VM/node_modules/msgpackr-extract/node_modules/.bin/node-gyp-build-optional-packages +0 -12
- package/lib/JAELIS-VM/node_modules/msgpackr-extract/node_modules/.bin/node-gyp-build-optional-packages-optional +0 -12
- package/lib/JAELIS-VM/node_modules/msgpackr-extract/node_modules/.bin/node-gyp-build-optional-packages-optional.cmd +0 -17
- package/lib/JAELIS-VM/node_modules/msgpackr-extract/node_modules/.bin/node-gyp-build-optional-packages-optional.ps1 +0 -28
- package/lib/JAELIS-VM/node_modules/msgpackr-extract/node_modules/.bin/node-gyp-build-optional-packages-test +0 -12
- package/lib/JAELIS-VM/node_modules/msgpackr-extract/node_modules/.bin/node-gyp-build-optional-packages-test.cmd +0 -17
- package/lib/JAELIS-VM/node_modules/msgpackr-extract/node_modules/.bin/node-gyp-build-optional-packages-test.ps1 +0 -28
- package/lib/JAELIS-VM/node_modules/msgpackr-extract/node_modules/.bin/node-gyp-build-optional-packages.cmd +0 -17
- package/lib/JAELIS-VM/node_modules/msgpackr-extract/node_modules/.bin/node-gyp-build-optional-packages.ps1 +0 -28
- package/lib/JAELIS-VM/node_modules/msgpackr-extract/node_modules/node-gyp-build-optional-packages/LICENSE +0 -21
- package/lib/JAELIS-VM/node_modules/msgpackr-extract/node_modules/node-gyp-build-optional-packages/README.md +0 -58
- package/lib/JAELIS-VM/node_modules/msgpackr-extract/node_modules/node-gyp-build-optional-packages/bin.js +0 -82
- package/lib/JAELIS-VM/node_modules/msgpackr-extract/node_modules/node-gyp-build-optional-packages/build-test.js +0 -19
- package/lib/JAELIS-VM/node_modules/msgpackr-extract/node_modules/node-gyp-build-optional-packages/index.js +0 -6
- package/lib/JAELIS-VM/node_modules/msgpackr-extract/node_modules/node-gyp-build-optional-packages/node-gyp-build.js +0 -236
- package/lib/JAELIS-VM/node_modules/msgpackr-extract/node_modules/node-gyp-build-optional-packages/optional.js +0 -7
- package/lib/JAELIS-VM/node_modules/msgpackr-extract/node_modules/node-gyp-build-optional-packages/package.json +0 -32
- package/lib/JAELIS-VM/node_modules/msgpackr-extract/package.json +0 -50
- package/lib/JAELIS-VM/node_modules/msgpackr-extract/src/extract.cpp +0 -274
- package/lib/JAELIS-VM/node_modules/node-gyp-build-optional-packages/LICENSE +0 -21
- package/lib/JAELIS-VM/node_modules/node-gyp-build-optional-packages/README.md +0 -58
- package/lib/JAELIS-VM/node_modules/node-gyp-build-optional-packages/bin.js +0 -77
- package/lib/JAELIS-VM/node_modules/node-gyp-build-optional-packages/build-test.js +0 -19
- package/lib/JAELIS-VM/node_modules/node-gyp-build-optional-packages/index.js +0 -224
- package/lib/JAELIS-VM/node_modules/node-gyp-build-optional-packages/optional.js +0 -7
- package/lib/JAELIS-VM/node_modules/node-gyp-build-optional-packages/package.json +0 -32
- package/lib/JAELIS-VM/package-lock.json +0 -284
- package/lib/JAELIS-VM/package.json +0 -38
- package/lib/JAELIS-VM/test/comprehensive.test.js +0 -267
- package/lib/JAELIS-VM/test/cross-chain-test.js +0 -470
- package/lib/JAELIS-VM/test/unified-vm-test.js +0 -459
- package/lib/JAELIS-VM/test/unified.test.js +0 -166
- package/lib/JAELIS-VM/test/vm.test.js +0 -599
- package/lib/settlement-server.js +0 -999
- package/lib/vm/index.js +0 -397
package/bin/jaelis-node.js
CHANGED
|
@@ -1,529 +1,104 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* JAELIS Node CLI
|
|
5
|
-
*
|
|
4
|
+
* JAELIS External Node CLI
|
|
5
|
+
*
|
|
6
|
+
* Run a local JAELIS node that syncs with the network.
|
|
6
7
|
*
|
|
7
8
|
* Usage:
|
|
8
|
-
* jaelis-node
|
|
9
|
-
* jaelis-node
|
|
10
|
-
* jaelis-node
|
|
11
|
-
* jaelis-node
|
|
12
|
-
* jaelis-node peers
|
|
9
|
+
* jaelis-node # Start on testnet (default)
|
|
10
|
+
* jaelis-node --network mainnet # Start on mainnet
|
|
11
|
+
* jaelis-node --port 8546 # Custom RPC port
|
|
12
|
+
* jaelis-node --data-dir ./mydata # Custom data directory
|
|
13
13
|
*
|
|
14
|
-
* @version
|
|
15
|
-
* @author JAELIS Foundation
|
|
14
|
+
* @version 2.0.0
|
|
16
15
|
*/
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
const chalk = require('chalk');
|
|
20
|
-
const ora = require('ora');
|
|
21
|
-
const path = require('path');
|
|
22
|
-
const fs = require('fs');
|
|
23
|
-
|
|
24
|
-
// Version from package.json
|
|
25
|
-
const { version } = require('../package.json');
|
|
17
|
+
'use strict';
|
|
26
18
|
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
██╗ █████╗ ███████╗██╗ ██╗███████╗
|
|
30
|
-
██║██╔══██╗██╔════╝██║ ██║██╔════╝
|
|
31
|
-
██║███████║█████╗ ██║ ██║███████╗
|
|
32
|
-
██ ██║██╔══██║██╔══╝ ██║ ██║╚════██║
|
|
33
|
-
╚█████╔╝██║ ██║███████╗███████╗██║███████║
|
|
34
|
-
╚════╝ ╚═╝ ╚═╝╚══════╝╚══════╝╚═╝╚══════╝
|
|
35
|
-
NODE v${version}
|
|
36
|
-
`;
|
|
19
|
+
const { Command } = require('commander');
|
|
20
|
+
const { JaelisNode } = require('../lib/node');
|
|
37
21
|
|
|
38
|
-
//
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
// IMPORTANT: libp2p requires peer ID for direct dialing!
|
|
42
|
-
// Format: /dns4/rpc.jaelis.io/tcp/30304/p2p/12D3KooW...
|
|
43
|
-
//
|
|
44
|
-
// How it works (like Ethereum):
|
|
45
|
-
// 1. Main node generates persistent peer ID on first run
|
|
46
|
-
// 2. Peer ID is saved to disk (jaelis-data/peer-id.json)
|
|
47
|
-
// 3. Main node logs bootstrap multiaddr on startup
|
|
48
|
-
// 4. Update bootstrapNodes here with that multiaddr
|
|
49
|
-
//
|
|
50
|
-
// If no bootstrap nodes configured, RPC fallback sync is used automatically
|
|
51
|
-
const NETWORKS = {
|
|
52
|
-
testnet: {
|
|
53
|
-
chainId: 4545,
|
|
54
|
-
name: 'JAELIS Testnet',
|
|
55
|
-
symbol: 'tJAELIS',
|
|
56
|
-
rpcUrl: 'https://rpc.jaelis.io',
|
|
57
|
-
// Testnet P2P port: 30304 (mainnet: 30303)
|
|
58
|
-
// Bootstrap nodes will be added once main node generates peer ID
|
|
59
|
-
// Until then, nodes sync via RPC fallback (works perfectly)
|
|
60
|
-
bootstrapNodes: [
|
|
61
|
-
// Will be: '/dns4/rpc.jaelis.io/tcp/30304/p2p/PEER_ID'
|
|
62
|
-
]
|
|
63
|
-
},
|
|
64
|
-
mainnet: {
|
|
65
|
-
chainId: 4547,
|
|
66
|
-
name: 'JAELIS Mainnet',
|
|
67
|
-
symbol: 'JAELIS',
|
|
68
|
-
rpcUrl: 'https://mainnet.jaelis.io',
|
|
69
|
-
bootstrapNodes: [] // Coming soon
|
|
70
|
-
}
|
|
71
|
-
};
|
|
22
|
+
// Version check - notify if update available
|
|
23
|
+
const VERSION = '2.0.0';
|
|
24
|
+
checkForUpdates();
|
|
72
25
|
|
|
73
|
-
//
|
|
26
|
+
// CLI setup
|
|
74
27
|
const program = new Command();
|
|
75
28
|
|
|
76
29
|
program
|
|
77
30
|
.name('jaelis-node')
|
|
78
|
-
.description('
|
|
79
|
-
.version(
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
.
|
|
84
|
-
.
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
console.log(chalk.green('Starting JAELIS Node...'));
|
|
96
|
-
console.log();
|
|
97
|
-
|
|
98
|
-
const network = NETWORKS[options.network];
|
|
99
|
-
if (!network) {
|
|
100
|
-
console.error(chalk.red(`Unknown network: ${options.network}`));
|
|
101
|
-
process.exit(1);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
console.log(chalk.white('Configuration:'));
|
|
105
|
-
console.log(chalk.gray(` Network: ${network.name} (Chain ID: ${network.chainId})`));
|
|
106
|
-
console.log(chalk.gray(` Symbol: ${network.symbol}`));
|
|
107
|
-
console.log(chalk.gray(` RPC Port: ${options.rpc ? options.rpcPort : 'disabled'}`));
|
|
108
|
-
console.log(chalk.gray(` P2P Port: ${options.p2pPort}`));
|
|
109
|
-
console.log(chalk.gray(` Data Dir: ${options.dataDir}`));
|
|
110
|
-
console.log(chalk.gray(` Sync Mode: ${options.syncMode}`));
|
|
111
|
-
if (options.rewardRecipient) {
|
|
112
|
-
console.log(chalk.gray(` Rewards To: ${options.rewardRecipient}`));
|
|
113
|
-
}
|
|
114
|
-
console.log();
|
|
115
|
-
|
|
116
|
-
const spinner = ora('Initializing node...').start();
|
|
117
|
-
|
|
118
|
-
try {
|
|
119
|
-
// Import and start the node
|
|
120
|
-
const { JaelisNode } = require('../lib/index.js');
|
|
121
|
-
|
|
122
|
-
const node = new JaelisNode({
|
|
123
|
-
network: options.network,
|
|
124
|
-
chainId: network.chainId,
|
|
125
|
-
rpcPort: parseInt(options.rpcPort),
|
|
126
|
-
rpcHost: options.rpcHost,
|
|
127
|
-
p2pPort: parseInt(options.p2pPort),
|
|
128
|
-
dataDir: options.dataDir,
|
|
129
|
-
syncMode: options.syncMode,
|
|
130
|
-
enableRpc: options.rpc,
|
|
131
|
-
bootstrapNodes: network.bootstrapNodes,
|
|
132
|
-
rewardRecipient: options.rewardRecipient // Like Geth's --suggested-fee-recipient
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
spinner.text = 'Connecting to network...';
|
|
136
|
-
await node.start();
|
|
137
|
-
|
|
138
|
-
spinner.succeed(chalk.green('Node started successfully!'));
|
|
139
|
-
console.log();
|
|
140
|
-
console.log(chalk.cyan('═══════════════════════════════════════════════════'));
|
|
141
|
-
console.log(chalk.white(` RPC Endpoint: http://${options.rpcHost}:${options.rpcPort}`));
|
|
142
|
-
console.log(chalk.white(` P2P Endpoint: 0.0.0.0:${options.p2pPort}`));
|
|
143
|
-
console.log(chalk.white(` Network: ${network.name}`));
|
|
144
|
-
console.log(chalk.cyan('═══════════════════════════════════════════════════'));
|
|
145
|
-
console.log();
|
|
146
|
-
console.log(chalk.gray('Press Ctrl+C to stop the node'));
|
|
147
|
-
|
|
148
|
-
// Handle shutdown
|
|
149
|
-
process.on('SIGINT', async () => {
|
|
150
|
-
console.log();
|
|
151
|
-
spinner.start('Shutting down node...');
|
|
152
|
-
await node.stop();
|
|
153
|
-
spinner.succeed('Node stopped gracefully');
|
|
154
|
-
process.exit(0);
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
} catch (error) {
|
|
158
|
-
spinner.fail(chalk.red('Failed to start node'));
|
|
159
|
-
console.error(chalk.red(error.message));
|
|
160
|
-
process.exit(1);
|
|
161
|
-
}
|
|
31
|
+
.description('JAELIS External Node - Sync with the JAELIS network')
|
|
32
|
+
.version(VERSION)
|
|
33
|
+
.option('-n, --network <network>', 'Network to connect to (testnet or mainnet)', 'testnet')
|
|
34
|
+
.option('-p, --port <port>', 'Local RPC port', '8545')
|
|
35
|
+
.option('-d, --data-dir <dir>', 'Data directory for local storage')
|
|
36
|
+
.option('--no-rpc', 'Disable local RPC server')
|
|
37
|
+
.parse(process.argv);
|
|
38
|
+
|
|
39
|
+
const options = program.opts();
|
|
40
|
+
|
|
41
|
+
// Create and start node
|
|
42
|
+
async function main() {
|
|
43
|
+
const node = new JaelisNode({
|
|
44
|
+
network: options.network,
|
|
45
|
+
rpcPort: parseInt(options.port, 10),
|
|
46
|
+
dataDir: options.dataDir,
|
|
47
|
+
enableRpc: options.rpc !== false
|
|
162
48
|
});
|
|
163
49
|
|
|
164
|
-
//
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
.option('-s, --stake <amount>', 'Amount of JAELIS to stake', '1000')
|
|
170
|
-
.option('-k, --key <path>', 'Path to validator key file')
|
|
171
|
-
.action(async (options) => {
|
|
172
|
-
console.log(chalk.cyan(BANNER));
|
|
173
|
-
console.log(chalk.yellow('Starting JAELIS Validator Node...'));
|
|
174
|
-
console.log();
|
|
175
|
-
console.log(chalk.white('Validator Configuration:'));
|
|
176
|
-
console.log(chalk.gray(` Network: ${options.network}`));
|
|
177
|
-
console.log(chalk.gray(` Stake: ${options.stake} JAELIS`));
|
|
178
|
-
console.log(chalk.gray(` Key: ${options.key || 'auto-generated'}`));
|
|
179
|
-
console.log();
|
|
180
|
-
|
|
181
|
-
console.log(chalk.yellow('Validator mode coming soon!'));
|
|
182
|
-
console.log(chalk.gray('For now, run as a full node with: jaelis-node start'));
|
|
50
|
+
// Handle shutdown
|
|
51
|
+
process.on('SIGINT', async () => {
|
|
52
|
+
console.log('\n[CLI] Shutting down...');
|
|
53
|
+
await node.stop();
|
|
54
|
+
process.exit(0);
|
|
183
55
|
});
|
|
184
56
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
.description('Run as a bootstrap/seed node for peer discovery')
|
|
189
|
-
.option('-p, --ports <ports>', 'Comma-separated list of P2P ports', '30305,30306,30307')
|
|
190
|
-
.option('-n, --network <network>', 'Network', 'testnet')
|
|
191
|
-
.action(async (options) => {
|
|
192
|
-
console.log(chalk.cyan(BANNER));
|
|
193
|
-
console.log(chalk.magenta('Starting JAELIS Bootstrap Node...'));
|
|
194
|
-
console.log();
|
|
195
|
-
|
|
196
|
-
const ports = options.ports.split(',').map(p => parseInt(p.trim()));
|
|
197
|
-
console.log(chalk.white('Bootstrap Configuration:'));
|
|
198
|
-
console.log(chalk.gray(` Ports: ${ports.join(', ')}`));
|
|
199
|
-
console.log(chalk.gray(` Network: ${options.network}`));
|
|
200
|
-
console.log();
|
|
201
|
-
|
|
202
|
-
const spinner = ora('Starting bootstrap nodes...').start();
|
|
203
|
-
|
|
204
|
-
try {
|
|
205
|
-
const { BootstrapNode } = require('../lib/index.js');
|
|
206
|
-
|
|
207
|
-
for (const port of ports) {
|
|
208
|
-
const bootstrap = new BootstrapNode({ port, network: options.network });
|
|
209
|
-
await bootstrap.start();
|
|
210
|
-
console.log(chalk.green(` ✓ Bootstrap node started on port ${port}`));
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
spinner.succeed('All bootstrap nodes running');
|
|
214
|
-
console.log();
|
|
215
|
-
console.log(chalk.gray('Press Ctrl+C to stop'));
|
|
216
|
-
|
|
217
|
-
} catch (error) {
|
|
218
|
-
spinner.fail(chalk.red('Failed to start bootstrap nodes'));
|
|
219
|
-
console.error(chalk.red(error.message));
|
|
220
|
-
process.exit(1);
|
|
221
|
-
}
|
|
57
|
+
process.on('SIGTERM', async () => {
|
|
58
|
+
await node.stop();
|
|
59
|
+
process.exit(0);
|
|
222
60
|
});
|
|
223
61
|
|
|
224
|
-
//
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
.description('Check the status of the local node')
|
|
228
|
-
.option('-r, --rpc <url>', 'RPC endpoint to query', 'http://localhost:8545')
|
|
229
|
-
.action(async (options) => {
|
|
230
|
-
console.log(chalk.cyan('Checking node status...'));
|
|
231
|
-
console.log();
|
|
232
|
-
|
|
233
|
-
try {
|
|
234
|
-
const response = await fetch(options.rpc, {
|
|
235
|
-
method: 'POST',
|
|
236
|
-
headers: { 'Content-Type': 'application/json' },
|
|
237
|
-
body: JSON.stringify({
|
|
238
|
-
jsonrpc: '2.0',
|
|
239
|
-
method: 'jaelis_getHealth',
|
|
240
|
-
params: [],
|
|
241
|
-
id: 1
|
|
242
|
-
})
|
|
243
|
-
});
|
|
244
|
-
|
|
245
|
-
const data = await response.json();
|
|
62
|
+
// Start node
|
|
63
|
+
try {
|
|
64
|
+
await node.start();
|
|
246
65
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
} else {
|
|
253
|
-
console.log(chalk.red('✗ Node returned error'));
|
|
254
|
-
console.log(chalk.gray(JSON.stringify(data.error, null, 2)));
|
|
255
|
-
}
|
|
256
|
-
} catch (error) {
|
|
257
|
-
console.log(chalk.red('✗ Node is not reachable'));
|
|
258
|
-
console.log(chalk.gray(` Endpoint: ${options.rpc}`));
|
|
259
|
-
console.log(chalk.gray(` Error: ${error.message}`));
|
|
260
|
-
}
|
|
261
|
-
});
|
|
262
|
-
|
|
263
|
-
// PEERS command - List connected peers
|
|
264
|
-
program
|
|
265
|
-
.command('peers')
|
|
266
|
-
.description('List connected P2P peers')
|
|
267
|
-
.option('-r, --rpc <url>', 'RPC endpoint', 'http://localhost:8545')
|
|
268
|
-
.action(async (options) => {
|
|
269
|
-
console.log(chalk.cyan('Fetching peer information...'));
|
|
270
|
-
console.log();
|
|
66
|
+
// Print status every 30 seconds
|
|
67
|
+
setInterval(() => {
|
|
68
|
+
const status = node.getStatus();
|
|
69
|
+
console.log(`[STATUS] Block: ${status.currentBlock} | Uptime: ${status.uptimeFormatted} | RPC Requests: ${status.stats.rpcRequests}`);
|
|
70
|
+
}, 30000);
|
|
271
71
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
72
|
+
} catch (error) {
|
|
73
|
+
console.error('[CLI] Failed to start node:', error.message);
|
|
74
|
+
process.exit(1);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Check for npm updates (non-blocking)
|
|
79
|
+
async function checkForUpdates() {
|
|
80
|
+
try {
|
|
81
|
+
const https = require('https');
|
|
82
|
+
https.get('https://registry.npmjs.org/jaelis-node/latest', { timeout: 3000 }, (res) => {
|
|
83
|
+
let data = '';
|
|
84
|
+
res.on('data', chunk => data += chunk);
|
|
85
|
+
res.on('end', () => {
|
|
86
|
+
try {
|
|
87
|
+
const latest = JSON.parse(data).version;
|
|
88
|
+
if (latest && latest !== VERSION) {
|
|
89
|
+
console.log('');
|
|
90
|
+
console.log('\x1b[33m╔══════════════════════════════════════════════════════════╗\x1b[0m');
|
|
91
|
+
console.log('\x1b[33m║\x1b[0m 📦 \x1b[1mJAELIS NODE UPDATE AVAILABLE\x1b[0m \x1b[33m║\x1b[0m');
|
|
92
|
+
console.log('\x1b[33m╠══════════════════════════════════════════════════════════╣\x1b[0m');
|
|
93
|
+
console.log('\x1b[33m║\x1b[0m Current: v' + VERSION.padEnd(8) + ' → Latest: v' + latest.padEnd(18) + '\x1b[33m║\x1b[0m');
|
|
94
|
+
console.log('\x1b[33m║\x1b[0m Run: \x1b[36mnpm update -g jaelis-node\x1b[0m \x1b[33m║\x1b[0m');
|
|
95
|
+
console.log('\x1b[33m╚══════════════════════════════════════════════════════════╝\x1b[0m');
|
|
96
|
+
console.log('');
|
|
97
|
+
}
|
|
98
|
+
} catch (e) {}
|
|
282
99
|
});
|
|
100
|
+
}).on('error', () => {});
|
|
101
|
+
} catch (e) {}
|
|
102
|
+
}
|
|
283
103
|
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
if (data.result) {
|
|
287
|
-
const peers = data.result.peers || [];
|
|
288
|
-
console.log(chalk.green(`Connected Peers: ${peers.length}`));
|
|
289
|
-
console.log();
|
|
290
|
-
peers.forEach((peer, i) => {
|
|
291
|
-
console.log(chalk.white(` ${i + 1}. ${peer.id || peer}`));
|
|
292
|
-
if (peer.address) console.log(chalk.gray(` Address: ${peer.address}`));
|
|
293
|
-
});
|
|
294
|
-
} else {
|
|
295
|
-
console.log(chalk.yellow('No peer information available'));
|
|
296
|
-
}
|
|
297
|
-
} catch (error) {
|
|
298
|
-
console.log(chalk.red('Failed to fetch peers'));
|
|
299
|
-
console.log(chalk.gray(error.message));
|
|
300
|
-
}
|
|
301
|
-
});
|
|
302
|
-
|
|
303
|
-
// INFO command - Display node information
|
|
304
|
-
program
|
|
305
|
-
.command('info')
|
|
306
|
-
.description('Display information about the JAELIS node')
|
|
307
|
-
.action(() => {
|
|
308
|
-
console.log(chalk.cyan(BANNER));
|
|
309
|
-
console.log(chalk.white('JAELIS Node Information:'));
|
|
310
|
-
console.log();
|
|
311
|
-
console.log(chalk.gray(' Version: ') + chalk.white(version));
|
|
312
|
-
console.log(chalk.gray(' Node.js: ') + chalk.white(process.version));
|
|
313
|
-
console.log(chalk.gray(' Platform: ') + chalk.white(process.platform));
|
|
314
|
-
console.log(chalk.gray(' Architecture: ') + chalk.white(process.arch));
|
|
315
|
-
console.log();
|
|
316
|
-
console.log(chalk.white('Networks:'));
|
|
317
|
-
console.log(chalk.gray(' Testnet: Chain ID 4545 (active)'));
|
|
318
|
-
console.log(chalk.gray(' Mainnet: Chain ID 4547 (coming soon)'));
|
|
319
|
-
console.log();
|
|
320
|
-
console.log(chalk.white('Features:'));
|
|
321
|
-
console.log(chalk.gray(' • Zero gas fees (LODE-based metering)'));
|
|
322
|
-
console.log(chalk.gray(' • PoEC consensus (Proof of Ephemeral Contribution)'));
|
|
323
|
-
console.log(chalk.gray(' • Multi-VM support (EVM, Solana, WASM, Bitcoin, Move, TON)'));
|
|
324
|
-
console.log(chalk.gray(' • AI-native blockchain with MCP & x402 support'));
|
|
325
|
-
console.log(chalk.gray(' • JZK privacy protocol (no trusted setup)'));
|
|
326
|
-
console.log(chalk.gray(' • Built-in MEV protection'));
|
|
327
|
-
console.log();
|
|
328
|
-
console.log(chalk.cyan('Documentation: https://docs.jaelis.io'));
|
|
329
|
-
console.log(chalk.cyan('Website: https://jaelis.io'));
|
|
330
|
-
});
|
|
331
|
-
|
|
332
|
-
// ═══════════════════════════════════════════════════════════════════════════
|
|
333
|
-
// WALLET COMMANDS - Manage node wallet configuration
|
|
334
|
-
// Like Geth's account management, but supports ANY chain address!
|
|
335
|
-
// NO STAKING REQUIRED - JAELIS doesn't hold your funds!
|
|
336
|
-
// ═══════════════════════════════════════════════════════════════════════════
|
|
337
|
-
|
|
338
|
-
// WALLET SET-RECIPIENT - Set reward recipient address (like Geth --suggested-fee-recipient)
|
|
339
|
-
program
|
|
340
|
-
.command('wallet:set-recipient <address>')
|
|
341
|
-
.description('Set the wallet address to receive node rewards (accepts ANY chain format!)')
|
|
342
|
-
.option('-d, --data-dir <path>', 'Data directory', './jaelis-data')
|
|
343
|
-
.action((address, options) => {
|
|
344
|
-
console.log(chalk.cyan('Setting reward recipient...'));
|
|
345
|
-
console.log();
|
|
346
|
-
|
|
347
|
-
try {
|
|
348
|
-
const { NodeWalletConfig, validateAddress } = require('../lib/index.js');
|
|
349
|
-
|
|
350
|
-
// Validate address format
|
|
351
|
-
const validation = validateAddress(address);
|
|
352
|
-
if (!validation.valid) {
|
|
353
|
-
console.log(chalk.red('✗ Invalid address format'));
|
|
354
|
-
console.log(chalk.gray(' Supported formats:'));
|
|
355
|
-
console.log(chalk.gray(' • EVM (Ethereum, Polygon, etc.): 0x...'));
|
|
356
|
-
console.log(chalk.gray(' • Solana: base58 address'));
|
|
357
|
-
console.log(chalk.gray(' • Bitcoin: 1..., 3..., or bc1...'));
|
|
358
|
-
console.log(chalk.gray(' • TON: base64url address'));
|
|
359
|
-
console.log(chalk.gray(' • Move (Aptos/Sui): 0x... (64 chars)'));
|
|
360
|
-
process.exit(1);
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
const walletConfig = new NodeWalletConfig(options.dataDir);
|
|
364
|
-
walletConfig.load();
|
|
365
|
-
const result = walletConfig.setRewardRecipient(address);
|
|
366
|
-
|
|
367
|
-
console.log(chalk.green('✓ Reward recipient set successfully!'));
|
|
368
|
-
console.log();
|
|
369
|
-
console.log(chalk.white(' Address: ') + chalk.cyan(result.originalFormat));
|
|
370
|
-
console.log(chalk.white(' Type: ') + chalk.gray(result.typeName));
|
|
371
|
-
console.log();
|
|
372
|
-
console.log(chalk.gray(' Node rewards will be sent to this address.'));
|
|
373
|
-
console.log(chalk.gray(' NO STAKING REQUIRED - you keep your own funds!'));
|
|
374
|
-
|
|
375
|
-
} catch (error) {
|
|
376
|
-
console.log(chalk.red('✗ Failed to set recipient'));
|
|
377
|
-
console.log(chalk.gray(error.message));
|
|
378
|
-
process.exit(1);
|
|
379
|
-
}
|
|
380
|
-
});
|
|
381
|
-
|
|
382
|
-
// WALLET ADD - Add an additional wallet
|
|
383
|
-
program
|
|
384
|
-
.command('wallet:add <name> <address>')
|
|
385
|
-
.description('Add a wallet to this node (accepts ANY chain format!)')
|
|
386
|
-
.option('-d, --data-dir <path>', 'Data directory', './jaelis-data')
|
|
387
|
-
.option('-p, --purpose <purpose>', 'Wallet purpose (general, validator, development)', 'general')
|
|
388
|
-
.action((name, address, options) => {
|
|
389
|
-
console.log(chalk.cyan('Adding wallet...'));
|
|
390
|
-
console.log();
|
|
391
|
-
|
|
392
|
-
try {
|
|
393
|
-
const { NodeWalletConfig, validateAddress } = require('../lib/index.js');
|
|
394
|
-
|
|
395
|
-
const validation = validateAddress(address);
|
|
396
|
-
if (!validation.valid) {
|
|
397
|
-
console.log(chalk.red('✗ Invalid address format'));
|
|
398
|
-
process.exit(1);
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
const walletConfig = new NodeWalletConfig(options.dataDir);
|
|
402
|
-
walletConfig.load();
|
|
403
|
-
const result = walletConfig.addWallet(name, address, { purpose: options.purpose });
|
|
404
|
-
|
|
405
|
-
console.log(chalk.green('✓ Wallet added successfully!'));
|
|
406
|
-
console.log();
|
|
407
|
-
console.log(chalk.white(' Name: ') + chalk.cyan(result.name));
|
|
408
|
-
console.log(chalk.white(' Address: ') + chalk.gray(result.originalFormat));
|
|
409
|
-
console.log(chalk.white(' Type: ') + chalk.gray(result.typeName));
|
|
410
|
-
console.log(chalk.white(' Purpose: ') + chalk.gray(result.purpose));
|
|
411
|
-
|
|
412
|
-
} catch (error) {
|
|
413
|
-
console.log(chalk.red('✗ Failed to add wallet'));
|
|
414
|
-
console.log(chalk.gray(error.message));
|
|
415
|
-
process.exit(1);
|
|
416
|
-
}
|
|
417
|
-
});
|
|
418
|
-
|
|
419
|
-
// WALLET REMOVE - Remove a wallet
|
|
420
|
-
program
|
|
421
|
-
.command('wallet:remove <name-or-address>')
|
|
422
|
-
.description('Remove a wallet from this node')
|
|
423
|
-
.option('-d, --data-dir <path>', 'Data directory', './jaelis-data')
|
|
424
|
-
.action((nameOrAddress, options) => {
|
|
425
|
-
console.log(chalk.cyan('Removing wallet...'));
|
|
426
|
-
console.log();
|
|
427
|
-
|
|
428
|
-
try {
|
|
429
|
-
const { NodeWalletConfig } = require('../lib/index.js');
|
|
430
|
-
|
|
431
|
-
const walletConfig = new NodeWalletConfig(options.dataDir);
|
|
432
|
-
walletConfig.load();
|
|
433
|
-
const result = walletConfig.removeWallet(nameOrAddress);
|
|
434
|
-
|
|
435
|
-
console.log(chalk.green('✓ Wallet removed!'));
|
|
436
|
-
console.log(chalk.gray(` Removed: ${result.name} (${result.originalFormat})`));
|
|
437
|
-
|
|
438
|
-
} catch (error) {
|
|
439
|
-
console.log(chalk.red('✗ Failed to remove wallet'));
|
|
440
|
-
console.log(chalk.gray(error.message));
|
|
441
|
-
process.exit(1);
|
|
442
|
-
}
|
|
443
|
-
});
|
|
444
|
-
|
|
445
|
-
// WALLET LIST - List all wallets
|
|
446
|
-
program
|
|
447
|
-
.command('wallet:list')
|
|
448
|
-
.description('List all configured wallets')
|
|
449
|
-
.option('-d, --data-dir <path>', 'Data directory', './jaelis-data')
|
|
450
|
-
.action((options) => {
|
|
451
|
-
console.log(chalk.cyan('Node Wallet Configuration'));
|
|
452
|
-
console.log();
|
|
453
|
-
|
|
454
|
-
try {
|
|
455
|
-
const { NodeWalletConfig } = require('../lib/index.js');
|
|
456
|
-
|
|
457
|
-
const walletConfig = new NodeWalletConfig(options.dataDir);
|
|
458
|
-
const config = walletConfig.listWallets();
|
|
459
|
-
|
|
460
|
-
// Show reward recipient
|
|
461
|
-
if (config.rewardRecipient) {
|
|
462
|
-
console.log(chalk.white('Reward Recipient:'));
|
|
463
|
-
console.log(chalk.green(` ★ ${config.rewardRecipient.originalFormat}`));
|
|
464
|
-
console.log(chalk.gray(` Type: ${config.rewardRecipient.typeName}`));
|
|
465
|
-
console.log();
|
|
466
|
-
} else {
|
|
467
|
-
console.log(chalk.yellow('⚠ No reward recipient set!'));
|
|
468
|
-
console.log(chalk.gray(' Run: jaelis-node wallet:set-recipient <your-address>'));
|
|
469
|
-
console.log();
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
// Show additional wallets
|
|
473
|
-
if (config.wallets && config.wallets.length > 0) {
|
|
474
|
-
console.log(chalk.white('Additional Wallets:'));
|
|
475
|
-
config.wallets.forEach((wallet, i) => {
|
|
476
|
-
console.log(chalk.cyan(` ${i + 1}. ${wallet.name}`));
|
|
477
|
-
console.log(chalk.gray(` Address: ${wallet.originalFormat}`));
|
|
478
|
-
console.log(chalk.gray(` Type: ${wallet.typeName}`));
|
|
479
|
-
console.log(chalk.gray(` Purpose: ${wallet.purpose}`));
|
|
480
|
-
});
|
|
481
|
-
} else {
|
|
482
|
-
console.log(chalk.gray('No additional wallets configured.'));
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
console.log();
|
|
486
|
-
console.log(chalk.gray('Supported address formats:'));
|
|
487
|
-
console.log(chalk.gray(' • EVM (Ethereum, Polygon, Arbitrum, Base, etc.)'));
|
|
488
|
-
console.log(chalk.gray(' • Solana (base58)'));
|
|
489
|
-
console.log(chalk.gray(' • Bitcoin (Legacy & SegWit)'));
|
|
490
|
-
console.log(chalk.gray(' • TON'));
|
|
491
|
-
console.log(chalk.gray(' • Move (Aptos/Sui)'));
|
|
492
|
-
|
|
493
|
-
} catch (error) {
|
|
494
|
-
console.log(chalk.red('Failed to list wallets'));
|
|
495
|
-
console.log(chalk.gray(error.message));
|
|
496
|
-
}
|
|
497
|
-
});
|
|
498
|
-
|
|
499
|
-
// WALLET IDENTITY - Show or generate node identity
|
|
500
|
-
program
|
|
501
|
-
.command('wallet:identity')
|
|
502
|
-
.description('Show or generate the node identity (like Solana identity keypair)')
|
|
503
|
-
.option('-d, --data-dir <path>', 'Data directory', './jaelis-data')
|
|
504
|
-
.action((options) => {
|
|
505
|
-
console.log(chalk.cyan('Node Identity'));
|
|
506
|
-
console.log();
|
|
507
|
-
|
|
508
|
-
try {
|
|
509
|
-
const { NodeWalletConfig } = require('../lib/index.js');
|
|
510
|
-
|
|
511
|
-
const walletConfig = new NodeWalletConfig(options.dataDir);
|
|
512
|
-
walletConfig.load();
|
|
513
|
-
const identity = walletConfig.getNodeIdentity();
|
|
514
|
-
|
|
515
|
-
console.log(chalk.white('Node Identity:'));
|
|
516
|
-
console.log(chalk.green(` Public Key: ${identity.publicKey}`));
|
|
517
|
-
console.log(chalk.gray(` Created: ${new Date(identity.createdAt).toISOString()}`));
|
|
518
|
-
console.log();
|
|
519
|
-
console.log(chalk.gray('This identity is used to identify your node on the network.'));
|
|
520
|
-
console.log(chalk.gray('It is NOT a wallet - use wallet:set-recipient for rewards.'));
|
|
521
|
-
|
|
522
|
-
} catch (error) {
|
|
523
|
-
console.log(chalk.red('Failed to get node identity'));
|
|
524
|
-
console.log(chalk.gray(error.message));
|
|
525
|
-
}
|
|
526
|
-
});
|
|
527
|
-
|
|
528
|
-
// Parse and execute
|
|
529
|
-
program.parse();
|
|
104
|
+
main();
|