jaelis-node 2.0.0 → 2.2.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 +28 -6
- package/SKILL.md +356 -0
- package/bin/jaelis-node.js +7 -3
- package/lib/node.js +42 -4
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -16,6 +16,17 @@ Official external node software for the **JAELIS Blockchain** network. Run your
|
|
|
16
16
|
|
|
17
17
|
This is similar to running `geth --syncmode light` for Ethereum.
|
|
18
18
|
|
|
19
|
+
## AI Agent Quick Start
|
|
20
|
+
|
|
21
|
+
Get a named node running in 2 commands:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm install -g jaelis-node
|
|
25
|
+
jaelis-node --name "MY-AGENT" --network testnet
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Your agent node will sync with the JAELIS testnet, expose a local RPC at `http://localhost:8545`, and persist its name across restarts.
|
|
29
|
+
|
|
19
30
|
## Quick Start
|
|
20
31
|
|
|
21
32
|
### Install Globally
|
|
@@ -30,8 +41,11 @@ npm install -g jaelis-node
|
|
|
30
41
|
# Start on testnet (default)
|
|
31
42
|
jaelis-node
|
|
32
43
|
|
|
33
|
-
# Start on mainnet
|
|
34
|
-
jaelis-node --network mainnet
|
|
44
|
+
# Start on mainnet (coming soon — not yet live)
|
|
45
|
+
# jaelis-node --network mainnet
|
|
46
|
+
|
|
47
|
+
# Name your node (persists across restarts)
|
|
48
|
+
jaelis-node --name MARBIT
|
|
35
49
|
|
|
36
50
|
# Custom RPC port
|
|
37
51
|
jaelis-node --port 8546
|
|
@@ -80,6 +94,7 @@ const balance = await jaelis.getBalance('jae1qwertyuiop...'); // JAELIS native a
|
|
|
80
94
|
| `-n, --network <network>` | Network to connect to (`testnet` or `mainnet`) | `testnet` |
|
|
81
95
|
| `-p, --port <port>` | Local RPC server port | `8545` |
|
|
82
96
|
| `-d, --data-dir <dir>` | Data directory for block storage | `./jaelis-data/<network>` |
|
|
97
|
+
| `--name <name>` | Custom node name (e.g., `MARBIT`, `my-agent`) | Auto-generated ID |
|
|
83
98
|
| `--no-rpc` | Disable local RPC server | Enabled |
|
|
84
99
|
|
|
85
100
|
## Programmatic Usage
|
|
@@ -92,6 +107,7 @@ async function main() {
|
|
|
92
107
|
network: 'testnet',
|
|
93
108
|
rpcPort: 8545,
|
|
94
109
|
dataDir: './my-jaelis-data',
|
|
110
|
+
nodeName: 'MY-AGENT', // Name your node
|
|
95
111
|
enableRpc: true
|
|
96
112
|
});
|
|
97
113
|
|
|
@@ -157,10 +173,10 @@ JAELIS uses the `jaelis_*` namespace for all RPC methods:
|
|
|
157
173
|
|
|
158
174
|
## Network Info
|
|
159
175
|
|
|
160
|
-
| Network | Chain ID | Main RPC | WebSocket |
|
|
161
|
-
|
|
162
|
-
| Testnet | 4545 | https://rpc.jaelis.io | wss://rpc.jaelis.io/ws |
|
|
163
|
-
| Mainnet | 4547 | https://mainnet.jaelis.io | wss://mainnet.jaelis.io/ws |
|
|
176
|
+
| Network | Chain ID | Main RPC | WebSocket | Status |
|
|
177
|
+
|---------|----------|----------|-----------|--------|
|
|
178
|
+
| Testnet | 4545 | https://rpc.jaelis.io | wss://rpc.jaelis.io/ws | **Active** |
|
|
179
|
+
| Mainnet | 4547 | https://mainnet.jaelis.io | wss://mainnet.jaelis.io/ws | **Coming Soon** |
|
|
164
180
|
|
|
165
181
|
## Why Run Your Own Node?
|
|
166
182
|
|
|
@@ -222,6 +238,12 @@ rm -rf ./jaelis-data
|
|
|
222
238
|
jaelis-node
|
|
223
239
|
```
|
|
224
240
|
|
|
241
|
+
## Agent Skills
|
|
242
|
+
|
|
243
|
+
This package includes a `SKILL.md` file — a standardized skill document that AI agents can consume to learn how to run and manage JAELIS nodes autonomously. Compatible with Claude Code, Cursor, GitHub Copilot, and other agent platforms.
|
|
244
|
+
|
|
245
|
+
See [SKILL.md](./SKILL.md) for the full agent skill specification.
|
|
246
|
+
|
|
225
247
|
## Links
|
|
226
248
|
|
|
227
249
|
- **SDK:** [npmjs.com/package/jaelis.js](https://www.npmjs.com/package/jaelis.js)
|
package/SKILL.md
ADDED
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: jaelis-node
|
|
3
|
+
description: "Run your own JAELIS blockchain node — sync with the network, expose local RPC, name your node. Lightweight external node for AI agents and developers."
|
|
4
|
+
metadata:
|
|
5
|
+
emoji: "🔗"
|
|
6
|
+
homepage: "https://jaelis.io"
|
|
7
|
+
requires:
|
|
8
|
+
bins: ["jaelis-node"]
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# JAELIS Node — Agent Skill
|
|
12
|
+
|
|
13
|
+
Use when the user or agent wants to run their own JAELIS blockchain node: sync with the network, expose a local RPC endpoint, name the node, monitor sync status, or contribute to network decentralization. Running your own node gives you privacy, speed, and independence from public RPC endpoints.
|
|
14
|
+
|
|
15
|
+
## Getting Started
|
|
16
|
+
|
|
17
|
+
### Install
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install -g jaelis-node
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Quick Start
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# Start a named node on testnet (recommended — mainnet is not yet live)
|
|
27
|
+
jaelis-node --name "MY-AGENT" --network testnet
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
> **Note:** Mainnet is coming soon. Use **testnet** for all current development and testing. Mainnet launch date will be announced by the JAELIS Foundation.
|
|
31
|
+
|
|
32
|
+
The node will:
|
|
33
|
+
1. Connect to the JAELIS network via WebSocket
|
|
34
|
+
2. Sync and store blocks locally (LevelDB)
|
|
35
|
+
3. Expose a local JSON-RPC server at `http://localhost:8545`
|
|
36
|
+
4. Display sync status every 30 seconds
|
|
37
|
+
|
|
38
|
+
### Architecture
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
┌─────────────────┐ WebSocket ┌───────────────────┐
|
|
42
|
+
│ JAELIS │ ◄──────────────── │ Your Local Node │
|
|
43
|
+
│ Main Network │ │ (jaelis-node) │
|
|
44
|
+
│ rpc.jaelis.io │ ──────────────► │ │
|
|
45
|
+
└─────────────────┘ newHeads │ ┌─────────────┐ │
|
|
46
|
+
subscription │ │ LevelDB │ │
|
|
47
|
+
│ │ Storage │ │
|
|
48
|
+
┌─────────────────┐ JSON-RPC │ └─────────────┘ │
|
|
49
|
+
│ Your dApp / │ ◄──────────────── │ │
|
|
50
|
+
│ Agent │ localhost:8545 │ ┌─────────────┐ │
|
|
51
|
+
└─────────────────┘ │ │ RPC Server │ │
|
|
52
|
+
│ └─────────────┘ │
|
|
53
|
+
└───────────────────┘
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## CLI Options
|
|
59
|
+
|
|
60
|
+
| Option | Description | Default |
|
|
61
|
+
|--------|-------------|---------|
|
|
62
|
+
| `-n, --network <network>` | Network: `testnet` or `mainnet` (mainnet coming soon) | `testnet` |
|
|
63
|
+
| `-p, --port <port>` | Local RPC server port | `8545` |
|
|
64
|
+
| `-d, --data-dir <dir>` | Data directory for block storage | `./jaelis-data/<network>` |
|
|
65
|
+
| `--name <name>` | Custom node name (persists across restarts) | Auto-generated ID |
|
|
66
|
+
| `--no-rpc` | Disable local RPC server | Enabled |
|
|
67
|
+
| `--version` | Show version | — |
|
|
68
|
+
| `--help` | Show help | — |
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Node Naming
|
|
73
|
+
|
|
74
|
+
Give your node a persistent identity:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
# Name your node
|
|
78
|
+
jaelis-node --name "MARBIT"
|
|
79
|
+
|
|
80
|
+
# Name persists across restarts (stored in data dir)
|
|
81
|
+
jaelis-node
|
|
82
|
+
# Output: [STATUS] MARBIT | Block: 12345 | Uptime: 2h 15m 30s | RPC Requests: 42
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Node names are stored in `{dataDir}/node-name.json` and persist across restarts. Set once, and it's remembered.
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## Common Operations
|
|
90
|
+
|
|
91
|
+
### Start a Node for AI Agent Use
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
# Install globally
|
|
95
|
+
npm install -g jaelis-node
|
|
96
|
+
|
|
97
|
+
# Start with a name on testnet
|
|
98
|
+
jaelis-node --name "ALPHA-1" --network testnet
|
|
99
|
+
|
|
100
|
+
# The agent can now connect to http://localhost:8545
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Connect Your dApp or SDK to Local Node
|
|
104
|
+
|
|
105
|
+
```javascript
|
|
106
|
+
const Jaelis = require('jaelis.js');
|
|
107
|
+
|
|
108
|
+
// Point SDK at your local node instead of public RPC
|
|
109
|
+
const provider = new Jaelis.Provider('http://localhost:8545');
|
|
110
|
+
|
|
111
|
+
// All operations now go through your local node
|
|
112
|
+
const blockNumber = await provider.getBlockNumber();
|
|
113
|
+
const balance = await provider.getBalance('0x...');
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Use a Custom Port
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
# If port 8545 is taken
|
|
120
|
+
jaelis-node --name "MY-NODE" --port 8546
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Use Custom Data Directory
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
# Store blocks in a specific location
|
|
127
|
+
jaelis-node --name "MY-NODE" --data-dir /path/to/my-data
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Run Without RPC (Sync Only)
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
# Just sync blocks, don't expose RPC
|
|
134
|
+
jaelis-node --name "SYNC-ONLY" --no-rpc
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Check Node Status via SDK CLI
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
# If you have jaelis.js installed too
|
|
141
|
+
jaelis node status
|
|
142
|
+
jaelis node status --rpc http://localhost:8545
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## Programmatic Usage
|
|
148
|
+
|
|
149
|
+
Use `jaelis-node` as a library in your agent code:
|
|
150
|
+
|
|
151
|
+
```javascript
|
|
152
|
+
const { JaelisNode } = require('jaelis-node');
|
|
153
|
+
|
|
154
|
+
async function main() {
|
|
155
|
+
const node = new JaelisNode({
|
|
156
|
+
network: 'testnet',
|
|
157
|
+
rpcPort: 8545,
|
|
158
|
+
dataDir: './my-jaelis-data',
|
|
159
|
+
nodeName: 'MY-AGENT',
|
|
160
|
+
enableRpc: true
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
// Event listeners
|
|
164
|
+
node.on('connected', () => console.log('Connected to network'));
|
|
165
|
+
node.on('block', (block) => console.log('New block:', block.number));
|
|
166
|
+
node.on('synced', () => console.log('Fully synced!'));
|
|
167
|
+
node.on('disconnected', () => console.log('Disconnected'));
|
|
168
|
+
|
|
169
|
+
// Start the node
|
|
170
|
+
await node.start();
|
|
171
|
+
|
|
172
|
+
// Get status
|
|
173
|
+
const status = node.getStatus();
|
|
174
|
+
console.log('Node:', status.nodeName);
|
|
175
|
+
console.log('Block:', status.currentBlock);
|
|
176
|
+
console.log('Syncing:', status.isSyncing);
|
|
177
|
+
console.log('Uptime:', status.uptimeFormatted);
|
|
178
|
+
|
|
179
|
+
// Graceful shutdown
|
|
180
|
+
process.on('SIGINT', async () => {
|
|
181
|
+
await node.stop();
|
|
182
|
+
process.exit(0);
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
main();
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### JaelisNode Constructor Options
|
|
190
|
+
|
|
191
|
+
| Option | Type | Description | Default |
|
|
192
|
+
|--------|------|-------------|---------|
|
|
193
|
+
| `network` | string | `'testnet'` or `'mainnet'` | `'testnet'` |
|
|
194
|
+
| `rpcPort` | number | Local RPC port | `8545` |
|
|
195
|
+
| `dataDir` | string | Data directory path | `./jaelis-data/<network>` |
|
|
196
|
+
| `nodeName` | string | Custom node name | Auto-generated |
|
|
197
|
+
| `enableRpc` | boolean | Enable local RPC server | `true` |
|
|
198
|
+
|
|
199
|
+
### Events
|
|
200
|
+
|
|
201
|
+
| Event | Data | Description |
|
|
202
|
+
|-------|------|-------------|
|
|
203
|
+
| `connected` | — | Connected to JAELIS network |
|
|
204
|
+
| `disconnected` | — | Lost connection |
|
|
205
|
+
| `block` | `{ number, hash, ... }` | New block received |
|
|
206
|
+
| `syncing` | `{ syncing, currentBlock, highestBlock }` | Sync status changed |
|
|
207
|
+
| `synced` | — | Fully synced with network |
|
|
208
|
+
| `started` | — | Node started |
|
|
209
|
+
| `stopped` | — | Node stopped |
|
|
210
|
+
|
|
211
|
+
### getStatus() Return Object
|
|
212
|
+
|
|
213
|
+
```javascript
|
|
214
|
+
{
|
|
215
|
+
nodeId: 'jaelis_abc123...',
|
|
216
|
+
nodeName: 'MARBIT', // null if no name set
|
|
217
|
+
network: 'testnet',
|
|
218
|
+
chainId: 4545,
|
|
219
|
+
isRunning: true,
|
|
220
|
+
isSyncing: false,
|
|
221
|
+
uptime: 135000, // ms
|
|
222
|
+
uptimeFormatted: '2m 15s',
|
|
223
|
+
currentBlock: 12345,
|
|
224
|
+
stats: {
|
|
225
|
+
blocksReceived: 100,
|
|
226
|
+
transactionsRelayed: 5,
|
|
227
|
+
rpcRequests: 42,
|
|
228
|
+
peersConnected: 3
|
|
229
|
+
},
|
|
230
|
+
version: '2.2.0',
|
|
231
|
+
rpcPort: 8545
|
|
232
|
+
}
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
## RPC Methods
|
|
238
|
+
|
|
239
|
+
Once your node is running, it supports these JSON-RPC methods on `http://localhost:<port>`:
|
|
240
|
+
|
|
241
|
+
### Chain Info
|
|
242
|
+
| Method | Description |
|
|
243
|
+
|--------|-------------|
|
|
244
|
+
| `jaelis_chainId` | Get chain ID (4547 mainnet, 4545 testnet) |
|
|
245
|
+
| `jaelis_blockNumber` | Get latest block number |
|
|
246
|
+
| `jaelis_syncing` | Get sync status |
|
|
247
|
+
|
|
248
|
+
### Block Queries
|
|
249
|
+
| Method | Description |
|
|
250
|
+
|--------|-------------|
|
|
251
|
+
| `jaelis_getBlockByNumber` | Get block by number |
|
|
252
|
+
| `jaelis_getBlockByHash` | Get block by hash |
|
|
253
|
+
|
|
254
|
+
### Transaction Queries
|
|
255
|
+
| Method | Description |
|
|
256
|
+
|--------|-------------|
|
|
257
|
+
| `jaelis_getTransactionByHash` | Get transaction details |
|
|
258
|
+
| `jaelis_getTransactionReceipt` | Get transaction receipt |
|
|
259
|
+
| `jaelis_sendRawTransaction` | Submit signed transaction |
|
|
260
|
+
|
|
261
|
+
### Account Queries (Relayed to Main Network)
|
|
262
|
+
| Method | Description |
|
|
263
|
+
|--------|-------------|
|
|
264
|
+
| `jaelis_getBalance` | Get account balance |
|
|
265
|
+
| `jaelis_getENE` | Get ENE (Ephemeral Network Entropy) |
|
|
266
|
+
| `jaelis_getSigil` | Get SIGIL compute allocation |
|
|
267
|
+
| `jaelis_getCode` | Get contract code |
|
|
268
|
+
| `jaelis_call` | Call contract (read-only) |
|
|
269
|
+
|
|
270
|
+
### SIGIL Compute
|
|
271
|
+
| Method | Description |
|
|
272
|
+
|--------|-------------|
|
|
273
|
+
| `jaelis_estimateSigil` | Estimate SIGIL for transaction |
|
|
274
|
+
| `jaelis_getSigil` | Get available SIGIL allocation |
|
|
275
|
+
|
|
276
|
+
> JAELIS has ZERO gas fees. SIGIL represents compute allocation — it's not purchased, it's allocated.
|
|
277
|
+
|
|
278
|
+
---
|
|
279
|
+
|
|
280
|
+
## Network Info
|
|
281
|
+
|
|
282
|
+
| Network | Chain ID | Main RPC | WebSocket | Status |
|
|
283
|
+
|---------|----------|----------|-----------|--------|
|
|
284
|
+
| Testnet | 4545 | `https://rpc.jaelis.io` | `wss://rpc.jaelis.io/ws` | **Active** |
|
|
285
|
+
| Mainnet | 4547 | `https://mainnet.jaelis.io` | `wss://mainnet.jaelis.io/ws` | **Coming Soon** |
|
|
286
|
+
|
|
287
|
+
> **Important:** Use testnet for now. Mainnet launch will be announced when ready.
|
|
288
|
+
|
|
289
|
+
---
|
|
290
|
+
|
|
291
|
+
## Why Run Your Own Node?
|
|
292
|
+
|
|
293
|
+
1. **Privacy** — RPC requests stay local, not routed through public endpoints
|
|
294
|
+
2. **Speed** — Local reads are instant (no network latency)
|
|
295
|
+
3. **Decentralization** — More nodes = stronger network
|
|
296
|
+
4. **Reliability** — No dependency on public RPC availability
|
|
297
|
+
5. **Agent Autonomy** — Your agent controls its own infrastructure
|
|
298
|
+
|
|
299
|
+
---
|
|
300
|
+
|
|
301
|
+
## Error Handling
|
|
302
|
+
|
|
303
|
+
| Error | Cause | Fix |
|
|
304
|
+
|-------|-------|-----|
|
|
305
|
+
| `Connection refused` | Network unreachable | Check internet connection, verify RPC endpoints |
|
|
306
|
+
| `Port already in use` | Another process on port | Use `--port 8546` |
|
|
307
|
+
| `Unknown network` | Invalid network name | Use `testnet` or `mainnet` |
|
|
308
|
+
| `Failed to start` | Storage or sync error | Delete data dir and restart: `rm -rf ./jaelis-data && jaelis-node` |
|
|
309
|
+
| `Disconnected from network` | WebSocket dropped | Node auto-reconnects. Check internet if persistent |
|
|
310
|
+
|
|
311
|
+
---
|
|
312
|
+
|
|
313
|
+
## System Requirements
|
|
314
|
+
|
|
315
|
+
- **Node.js:** 18.0.0 or higher
|
|
316
|
+
- **Disk Space:** ~1GB testnet, ~10GB mainnet (grows over time)
|
|
317
|
+
- **Memory:** 512MB minimum, 1GB recommended
|
|
318
|
+
- **Network:** Stable internet connection
|
|
319
|
+
|
|
320
|
+
---
|
|
321
|
+
|
|
322
|
+
## Data Storage
|
|
323
|
+
|
|
324
|
+
```
|
|
325
|
+
./jaelis-data/
|
|
326
|
+
└── testnet/
|
|
327
|
+
├── blocks/ # LevelDB database
|
|
328
|
+
└── node-name.json # Persisted node name
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
To reset and resync:
|
|
332
|
+
```bash
|
|
333
|
+
rm -rf ./jaelis-data
|
|
334
|
+
jaelis-node --name "MY-NODE"
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
---
|
|
338
|
+
|
|
339
|
+
## Updates
|
|
340
|
+
|
|
341
|
+
The node checks for updates on startup and notifies if a new version is available.
|
|
342
|
+
|
|
343
|
+
```bash
|
|
344
|
+
npm update -g jaelis-node
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
---
|
|
348
|
+
|
|
349
|
+
## Resources
|
|
350
|
+
|
|
351
|
+
- **npm:** [npmjs.com/package/jaelis-node](https://www.npmjs.com/package/jaelis-node)
|
|
352
|
+
- **SDK:** [npmjs.com/package/jaelis.js](https://www.npmjs.com/package/jaelis.js)
|
|
353
|
+
- **Website:** [jaelis.io](https://jaelis.io)
|
|
354
|
+
- **Docs:** [docs.jaelis.io](https://docs.jaelis.io)
|
|
355
|
+
- **Explorer:** [explorer.jaelis.io](https://explorer.jaelis.io)
|
|
356
|
+
- **GitHub:** [github.com/jaelis-foundation](https://github.com/jaelis-foundation)
|
package/bin/jaelis-node.js
CHANGED
|
@@ -10,8 +10,9 @@
|
|
|
10
10
|
* jaelis-node --network mainnet # Start on mainnet
|
|
11
11
|
* jaelis-node --port 8546 # Custom RPC port
|
|
12
12
|
* jaelis-node --data-dir ./mydata # Custom data directory
|
|
13
|
+
* jaelis-node --name MARBIT # Name your node
|
|
13
14
|
*
|
|
14
|
-
* @version 2.
|
|
15
|
+
* @version 2.2.0
|
|
15
16
|
*/
|
|
16
17
|
|
|
17
18
|
'use strict';
|
|
@@ -20,7 +21,7 @@ const { Command } = require('commander');
|
|
|
20
21
|
const { JaelisNode } = require('../lib/node');
|
|
21
22
|
|
|
22
23
|
// Version check - notify if update available
|
|
23
|
-
const VERSION = '2.
|
|
24
|
+
const VERSION = '2.2.0';
|
|
24
25
|
checkForUpdates();
|
|
25
26
|
|
|
26
27
|
// CLI setup
|
|
@@ -33,6 +34,7 @@ program
|
|
|
33
34
|
.option('-n, --network <network>', 'Network to connect to (testnet or mainnet)', 'testnet')
|
|
34
35
|
.option('-p, --port <port>', 'Local RPC port', '8545')
|
|
35
36
|
.option('-d, --data-dir <dir>', 'Data directory for local storage')
|
|
37
|
+
.option('--name <name>', 'Custom node name (e.g., MARBIT, my-agent)')
|
|
36
38
|
.option('--no-rpc', 'Disable local RPC server')
|
|
37
39
|
.parse(process.argv);
|
|
38
40
|
|
|
@@ -44,6 +46,7 @@ async function main() {
|
|
|
44
46
|
network: options.network,
|
|
45
47
|
rpcPort: parseInt(options.port, 10),
|
|
46
48
|
dataDir: options.dataDir,
|
|
49
|
+
nodeName: options.name || null,
|
|
47
50
|
enableRpc: options.rpc !== false
|
|
48
51
|
});
|
|
49
52
|
|
|
@@ -66,7 +69,8 @@ async function main() {
|
|
|
66
69
|
// Print status every 30 seconds
|
|
67
70
|
setInterval(() => {
|
|
68
71
|
const status = node.getStatus();
|
|
69
|
-
|
|
72
|
+
const nameTag = status.nodeName ? `${status.nodeName} | ` : '';
|
|
73
|
+
console.log(`[STATUS] ${nameTag}Block: ${status.currentBlock} | Uptime: ${status.uptimeFormatted} | RPC Requests: ${status.stats.rpcRequests}`);
|
|
70
74
|
}, 30000);
|
|
71
75
|
|
|
72
76
|
} catch (error) {
|
package/lib/node.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Does NOT contain any internal JAELIS blockchain code.
|
|
6
6
|
* Only implements the network protocol for syncing and RPC.
|
|
7
7
|
*
|
|
8
|
-
* @version 2.
|
|
8
|
+
* @version 2.2.0
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
@@ -41,6 +41,7 @@ class JaelisNode extends EventEmitter {
|
|
|
41
41
|
* @param {string} options.dataDir - Data directory for local storage
|
|
42
42
|
* @param {number} options.rpcPort - Local RPC port (default: 8545)
|
|
43
43
|
* @param {boolean} options.enableRpc - Enable local RPC server (default: true)
|
|
44
|
+
* @param {string} options.nodeName - Custom node name (e.g., 'MARBIT')
|
|
44
45
|
*/
|
|
45
46
|
constructor(options = {}) {
|
|
46
47
|
super();
|
|
@@ -56,8 +57,9 @@ class JaelisNode extends EventEmitter {
|
|
|
56
57
|
this.rpcPort = options.rpcPort || 8545;
|
|
57
58
|
this.enableRpc = options.enableRpc !== false;
|
|
58
59
|
|
|
59
|
-
// Node
|
|
60
|
+
// Node identity
|
|
60
61
|
this.nodeId = this._generateNodeId();
|
|
62
|
+
this.nodeName = options.nodeName || this._loadNodeName();
|
|
61
63
|
this.startTime = null;
|
|
62
64
|
this.isRunning = false;
|
|
63
65
|
this.isSyncing = false;
|
|
@@ -84,6 +86,35 @@ class JaelisNode extends EventEmitter {
|
|
|
84
86
|
return 'jaelis_' + crypto.randomBytes(8).toString('hex');
|
|
85
87
|
}
|
|
86
88
|
|
|
89
|
+
/**
|
|
90
|
+
* Load persisted node name from data directory
|
|
91
|
+
*/
|
|
92
|
+
_loadNodeName() {
|
|
93
|
+
try {
|
|
94
|
+
const fs = require('fs');
|
|
95
|
+
const path = require('path');
|
|
96
|
+
const nameFile = path.join(this.dataDir, 'node-name.json');
|
|
97
|
+
const data = JSON.parse(fs.readFileSync(nameFile, 'utf8'));
|
|
98
|
+
return data.name || null;
|
|
99
|
+
} catch (e) {
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Persist node name to data directory
|
|
106
|
+
*/
|
|
107
|
+
_saveNodeName() {
|
|
108
|
+
if (!this.nodeName) return;
|
|
109
|
+
try {
|
|
110
|
+
const fs = require('fs');
|
|
111
|
+
const path = require('path');
|
|
112
|
+
fs.mkdirSync(this.dataDir, { recursive: true });
|
|
113
|
+
const nameFile = path.join(this.dataDir, 'node-name.json');
|
|
114
|
+
fs.writeFileSync(nameFile, JSON.stringify({ name: this.nodeName, setAt: Date.now() }));
|
|
115
|
+
} catch (e) {}
|
|
116
|
+
}
|
|
117
|
+
|
|
87
118
|
/**
|
|
88
119
|
* Start the node
|
|
89
120
|
*/
|
|
@@ -92,10 +123,16 @@ class JaelisNode extends EventEmitter {
|
|
|
92
123
|
throw new Error('Node is already running');
|
|
93
124
|
}
|
|
94
125
|
|
|
126
|
+
// Persist node name if provided
|
|
127
|
+
this._saveNodeName();
|
|
128
|
+
|
|
95
129
|
console.log('');
|
|
96
130
|
console.log('═══════════════════════════════════════════════════════════════');
|
|
97
|
-
console.log(' JAELIS EXTERNAL NODE v2.
|
|
131
|
+
console.log(' JAELIS EXTERNAL NODE v2.2.0');
|
|
98
132
|
console.log('═══════════════════════════════════════════════════════════════');
|
|
133
|
+
if (this.nodeName) {
|
|
134
|
+
console.log(` Node Name: ${this.nodeName}`);
|
|
135
|
+
}
|
|
99
136
|
console.log(` Network: ${this.networkConfig.name}`);
|
|
100
137
|
console.log(` Chain ID: ${this.networkConfig.chainId}`);
|
|
101
138
|
console.log(` Node ID: ${this.nodeId}`);
|
|
@@ -215,6 +252,7 @@ class JaelisNode extends EventEmitter {
|
|
|
215
252
|
|
|
216
253
|
return {
|
|
217
254
|
nodeId: this.nodeId,
|
|
255
|
+
nodeName: this.nodeName || null,
|
|
218
256
|
network: this.network,
|
|
219
257
|
chainId: this.networkConfig.chainId,
|
|
220
258
|
isRunning: this.isRunning,
|
|
@@ -223,7 +261,7 @@ class JaelisNode extends EventEmitter {
|
|
|
223
261
|
uptimeFormatted: this._formatUptime(uptime),
|
|
224
262
|
currentBlock: this.storage?.getLatestBlockNumber() || 0,
|
|
225
263
|
stats: this.stats,
|
|
226
|
-
version: '2.
|
|
264
|
+
version: '2.2.0',
|
|
227
265
|
rpcPort: this.enableRpc ? this.rpcPort : null
|
|
228
266
|
};
|
|
229
267
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jaelis-node",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "Official JAELIS Blockchain External Node - Connect to the JAELIS network, sync blocks, and expose local RPC for your dApps. Zero gas fees, multi-chain interop.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"files": [
|
|
10
10
|
"lib/",
|
|
11
11
|
"bin/",
|
|
12
|
+
"SKILL.md",
|
|
12
13
|
"README.md"
|
|
13
14
|
],
|
|
14
15
|
"scripts": {
|