npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

xcm-lib-zkverify

v1.0.0

Published

XCM asset teleportation and remote EVM calls for ZKVerify

Downloads

12

Readme

zkVerify XCM Library

A production-ready TypeScript library for cross-chain interactions between zkVerify Relay Chain and EVM parachains, featuring asset teleportation, remote EVM contract calls, and comprehensive testing infrastructure.

Features

  • 🔄 Asset Teleportation: Bidirectional asset transfer between Relay Chain and EVM parachains
  • 🚀 Remote EVM Calls: Execute smart contract functions on EVM parachains from Relay Chain via XCM
  • 🎯 ABI Support: Execute contract calls using either source code compilation or direct ABI
  • 🌐 Local Networks: Automated setup of local zkVerify networks for development and testing

Installation

npm install

Local Development Setup

Start Local Networks

For testing and development, you can run local zkVerify networks:

# First time setup (clones repos, builds relay chain, starts networks)
./scripts/local-networks.sh setup

# Start existing networks (after initial setup)
./scripts/local-networks.sh start

# Clean up all local network files
./scripts/local-networks.sh cleanup

Network Endpoints:

  • Relay Chain: ws://127.0.0.1:8855
  • Parachain: ws://127.0.0.1:8833

Configuration

The library uses a unified XcmConfig interface for all operations. You only provide the fields needed for your specific use case:

interface XcmConfig {
  // Endpoints - provide based on operation needs
  relayWsEndpoint?: string;
  evmParachainWsEndpoint?: string;
  evmParachainId?: number;
  
  // Private keys - provide based on operation type
  relayPrivateKey?: string;
  evmParachainPrivateKey?: string;
  
  // Optional XCM versions (with defaults)
  xcmRelayVersion?: string;      // defaults to V5
  xcmParachainVersion?: string;  // defaults to V2
}

Operation Requirements

  • Relay→Parachain: Requires relayPrivateKey + relayWsEndpoint + evmParachainId
  • Parachain→Relay: Requires evmParachainPrivateKey + evmParachainWsEndpoint
  • Remote EVM Calls: Requires both endpoints + relayPrivateKey + evmParachainId

Usage Examples

1. Asset Teleportation

Relay to Parachain

import { XcmTeleportService } from './src/services/xcm-teleport';

const config = {
  relayWsEndpoint: 'ws://127.0.0.1:8855',
  evmParachainWsEndpoint: 'ws://127.0.0.1:8833', // For balance queries
  evmParachainId: 1,
  relayPrivateKey: 'e5be9a5092b81bca64be81d212e7f2f9eba183bb7a90954f7b76361f6edb5c0a'
};

const service = new XcmTeleportService(config);
await service.initialize();

const result = await service.teleportToEvmParachain({
  amount: '1000000000000',
  destinationAddress: '0x1234567890123456789012345678901234567890'
});

await service.disconnect();

Parachain to Relay

const config = {
  relayWsEndpoint: 'ws://127.0.0.1:8855',     // For balance queries
  evmParachainWsEndpoint: 'ws://127.0.0.1:8833',
  evmParachainPrivateKey: 'cea930a090279ff8f832e550e45fd6f7c3f88f729dcad79e2a9dcbc0514111df'
};

const service = new XcmTeleportService(config);
await service.initialize();

const result = await service.teleportFromEvmParachain({
  amount: '1000000000000',
  destinationAddress: '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY' // Substrate address
});

await service.disconnect();

2. Remote EVM Calls

Execute smart contract functions on EVM parachains from the Relay Chain via XCM:

Using Contract Source Code

import { ExecuteRemoteEvmCallService } from './src/services/execute-remote-evm-call';

const config = {
  relayWsEndpoint: 'ws://127.0.0.1:8855',
  evmParachainWsEndpoint: 'ws://127.0.0.1:8833',
  evmParachainId: 1,
  relayPrivateKey: 'e5be9a5092b81bca64be81d212e7f2f9eba183bb7a90954f7b76361f6edb5c0a'
};

const service = new ExecuteRemoteEvmCallService(config);
await service.initialize();

const result = await service.executeRemoteEvmCall(
  {
    contractAddress: '0x1234567890123456789012345678901234567890',
    functionName: 'doWork',
    args: [42],
    gasLimit: '100000',
    value: '0'
  },
  './contract/test_contract.sol'  // Contract source path
);

await service.disconnect();

Using Direct ABI (Faster)

const result = await service.executeRemoteEvmCall(
  {
    contractAddress: '0x1234567890123456789012345678901234567890',
    functionName: 'doWork',
    args: [42]
  },
  undefined,                          // No contract path
  './contract/test_contract_abi.json' // Direct ABI path (takes precedence)
);

Environment Configuration

The library provides example environment files for different use cases. Copy the appropriate example file and update the values as needed:

# For relay to parachain transfers
cp .env.example.relay-to-parachain .env.relay-to-parachain

# For parachain to relay transfers  
cp .env.example.parachain-to-relay .env.parachain-to-relay

# For remote EVM calls
cp .env.example.execute-remote-evm-call .env.execute-remote-evm-call

Each example file contains all the necessary configuration options with comments explaining their purpose.

Testing

Prerequisites

Start local networks before running tests:

./scripts/local-networks.sh setup

Run Tests

# Run all tests
npm test

# Run specific tests
npm test -- relay-to-evm.test.ts
npm test -- evm-to-relay.test.ts
npm test -- execute-remote-evm-call.test.ts

# Build project
npm run build

Requirements

  • Node.js 18+
  • Rust & Cargo (for building local relay chain)
  • Git (for cloning repositories)