Skip to content

Latest commit

 

History

History
115 lines (74 loc) · 6.86 KB

README.md

File metadata and controls

115 lines (74 loc) · 6.86 KB

EpicChainVM++-Runtime

EpicChainVM++: A C++ Implementation for EpicChain Blockchain Virtual Machine

Welcome to the EpicChainVM++ project, a robust C++ implementation of the EpicChain Blockchain Virtual Machine (VM). This initiative is part of the larger EpicChain macro project, which aims to provide a high-performance, portable, and versatile VM for the EpicChain blockchain ecosystem. Our goal is to create an efficient and scalable virtual machine capable of supporting the sophisticated operations of the EpicChain network.

Project Overview

EpicChainVM++ is designed to bring the power and flexibility of the EpicChain Virtual Machine into the realm of C++, providing enhanced performance and compatibility across a variety of platforms. This project builds upon the successful concepts of the original EpicChain VM, focusing on leveraging C++ to optimize performance, memory usage, and cross-platform capabilities.

Development Progress

  • BigInteger Libraries: The BigInteger libraries, crucial for handling large integers efficiently, have been completed. This provides the foundational support needed for high-precision arithmetic operations within the EpicChainVM++.
  • Porting BigInteger Libraries to EpicChainVM: We are currently in the process of porting these libraries into the EpicChainVM environment. This step involves integrating the BigInteger functionalities seamlessly with the EpicChain VM to ensure robust support for large numbers and complex calculations.
  • Porting JSON Tests: This is an upcoming task. We will be porting and adapting existing JSON-based tests to validate the functionality and performance of EpicChainVM++.

Commit Lock Reference

The project maintains a commit-lock reference to the core C# project, which is essential for ensuring consistency and stability across implementations. Currently, thirdparty/epicchain-vm-3 is locked at the following commit from the EpicChain VM repository:

This reference serves as the basis for development and should only be updated when the C++ project is ready to evolve or if the reference project is locked for an extended period.

Why Choose C/C++?

C and C++ offer unparalleled performance and low-level system access, making them ideal for building lightweight and high-performance components. High-level languages often introduce overhead that may not be suitable for extremely resource-constrained environments, such as embedded systems or microcontrollers. By using C/C++, EpicChainVM++ ensures that the VM can run efficiently across a wide range of devices and platforms.

Additionally, C/C++ is highly interoperable with other programming languages and systems. This compatibility facilitates the integration of EpicChainVM++ with various projects and environments, enhancing its versatility and utility.

Note: The project is currently being ported from the larger EpicChain ecosystem. There is significant interest in using this component separately, so expect further enhancements and updates in the near future.

Build Instructions

EpicChainVM++ offers two primary implementations for the EpicChain VM:

C++ Native Implementation

This implementation relies on the csBigInteger C++ libraries. To build the C++ native version on Debian-based systems (including Ubuntu), follow these steps:

  1. Install the necessary dependencies:
    sudo apt-get update
    sudo apt-get install libgmp-dev
  2. Run the build command:
    make vendor

Mono Implementation

The Mono implementation allows the use of nvm3_dotnet.dll through nvm3_mono.so, enabling compatibility with the original EpicChain VM on C#. This approach is more complex but ensures that the EpicChain VM functionality is preserved.

To build the Mono implementation, you will need to install Mono on your system:

  1. Add the Mono repository and install Mono:

    sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
    sudo apt install apt-transport-https ca-certificates
    echo "deb https://download.mono-project.com/repo/ubuntu stable-xenial main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
    sudo apt update
    sudo apt install mono-complete
  2. Follow the build instructions provided in the project to generate nvm3_dotnet.dll and nvm3_mono.so.

Testing

To ensure the integrity and functionality of EpicChainVM++, a comprehensive testing suite is included. After cloning the project with all submodules, you can run the tests using the following command:

make test

C++ Standard

The project currently adheres to the C++11 standard to maintain compatibility across various compilers and tools. However, it is recommended to migrate to C++17 as soon as possible to take advantage of newer features and improvements, provided it does not disrupt existing compatibility.

Development Tools and Configuration

Visual Studio Code (VSCode) IDE

For an optimal development experience with VSCode, install the following extensions:

  • C/C++ (currently 0.23.0-insiders2)
  • C++ Intellisense (currently 0.2.2)
  • GoogleTest Adapter (currently 1.8.3)

C++ Formatting Style

The adopted C++ formatting style is based on Mozilla, with an indentation level set to 3 spaces. For VSCode, use the following configuration:

{
    "[cpp]": {
        "editor.tabSize": 3,
        "editor.detectIndentation": false
    },
    "C_Cpp.clang_format_fallbackStyle": "{ BasedOnStyle: Mozilla, ColumnLimit: 0, IndentWidth: 3, AccessModifierOffset: -3 }"
}

Variable Naming Style

The naming conventions for variables and methods in EpicChainVM++ are influenced by C# practices. CamelCase is used, with public variables starting with uppercase letters and private or local variables starting with lowercase letters. This approach is intended to maintain consistency with the original C# reference project. For elements beyond the reference project scope, classic CamelCase naming in C++ can be used.

License

The EpicChainVM++ code is licensed under the MIT License. However, the implementation BigIntegerGMP.cpp, which relies on the GNU MP Bignum Library, is licensed under LGPLv3. Modifications or use of this implementation should comply with the LGPLv3 license.

The BigIntegerMono.cpp implementation follows the Mono license, which is also MIT License. Binaries produced by this project (nvm3_native.so or nvm3_mono.so) can be used freely in other projects, irrespective of their license.

For more information and to stay updated, please refer to the EpicChainVM++ GitHub repository.