Open moraleinside opened 5 years ago
More links about Vite:
Website: https://vite.org/ White Paper: https://github.com/vitelabs/whitepaper/blob/master/vite_cn.pdf
@AllenLiuxt @soliury, thanks for your attentions on ShadowNode and general guidance about smart contract, the following is my answers:
Need to remove some semantics that may lead to inconsistent execution results, such as asynchronous ops and system calls.
JavaScript VM actually doesn't declare any asynchronous operations. See the project https://github.com/pando-project/jerryscript, which is the low-level VM of ShadowNode, too. That is a pure JavaScript environment that fits your need :)
Consider how to implement resource consumption calculations at bytecode level.
@AllenLiuxt take a look at https://github.com/pando-project/jerryscript/blob/master/jerry-core/vm/vm.c#L903, which executes every OPCODE in JerryScript, and at ShadowNode, we documented the opcode table at https://github.com/yodaos-project/ShadowNode/wiki/OP-Code-Table.
The current threshold for developing smart contracts is relatively high, resulting in fewer developers. We would like to reduce the difficulty by leveraging a popular programming language and modern virtual machine.
JerryScript is not a full-ES6 implementation, so if we choose that as the smart contract VM, developers could not use some features like: const/let, rest arguments... :(
Hey, talents of ShadowNode, my name is Allen Liu, the engineering director of Vite Labs. Yesterday we had a wonderful talk with Yorkie regarding some of thoughts on ShadowNode, and also possibility of further collaborations between us. Here we submit this issue as start.
Vite Labs is a blockchain startup and we are developing a public blockchain project similar to Bitcoin and Ethereum but much better. We have implemented EVM-based smart contracts, however, our recent testing shows it does not 100% meet the needs. The current threshold for developing smart contracts is relatively high, resulting in fewer developers. We would like to reduce the difficulty by leveraging a popular programming language and modern virtual machine.
What is smart contract?
In general, a smart contract consists of a piece of code and relevant storage. When user trades on blockchain, the contract code will be automatically triggered and starts execution, and in the end complete transferring assets and modifying storage. The code of smart contract is written by contract deployer and deployed on blockchain. Contract codes typically contain mathematical calculations, storage access, and instructions of interactions with blockchain such as querying account balance, obtaining random number, calling other contract, etc.
The module that executes smart contract is called blockchain virtual machine. Unlike traditional virtual machine, blockchain virtual machine must possess two essential characteristics:
The current smart contract programming language of Vite is called Solidity++, which is adopted from Solidity but with many more Vite-specific upgrades. However, Solidity is relatively narrow in practical use, and it is designed to be more oriented in security than other aspects such as performance, usability or popularity. The virtual machine in Vite is also developed on the basis of EVM. It is a stack-based 256-bit virtual machine, which ensures the execution of the same piece of code on different machines is identical and resulting in the same execution result. Gas calculation on Vite’s VM is performed at instruction level.
In order to reduce the development threshold of smart contracts and attract more people to the platform, we are assessing some popular programming languages. One possible choice is Javascript + v8 engine. Javascript has solid user group and mature ecosystem, while v8 is able to guarantee stable execution results. To migrate them into blockchain environment, two major problems are yet to be solved:
Related documents: Solidity doc https://solidity.readthedocs.io/en/v0.5.7/ Solidity++ upgrades on Solidity https://vite.wiki/tutorial/contract/soliditypp.html EVM https://github.com/ethereum/wiki/wiki/Ethereum-Virtual-Machine-(EVM)-Awesome-List