XELIS: Smart Contracts & VM Update

Xelis Community
5 min read14 hours ago

Vision of Smart Contracts on XELIS

The XELIS ecosystem is designed to support Layer 1 private smart contracts and decentralized applications (dApps) & assets using its native utility coin, XELIS. This coin will facilitate all transactions and fees within the network, including payments for smart contract execution, ensuring a seamless user experience.

Key Features of XELIS:

  • Utility Coin: XELIS will be used for transaction fees, smart contract operations, and dApp interactions, promoting an integrated and efficient economic model.
  • Future Smart Contract Implementation: While Smart Contracts are not yet available on the XELIS mainnet, their upcoming integration to testnet is expected to enhance the platform’s functionality and give a test environment for developers to start building.
  • XELIS Virtual Machine (XVM): The XVM is a dedicated execution environment which will utilize bytecode-compiled like EVM. It supports a robust set of programming constructs, providing developers with a familiar and powerful programming environment. Unlike EVM, XVM support already several built-in types, (string, bool, integers variants, arrays and structs), helping developers to more easily use them. Smart Contract programs will be able to be built by: Assembler (raw “bytecode instructions”) or using our own syntax (Silex) (traditional programming language interpreted from Rust)

By leveraging XELIS as a universal medium for transactions and contract execution, the ecosystem aims to ensure efficient processing and foster growth and sustainability in private and high performant blockchain applications.

Smart Contract Development Update:

Core Development of the Xelis VM

Key Components:

Lexer, Parser, Interpreter (Legacy), Compiler, and VM: A complete pipeline is in placeto handle code from tokenization to bytecode execution, which forms the basis for smart contract processing.

Lexer: This will go through the whole Silex source code a developer writes and will iterate over all characters and create a Token from it.

Parser: Using the tokens list previously genererated by the Lexer, Parser will verify that the program is valid (value types are respected, functions are formed correctly while building the Program). This Program can either be executed by the Interpreter or be used to compile a bytecode program (named Module)

Complier: Using an AST Program, it will convert it into a bytecode module by emitting opcodes. Each chunk can represent a function (or a part of a code if done using Assembler).

VM: Virtual Machine that will follow the bytecode process until its end or until there is not enough fees to cover the execution. This is the “Smart Contract Engine” as its this part that will execute the finalized code (and that will embed in the chain), all other parts are “client-side”

Stack-Based VM: EVM is a 256-bit VM, but XVM is different, it will be supporting in VM directly in the different types. This can be useful as people can select which exact value type they need. The 256-bit nature of EVM is one of the things that really holds back EVM performance, and Xelis seeks to solve this.

A Proof-of-Concept VM now successfully runs benchmarks like the prime number finder (1.085s for 5000 primes).

Optimization Efforts

Performance Gains:

Prime Benchmark reduced from 2.739s to 1.7658s due to stack optimization.

Further optimizations brought the time to 750ms, approaching Python’s performance(400ms-650ms).

Optimizations Used:

Prevented cloning of values using Rc/RefCell, improving stack handling.

Adopted lookup tables for instruction processing, reducing dispatch times.

Shunting Yard Algorithm & Non-Recursive Parsing

Shunting Yard Algorithm:

Handles operator precedence in mathematical expressions.

Moving towards iterative parsing to prevent stack overflows in large expressions.

Non-Recursive Parser:

Eliminating recursion for expression parsing, which is critical for handling complex smart contracts.

Smart Contract Implementation

Stack-Based VM:

Xelis aims to support smart contracts efficiently by leveraging a stack-based architecture.

Bytecode Representation: Programs will be stored as bytecode, compressing functions and variables for readability and on-chain transparency.

DAG Integration:

Development still remains in applying to the DAG Transaction Protocol by adding a new variant and optimizing storage.

Memory Management & Syscall Support

Memory Improvements:

Memory management optimized for nested loops and function calls, improving stack efficiency.

Syscalls:

Added syscall support for environment interaction, such as invoking system-level functions in smart contracts.

Array Handling and Expression Parsing

Array Handling:

Array indexing now uses 32-bit to ensure compatibility across both 32-bit and 64-bit systems.

Expression Parsing:

Complex expressions, including arrays and operations, are now handled more efficiently.

Next Steps

Shunting Yard Algorithm: Complete its implementation to ensure proper operator precedence handling.

Iterative Interpreter: Move remaining recursive interpreter functions to iterative ones forimproved scalability.

DAG Smart Contract Integration: Ensure seamless execution of smart contracts within the Xelis DAG.

Performance Boosts: Continue exploring optimizations such as LRU-cached stacks.

Community Contributions

GitHub has seen active contributions, particularly in optimizing the VM and improving performance through community collaboration.

Conclusion

The vision for Smart Contracts on the XELIS platform represents a significant advancement in the realm of private decentralized applications and private asset management. With the native utility coin, XELIS, at the core of transaction facilitation, the ecosystem promises to deliver a seamless and efficient user experience.

As we look forward to the integration of Smart Contracts into the testnet, developers will gain valuable insights and opportunities to start building on this innovative infrastructure. The XELIS Virtual Machine (XVM) is designed to optimize performance and enhance usability, leveraging a stack-based architecture that streamlines contract execution and ensures high efficiency.

Recent development updates highlight substantial progress in core components, optimizations, and performance benchmarks, demonstrating a strong commitment to creating a robust environment for Smart Contracts. The ongoing community contributions further enhance the platform’s capabilities, fostering collaboration and innovation.

In conclusion, the XELIS ecosystem is poised for growth, enabling efficient processing and paving the way for sustainable and high-performance blockchain applications. As Smart Contracts become a reality, XELIS will empower developers and users alike, shaping the future of decentralized technology.

(Thank you to our Guest Author today Eevil for his contributions to this article. Discord Handle: eevohl)

Thank you for taking the time to read this article on Xelis. If you enjoyed the content and found it helpful, consider supporting my work by sending a tip in Xelis $XEL. Your contribution goes a long way in helping me continue to create quality content like this. Your support is greatly appreciated!

— Cyber (Telegram: cybernated_coinage | Discord: cybernatedcoinage )

Tipping Address:

xel:82zfcy3aa2pk2rzx6jpfnv7u3vkjcxhqs3hyghj45u9g2ccrrslsqk3vm3x

Important Links:

Xelis LinkTree: https://linktr.ee/xelis

Website: https://xelis.io

Whitepaper/docs: https://docs.xelis.io

Github: https://github.com/xelis-project/

Telegram: https://t.me/xelis_io

Discord: https://discord.gg/xelis

Twitter/x: https://twitter.com/xelis_project

Official Medium: https://medium.com/xelis-project

Explorer: https://explorer.xelis.io

Stats page: https://stats.xelis.io

Coingecko page: https://www.coingecko.com/en/coins/xelis

Livecoinwatch page: https://www.livecoinwatch.com/price/XELIS-__XEL

Coinpaprika page: https://coinpaprika.com/coin/xel-xelis/

Community medium: https://xeliscommunity.org

Desktop/Mobile Wallet: https://github.com/xelis-project/xelis-genesix-wallet/releases/tag/0.0.5

Web-wallet: https://wallet.xelis.io

Faucet: https://faucet.xelis.io

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Xelis Community advances the Xelis ecosystem through research, journalism, and outreach, covering insights, news, and promoting adoption, awareness, and growth.