Comment on page
Queries regarding smart contract development with Ontology
Executing, or running a smart contract basically transmits the compiled
AVMbytecode 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.
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
The private key to this particular account does exist, but remains unknown and cannot be used in any manner.
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
CheckWitnessmethod is used to carry out signature verification and to judge the valid asset limit.
No, there is no timing mechanism in the contract system. However, the
ontology.interop.System.Runtime APIcan be used to fetch the current timestamp. The value returned is in seconds. The timestamp may be needed considering external contract invocations.
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.
Last modified 3yr ago