Chapter 1: Introduction to the Ontology Smart Contract

Ontology Smart Contract possesses dynamic features, including high scalability, high performance, multilingual, cross-contracts, cross-virtual-machines, etc., all integrated into one system. Ontology Smart Contract supports multiple programming languages, which saves the time of learning a new programming language for developers. Currently, supported programming languages include C# and Python. The programming languages that will be supported in the future are Java, C++, Rust, Go, and JavaScript.

The Ontology smart contract has certainty, high-performance, and expandable features. It includes two modules: Interactive Service and Virtual Machine. Interactive Service provides interaction between the virtual machine and blockchain ledger. Virtual Machine provides a smart contract execution environment. Interactive Service includes native service and NeoVM service. Native service provides special smart contract implementation in the blockchain, which can be quickly and conveniently used. NeoVM service provides the API of NeoVM to communicate externally, which can enhance the invoke function of the smart contract.

1.1 Contract Type

Ontology Smart Contract currently supports two types of contracts: Native Contract and NeoVM Contract. The Native contract is a contract written directly on the underlying level of Ontology. It has high execution efficiency and is greatly optimized for common contracts. Its services include Oracle, DID, and rights management, and data exchange will be implemented by Native contracts. The NeoVm contract is a contract that runs on the NeoVm virtual machine and you can write the corresponding contract code to implement it. The supported languages are Java, C#, and Python. NeoVm has the features of lightweight, scalability, and high-performance. By combining the Interop Service layer, the interaction between the virtual machine and the ledger layer can be well established.

1.2 Contract Execution Process

The execution of the Ontology smart contract requires input parameters and the corresponding virtual machine type. According to the different types of virtual machines, the scheduler will start the corresponding virtual machine for smart contract execution. During the execution, the contract uses AppCall command, including the needed parameters for contract operation, to trigger the smart contract scheduler. The scheduler will run the corresponding script in accordance with the input parameters until the contract operation has been completed.

1.3 Fee Model

The transaction fee is the product of gas limit and gas price. The gas limit is used to perform step counting in the opcode process when executing a smart contract. In theory, the more complex the smart contract, the higher the amount of gas limit required, and the lowest number of Gas limit on the Ontology transaction is 20000. The gas price is used to price the opcode. The higher the gas price, the likelier the consensus node will package the transaction first.

Chapter 2: Conclusion

The Ontology smart contract has obvious advantages. First, Ontology offers highly efficient development tools which support Python and other common programming languages, so that developers can develop contracts without the need to learn a new language, such as Solidity. Second, Ontology adopts a dual-token model that uses ONG as gas (the equivalent of Ethereum’s GAS). When more people use Ontology, the ONG gas fee increases, and vice versa. This kind of flexible cost meets the expectation of developers. In addition, unlike EOS, Ontology does not need to stake tokens for bandwidth and buy RAM, thus making it much more convenient for developers. Third, Ontology has an ultra-high TPS which can ensure user experience and encourage creativity.