MultiVM capabilities

Details are provisional and may be updated during development.

Unified Asset Management

Phase 1: Cross-VM Asset Queries

While your existing development tools work unchanged, Arichain adds powerful new capabilities for managing assets across both virtual machines through a unified interface.

// Install the Arichain SDK alongside your existing tools
npm install @arichain/sdk

// Use with your existing Web3 libraries
import { ArichainClient } from '@arichain/sdk';
import { ethers } from 'ethers';
import { Connection, PublicKey } from '@solana/web3.js';

const arichain = new ArichainClient({
    evmRpc: 'https://evm-testnet.arichain.network (TBD)',
    svmRpc: 'https://svm-testnet.arichain.network (TBD)'
});

// Query assets across both VMs with a single call
const userAssets = await arichain.getUnifiedAssets('0x742d35Cc6Db09E7E85CCf29B82FcCBa94EAA78AE');

console.log(userAssets);
// Response includes assets from both VMs:
// {
//   evm: {
//     ARI: '150',
//     USDC: '1000.0',
//     WETH: '2.3',
//     customTokens: [...]
//   },
//   svm: {
//     ARI: '50',
//     USDT: '500.0',
//     SOL: '8.7',
//     splTokens: [...]
//   },
//   totalValue: {
//     ARI: '150',
//     ...
//   },
//   crossVMCapabilities: {
//     canTransferARI: true,
//     linkedAccounts: true
//   }
// }

Account Mapping System

Arichain provides seamless account mapping between EVM and SVM addresses, enabling unified identity across both virtual machines.

// Your single private key works for both VMs
const privateKey = "0x1234..."; // Your existing private key

// EVM wallet (existing approach)
const evmWallet = new ethers.Wallet(privateKey);
console.log("EVM Address:", evmWallet.address);

// SVM wallet (existing approach)  
const svmKeypair = Keypair.fromSecretKey(
    bs58.decode(privateKey) // Standard conversion
);
console.log("SVM Address:", svmKeypair.publicKey.toString());

// Find mapped addresses (new MultiVM capability)
const mappedSvmAddress = await arichain.getMappedAddress(
    evmWallet.address,
    'svm'
);

const mappedEvmAddress = await arichain.getMappedAddress(
    svmKeypair.publicKey.toString(),
    'evm'
);

// Check if addresses are already linked
const linkStatus = await arichain.getAccountLinkStatus(evmWallet.address);
console.log(linkStatus);
// {
//   isLinked: true,
//   svmAddress: "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM",
//   linkTimestamp: "2025-06-20T10:30:00Z",
//   crossVMTransactionsEnabled: true
// }

Unified Balance Tracking

// Get comprehensive balance across all VMs
const balance = await arichain.getUnifiedBalance('0x742d35Cc6Db09E7E85CCf29B82FcCBa94EAA78AE');

// Get detailed breakdown by VM and token type
const breakdown = await arichain.getBalanceBreakdown('0x742d35Cc6Db09E7E85CCf29B82FcCBa94EAA78AE');
console.log(breakdown);
// {
//   evm: {
//     native: { ARI: '150.2' },
//     erc20: [
//       { symbol: 'USDC', amount: '1000.0' },
//       { symbol: 'WETH', amount: '2.3' }
//     ],
//     nfts: [
//       { collection: 'BoredApes', count: 2 },
//       { collection: 'CryptoPunks', count: 1 }
//     ]
//   },
//   svm: {
//     native: { ARI: '50.5' },
//     spl: [
//       { symbol: 'USDT', amount: '500.0' },
//       { symbol: 'SOL', amount: '8.7' }
//     ],
//     nfts: [
//       { collection: 'DeGods', count: 5 },
//       { collection: 'MadLads', count: 3 }
//     ]
//   }
// }

// Real-time balance monitoring
arichain.onBalanceChange('0x742d35Cc6Db09E7E85CCf29B82FcCBa94EAA78AE', (change) => {
    console.log(`Balance changed on ${change.vm}: ${change.delta} ${change.token}`);
    // Automatically update UI across all connected applications
});

Advanced Features

Phase 2: Cross-VM Interactions (In Development)

Future versions of Arichain will support direct interactions between EVM contracts and SVM programs, enabling seamless cross-VM functionality.

// Preview of upcoming capabilities - EVM wallet calling SVM program
const multiVMWallet = new MultiVMWallet(window.ethereum); // Use MetaMask

// Call Solana program directly from EVM wallet
const result = await multiVMWallet.callSolanaProgram({
    programId: 'GameProgramXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
    instruction: 'process_battle',
    accounts: [
        { pubkey: playerAccount, isSigner: false, isWritable: true },
        { pubkey: gameStateAccount, isSigner: false, isWritable: true },
        { pubkey: systemProgram, isSigner: false, isWritable: false }
    ],
    data: battleData,
    signers: [] // MultiVM handles signing
});

console.log("Cross-VM transaction result:", result);
// User sees unified transaction in MetaMask
// Game state updates on SVM
// Assets transfer across VMs atomically

Cross-VM Data Fetching (In Development)

Enable EVM contracts to query SVM program state and vice versa, creating truly interconnected applications.

// Preview: EVM contract accessing SVM data
pragma solidity ^0.8.19;

import "@arichain/cross-vm/ICrossVMBridge.sol";

contract CrossVMOracle {
    ICrossVMBridge public constant BRIDGE = ICrossVMBridge(0x1234...);
    
    // Query Solana program data from EVM contract
    function getGameScore(bytes32 playerId) 
        external view returns (uint256) {
        // This queries SVM state from within EVM execution
        bytes memory result = BRIDGE.querySolanaData(
            "GameProgramXXXXXXXXXXXXXXXXXXXXXXXXXXXX", // Program ID
            abi.encode("get_player_score", playerId)
        );
        return abi.decode(result, (uint256));
    }
    
    // Trigger SVM program execution from EVM
    function updateGameRewards(bytes32 playerId, uint256 score) 
        external {
        BRIDGE.callSolanaProgram(
            "GameProgramXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
            abi.encode("update_rewards", playerId, score),
            msg.sender // Original caller context preserved
        );
        
        emit GameRewardUpdated(playerId, score);
    }
    
    // Handle callback from SVM program
    function onSolanaCallback(
        bytes32 requestId,
        bytes calldata result
    ) external onlyBridge {
        // Process results from SVM program execution
        // This creates truly bidirectional communication
    }
}
// Preview: SVM program accessing EVM data
use anchor_lang::prelude::*;

#[program]
pub mod cross_vm_game {
    use super::*;
    
    pub fn process_battle_with_evm_data(
        ctx: Context<ProcessBattle>,
        player_id: [u8; 32]
    ) -> Result<()> {
        // Query EVM contract data from SVM program
        let evm_data = cross_vm::query_evm_contract(
            "0x1234567890123456789012345678901234567890", // Contract address
            "getPlayerStats",
            &player_id
        )?;
        
        let player_stats: PlayerStats = evm_data.try_into()?;
        
        // Use EVM data in SVM computation
        let battle_result = calculate_battle_outcome(
            &ctx.accounts.game_state,
            &player_stats
        )?;
        
        // Update SVM state based on EVM data
        ctx.accounts.game_state.update_battle_result(battle_result)?;
        
        // Optionally call back to EVM
        cross_vm::call_evm_contract(
            "0x1234567890123456789012345678901234567890",
            "onBattleComplete",
            &[player_id, battle_result.to_bytes()]
        )?;
        
        Ok(())
    }
}

Last updated