A smart contract is a computer protocol intended to digitally facilitate, verify, or enforce the negotiation or performance of a contract. Smart contract based on blockchain technology supports programmable contract. With the advantages of decentralization, unalterable, transparent and traceable, smart contract is a set of consensus defined by the contract developers, which be published, stored, and executed on the chain. Users sign in with private keys to provide identification to be a consensus participant. The implementation process is atomic, and the results obtained are equivalent.
WaykiChain uses Lua as the programming language to build up the contract framework.
Lua is a lightweight and extensible language which has been extensively used in game development, standalone scripting and database plug-ins. WaykiChain’s core functions are all developed by C/C++, and Lua code can be easily called by C/C++ code, or C/C++ functions can be called in reverse. As a programming language with low learning cost, good compatibility, high performance and security, Lua is an ideal language for building a smart contract framework.
The Lua 5.3 version of the virtual machine used in the framework designed a mylib library at the virtual machine level to open the interface to the contract layer, which follows the design of the Lua standard function library.
Different from common Lua virtual machines, smart contract code is executed on all nodes in the chain, including miner nodes and observer nodes. Therefore, the smart contract virtual machine does not support most of the Lua standard function libraries:
On the basis of characteristics of the blockchain, WaykiChain smart contract framework also has the following features: internal currency system, decentralized deployment and operation, free and transparent coding style. You can also check the input/output information of each contract transation through the JsonRpc interface or block explorer.