Ontology Developer Center
DISCOVERCOMMUNITYSUPPORT
  • Introduction
  • Discover Ontology
  • Getting Started
  • Glossary
  • Decentralized Identity and Data
    • ONT ID
      • Decentralized Identifiers
        • Method Specification for Ontology
        • Method Specification for Ethereum
        • Method Specification for BSC
      • Verifiable Credentials
        • Anonymous Credentials
      • ONT Login
        • Scenarios
        • Protocol Specification
        • Front-end JavaScript SDK
          • Integration and Usage
          • API Reference
        • Front-end UI SDK
          • Integration and Usage
          • API Reference
        • Back-end Go SDK
          • Integration and Usage
          • API Reference
        • Back-end Java SDK
          • Integration and Usage
          • API Reference
      • ONT TAG
        • Workflow
        • API Reference
      • Mercury
      • OScore
    • DDXF
      • Components and Interfaces
      • GREP
      • Overall Scheme
      • Solutions
        • Marketplace
          • Deployment
          • Scenarios
          • SaaS Tenant
          • Java SDK
        • Data Storage
          • Deployment
          • Java SDK
        • Resource Auditor
        • Offline Judge
      • Use Cases
        • E-Shops
  • ONTOLOGY ELEMENTS
    • Smart Contracts
      • Types of smart contracts
    • Token Protocols
    • Consensus Mechanism
    • Ontology Oracle
      • Oracle Process Flow
  • GUIDES & TUTORIALS
    • Development Guides
      • dApp Development
        • Using the dAPI
        • Data Synchronization
      • Smart Contract Development
        • EVM Contract
          • Development Environment and Tools
          • Wallet Setup
          • Contract Development
          • How to Deploy a Smart Contract with GetBlock
        • NeoVM Contract
          • Development tools and environment
          • Launching the IDE
          • Writing and editing program logic
          • Deploying and testing on private net
        • WASM Contract
          • Development Environment
          • Project Initiation - Hello World
          • Creating your own project
          • Development using SmartX
          • Runtime API
          • Contract Fundamentals
          • Inter-contract Interaction
          • Developing Contracts in C++
        • Publish Contract Source Code
    • Integration Guides
      • dApp Integration
        • dAPI Integration
          • Chrome Plugin
          • Mobile wallet dApp
          • QR code mechanism
          • Wake call mechanism
        • Cocos 2D-x
        • Unity 3D applications
      • Mobile Wallet Integration
        • SDK integration
        • dAPI Integration
          • In-wallet applications
          • QR code mechanism
          • Wake call mechanism
        • Stake
      • Using ONT ID
      • Exchange Integration
        • Exchange Docking Guide
        • Exchange API
      • Ontology for dApp Stores
    • EVM & Token Decimals Upgrade
  • ONTOLOGY NODE
    • Abstract
    • Node Deployment
      • Standard Node
      • Rosetta Node
    • Interacting with a Public Node
  • DEVELOPER TOOLS
    • dApp Development Framework
      • Punica CLI
      • Punica boxes
      • Solo Chain
    • IDE
    • APIs
      • HTTP API
        • Restful
        • WebSocket
        • Remote Procedure Call (RPC)
      • Explorer v2 API
        • Block
        • Address
        • Contract
        • Token
        • Transactions
        • ONT ID
        • Summary
        • Node
      • Native Token API
        • ONT Contract API
        • ONG Contract API
      • ONT ID Contract API
      • Web3 API
      • OScore Open API
      • Rosetta Node API
        • Data API
        • Construction API
      • DToken Contract API
      • DDXF
        • Marketplace Contract API
        • Storage API
      • Governance API
    • Digital Wallet
      • Chrome Plugin provider
      • Chrome Plugin dAPI
      • Mobile version provider
      • Mobile version dAPI
    • SDKs
    • Signing Server
      • Installation
      • API reference
  • COMMUNITY
    • Ecosystem Programs
    • Community Libraries
    • Community Events
    • Community Channels
    • Core Contributors
  • SUPPORT
    • FAQ
      • Basic blockchain concepts
      • Ontology Nodes
      • Ontology token protocols
      • Smart contracts
      • SDKs and APIs
    • Contact Us
Powered by GitBook
On this page
  • What are the tools necessary to start developing smart contracts with Ontology?
  • What is the difference between execution and pre-execution?
  • What are native contracts and how to invoke them?
  • Is a contract hash linked to an account? Does it have a private key associated to it?
  • How to fetch values such as msg.sender or msg.value within the scope of a contract, much like Ethereum?
  • Is there an inbuilt timer or clock in the contract system?

Was this helpful?

  1. SUPPORT
  2. FAQ

Smart contracts

Queries regarding smart contract development with Ontology

PreviousOntology token protocolsNextSDKs and APIs

Last updated 5 years ago

Was this helpful?

What are the tools necessary to start developing smart contracts with Ontology?

Please refer to the section for more details on this topic.

What is the difference between execution and pre-execution?

Executing, or running a smart contract basically transmits the compiled AVM bytecode to the engine to be processed and executed. Pre-executing a contract involves the exact same process, except for the following key differences:

  • Any transaction that updates the on-chain data will not be able to do so, i.e. the changes will not be reflected.

  • The transaction will not be transmitted to consensus nodes

Pre-execution can be used to determine whether or not the contract runs as intended, and can also be used a way to find out the gas fee to run a particular contract.

What are native contracts and how to invoke them?

Contract protocols such as ONT and ONG, and other governing contracts are referred to as native contracts. All the methods that are available can found by following link. For more information on smart contracts and a more detailed distinction, please refer to the documentation.

Is a contract hash linked to an account? Does it have a private key associated to it?

Yes, the contract hash also corresponds to an account. The way this is implemented is by treating the contract hash as a big endian address of an account that is commonly used for funds management with dApps.

The private key to this particular account does exist, but remains unknown and cannot be used in any manner.

How to fetch values such as msg.sender or msg.value within the scope of a contract, much like Ethereum?

Every account that invokes a smart contract needs to pass its account address and the size of the asset that is being transferred parameters when invoking a smart contract.

Within the scope of the contract, the CheckWitness method is used to carry out signature verification and to judge the valid asset limit.

Is there an inbuilt timer or clock in the contract system?

It is advised that the system's timestamp be used within the methods that do not perform any external calls in order to prevent any potential misoperations.

No, there is no timing mechanism in the contract system. However, the GetTime() method from can be used to fetch the current timestamp. The value returned is in seconds. The timestamp may be needed considering external contract invocations.

Resources
this
Smart contract
ontology.interop.System.Runtime API