jaelis-node 1.4.1 → 1.5.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.
Files changed (3) hide show
  1. package/README.md +35 -7
  2. package/lib/index.js +70 -0
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -13,7 +13,36 @@ JAELIS is a next-generation blockchain with a **Universal Virtual Machine** that
13
13
 
14
14
  ## Universal VM - Core Innovation
15
15
 
16
- The JAELIS Universal VM executes contracts from multiple ecosystems natively:
16
+ JAELIS provides **TWO deployment systems** for maximum flexibility:
17
+
18
+ ### Option 1: Unified VM (Cross-Language Magic)
19
+
20
+ Compile **MULTIPLE contracts from MULTIPLE languages** into **ONE unified bytecode bundle** with **ONE ABI**:
21
+
22
+ ```javascript
23
+ // Deploy unified bundle - ALL languages compile to ONE bytecode!
24
+ const result = await jaelis.deployUnified({
25
+ from: '0x...',
26
+ sources: [
27
+ { code: solidityCode, language: 'solidity', name: 'Token' },
28
+ { code: rustCode, language: 'rust', name: 'DeFi' },
29
+ { code: moveCode, language: 'move', name: 'NFT' }
30
+ ]
31
+ });
32
+ // ALL contracts share memory and can call each other DIRECTLY!
33
+ ```
34
+
35
+ ### Option 2: Multi-VM (Native Compatibility)
36
+
37
+ Deploy to **native VMs** for exact compatibility with original chain behavior:
38
+
39
+ ```javascript
40
+ await jaelis.deploySolanaProgram({ bytecode, programId, owner }); // → SVM
41
+ await jaelis.deployMoveModule({ bytecode, moduleName, owner }); // → MoveVM
42
+ await jaelis.deployTonContract({ code, data, owner }); // → TVM
43
+ ```
44
+
45
+ ### Language Support Matrix
17
46
 
18
47
  | Language | Ecosystem | Status |
19
48
  |----------|-----------|--------|
@@ -24,12 +53,10 @@ The JAELIS Universal VM executes contracts from multiple ecosystems natively:
24
53
  | **Cairo** | StarkNet | Production |
25
54
  | **Vyper** | Ethereum (Python-like) | Production |
26
55
 
27
- ### Cross-Language Contract Calls
28
-
29
- A Solidity contract can call a Rust contract. A Move module can interact with FunC. All native, all on-chain:
56
+ ### Cross-Language Contract Calls (NO BRIDGES!)
30
57
 
31
58
  ```javascript
32
- // Solidity contract calling a Rust program
59
+ // Solidity Rust call - DIRECT, no bridges needed!
33
60
  await jaelis.crossContractCall({
34
61
  from: solidityContract,
35
62
  to: rustProgram,
@@ -148,9 +175,10 @@ Your node exposes standard JSON-RPC plus JAELIS-specific methods:
148
175
  | Method | Description |
149
176
  |--------|-------------|
150
177
  | `jaelis_getSupportedLanguages` | Returns: `['solidity', 'rust', 'move', 'func', 'cairo', 'vyper']` |
151
- | `jaelis_deployContract` | Deploy contract in any supported language |
178
+ | `jaelis_deployUnified` | Deploy unified bundle (multiple languages ONE bytecode!) |
179
+ | `jaelis_deployContract` | Deploy single contract in any supported language |
152
180
  | `jaelis_executeContract` | Execute contract method |
153
- | `jaelis_crossContractCall` | Call between contracts of different languages |
181
+ | `jaelis_crossContractCall` | Call between contracts of different languages (NO BRIDGES!) |
154
182
 
155
183
  ### Cross-Chain Settlement Methods
156
184
  | Method | Description |
package/lib/index.js CHANGED
@@ -1276,11 +1276,18 @@ class EmbeddedRpcServer {
1276
1276
  vmActive: !!this.blockchain?.vmExecutor
1277
1277
  };
1278
1278
 
1279
+ case 'jaelis_deploy':
1279
1280
  case 'jaelis_deployContract':
1280
1281
  // Deploy contract in ANY language!
1281
1282
  // params: [source, language, options]
1282
1283
  return this._deployContract(params[0], params[1], params[2] || {});
1283
1284
 
1285
+ case 'jaelis_deployUnified':
1286
+ // THE KEY INNOVATION: Deploy unified contract bundle!
1287
+ // Compile MULTIPLE contracts from MULTIPLE languages into ONE bytecode!
1288
+ // params: [{ from, sources: [{ code, language, name }...] }]
1289
+ return this._deployUnified(params[0]);
1290
+
1284
1291
  case 'jaelis_executeContract':
1285
1292
  // Execute contract call
1286
1293
  // params: [to, functionName, args, options]
@@ -1589,6 +1596,69 @@ class EmbeddedRpcServer {
1589
1596
  };
1590
1597
  }
1591
1598
 
1599
+ /**
1600
+ * Deploy unified contract bundle (THE KEY INNOVATION!)
1601
+ *
1602
+ * Compiles MULTIPLE contracts from MULTIPLE languages into ONE bytecode bundle.
1603
+ * All contracts share memory and can call each other DIRECTLY - no bridges!
1604
+ *
1605
+ * @param {Object} params - { from, sources: [{ code, language, name }...] }
1606
+ */
1607
+ async _deployUnified(params) {
1608
+ if (!this.blockchain) throw new Error('Blockchain not available');
1609
+ if (!this.blockchain.unifiedVM) throw new Error('Unified VM not available');
1610
+
1611
+ const { from, sources } = params;
1612
+
1613
+ if (!sources || !Array.isArray(sources) || sources.length === 0) {
1614
+ throw new Error('sources array is required for unified deployment');
1615
+ }
1616
+
1617
+ console.log(`[RPC] Deploying unified bundle with ${sources.length} contracts...`);
1618
+ console.log(`[RPC] Languages: ${[...new Set(sources.map(s => s.language))].join(', ')}`);
1619
+
1620
+ // Compile all sources together using the Unified Compiler
1621
+ const compiled = await this.blockchain.unifiedVM.compileBundle(sources);
1622
+
1623
+ // Deploy the unified bytecode
1624
+ const address = '0x' + require('crypto').randomBytes(20).toString('hex');
1625
+
1626
+ // Store the unified contract
1627
+ if (this.blockchain.contracts) {
1628
+ this.blockchain.contracts.set(address, {
1629
+ bytecode: compiled.bytecode,
1630
+ abi: compiled.abi || [],
1631
+ sources: sources.map(s => s.name),
1632
+ languages: [...new Set(sources.map(s => s.language))],
1633
+ deployedAt: Date.now(),
1634
+ deployer: from
1635
+ });
1636
+ }
1637
+
1638
+ console.log(`[RPC] Unified bundle deployed at ${address}`);
1639
+ console.log(`[RPC] Bytecode: ${compiled.bytecode?.length || 0} bytes`);
1640
+ console.log(`[RPC] Cross-references: ${compiled.crossReferences?.size || 0}`);
1641
+
1642
+ // Build contracts map for response
1643
+ const contractsMap = {};
1644
+ for (const source of sources) {
1645
+ contractsMap[source.name] = {
1646
+ address: address, // All share the same bundle address
1647
+ language: source.language,
1648
+ name: source.name
1649
+ };
1650
+ }
1651
+
1652
+ return {
1653
+ address,
1654
+ bytecode: compiled.bytecode?.toString('hex'),
1655
+ abi: compiled.abi || [],
1656
+ contracts: contractsMap,
1657
+ metadata: compiled.metadata,
1658
+ gasUsed: 0 // ZERO FEES!
1659
+ };
1660
+ }
1661
+
1592
1662
  async _executeContract(to, functionName, args, options) {
1593
1663
  if (!this.blockchain) throw new Error('Blockchain not available');
1594
1664
  return this.blockchain.executeContract(to, functionName, args, options);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jaelis-node",
3
- "version": "1.4.1",
3
+ "version": "1.5.0",
4
4
  "description": "Official JAELIS Blockchain Node - Universal VM (6 languages), LevelDB state persistence, native jaelis_* RPC, multi-ecosystem compatibility (eth/solana/move/ton/btc/wasm/starknet), Cross-Chain Settlement (30+ chains!)",
5
5
  "main": "lib/index.js",
6
6
  "bin": {