jaelis-node 2.1.0 → 2.2.1
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 +12 -6
- package/SKILL.md +356 -0
- package/bin/jaelis-node.js +2 -2
- package/lib/node.js +3 -3
- package/lib/sync.js +17 -3
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -41,8 +41,8 @@ npm install -g jaelis-node
|
|
|
41
41
|
# Start on testnet (default)
|
|
42
42
|
jaelis-node
|
|
43
43
|
|
|
44
|
-
# Start on mainnet
|
|
45
|
-
jaelis-node --network mainnet
|
|
44
|
+
# Start on mainnet (coming soon — not yet live)
|
|
45
|
+
# jaelis-node --network mainnet
|
|
46
46
|
|
|
47
47
|
# Name your node (persists across restarts)
|
|
48
48
|
jaelis-node --name MARBIT
|
|
@@ -173,10 +173,10 @@ JAELIS uses the `jaelis_*` namespace for all RPC methods:
|
|
|
173
173
|
|
|
174
174
|
## Network Info
|
|
175
175
|
|
|
176
|
-
| Network | Chain ID | Main RPC | WebSocket |
|
|
177
|
-
|
|
178
|
-
| Testnet | 4545 | https://rpc.jaelis.io | wss://rpc.jaelis.io/ws |
|
|
179
|
-
| 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** |
|
|
180
180
|
|
|
181
181
|
## Why Run Your Own Node?
|
|
182
182
|
|
|
@@ -238,6 +238,12 @@ rm -rf ./jaelis-data
|
|
|
238
238
|
jaelis-node
|
|
239
239
|
```
|
|
240
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
|
+
|
|
241
247
|
## Links
|
|
242
248
|
|
|
243
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
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* jaelis-node --data-dir ./mydata # Custom data directory
|
|
13
13
|
* jaelis-node --name MARBIT # Name your node
|
|
14
14
|
*
|
|
15
|
-
* @version 2.
|
|
15
|
+
* @version 2.2.0
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
'use strict';
|
|
@@ -21,7 +21,7 @@ const { Command } = require('commander');
|
|
|
21
21
|
const { JaelisNode } = require('../lib/node');
|
|
22
22
|
|
|
23
23
|
// Version check - notify if update available
|
|
24
|
-
const VERSION = '2.
|
|
24
|
+
const VERSION = '2.2.0';
|
|
25
25
|
checkForUpdates();
|
|
26
26
|
|
|
27
27
|
// CLI setup
|
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';
|
|
@@ -128,7 +128,7 @@ class JaelisNode extends EventEmitter {
|
|
|
128
128
|
|
|
129
129
|
console.log('');
|
|
130
130
|
console.log('═══════════════════════════════════════════════════════════════');
|
|
131
|
-
console.log(' JAELIS EXTERNAL NODE v2.
|
|
131
|
+
console.log(' JAELIS EXTERNAL NODE v2.2.0');
|
|
132
132
|
console.log('═══════════════════════════════════════════════════════════════');
|
|
133
133
|
if (this.nodeName) {
|
|
134
134
|
console.log(` Node Name: ${this.nodeName}`);
|
|
@@ -261,7 +261,7 @@ class JaelisNode extends EventEmitter {
|
|
|
261
261
|
uptimeFormatted: this._formatUptime(uptime),
|
|
262
262
|
currentBlock: this.storage?.getLatestBlockNumber() || 0,
|
|
263
263
|
stats: this.stats,
|
|
264
|
-
version: '2.
|
|
264
|
+
version: '2.2.0',
|
|
265
265
|
rpcPort: this.enableRpc ? this.rpcPort : null
|
|
266
266
|
};
|
|
267
267
|
}
|
package/lib/sync.js
CHANGED
|
@@ -53,8 +53,15 @@ class SyncManager extends EventEmitter {
|
|
|
53
53
|
// Get local height
|
|
54
54
|
this.localHeight = await this.storage.getLatestBlockNumber();
|
|
55
55
|
|
|
56
|
-
// Connect WebSocket
|
|
57
|
-
|
|
56
|
+
// Connect WebSocket — if the endpoint is down, schedule reconnect
|
|
57
|
+
// instead of crashing the whole process
|
|
58
|
+
try {
|
|
59
|
+
await this._connect();
|
|
60
|
+
} catch (error) {
|
|
61
|
+
console.error('[SYNC] Initial connection failed:', error.message);
|
|
62
|
+
this._scheduleReconnect();
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
58
65
|
|
|
59
66
|
// Get network height and start sync
|
|
60
67
|
await this._initialSync();
|
|
@@ -98,10 +105,17 @@ class SyncManager extends EventEmitter {
|
|
|
98
105
|
});
|
|
99
106
|
|
|
100
107
|
this.ws.on('error', (error) => {
|
|
108
|
+
console.error('[SYNC] WebSocket error:', error.message);
|
|
101
109
|
if (!this.isConnected) {
|
|
110
|
+
// Initial connection failed — reject the promise so start()
|
|
111
|
+
// can catch it and call _scheduleReconnect(). The 'close'
|
|
112
|
+
// event will fire next; we return early so it doesn't also
|
|
113
|
+
// call _scheduleReconnect a second time.
|
|
102
114
|
reject(error);
|
|
115
|
+
return;
|
|
103
116
|
}
|
|
104
|
-
|
|
117
|
+
// Don't emit('error') — Node crashes if no listener is attached.
|
|
118
|
+
// The 'close' event will fire after this and trigger _scheduleReconnect.
|
|
105
119
|
});
|
|
106
120
|
|
|
107
121
|
} catch (error) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jaelis-node",
|
|
3
|
-
"version": "2.1
|
|
3
|
+
"version": "2.2.1",
|
|
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": {
|