Version
Show / Hide Table of Contents

Smart Contract API Reference

The NEO Smart Contract API expands the capabilities of the Smart Contract to access the blockchain data, manipulate persistent storage, and query the execution environment. It is part of the Neo Virtual Machine (NeoVM) Interoperability Service Layer.

In addition to the following smart contract APIs, Neo N3 also introduces a number of native contracts. See Neo Native Contracts .

For more information on how to use the framework to easily call APIs in high-level languages, see Smart Contracts Framework .

Contract API :

APIDescription
System.Contract.CallInvokes the contract
System.Contract.CallNativeInvokes the native contract
System.Contract.IsStandardDetermines whether the contract is a standard contract or multi-signed contract
System.Contract.GetCallFlagsGets the execution permissions for the current context
System.Contract.CreateStandardAccountCreates a standard account
System.Contract.NativeOnPersistTrigger the OnPersist method of native contract
System.Contract.NativePostPersistTrigger the PostPersist method of native contract

Iterator API :

APIDescription
System.Iterator.CreateCreates a iterator
System.Iterator.NextMoves the iterator flow to next
System.Iterator.ValuesGets all the values of iterators

Runtime API :

APIDescription
System.Runtime.PlatformGets information of the platform that executes the smart contract.
System.Runtime.GetTriggerGets the trigger condition for the smart contract
System.Runtime.GetTimeGets the timestamp of the current block
System.Runtime.GetScriptContainerGets the script container of the smart contract (the original trigger)
System.Runtime.GetExecutingScriptHashGets the hash of the script executed by the smart contract
System.Runtime.GetCallingScriptHashGets the script hash of the caller of the smart contract
System.Runtime.GetEntryScriptHashGets the script hash of the entry point of the smart contract (the starting point of the contract invocation chain)
System.Runtime.CheckWitnessVerifies that whether the container calling the contract is signed by the specified script hash account
System.Runtime.GetInvocationCounterGets the invocation count of the current contract
System.Runtime.LogRecords the contract log information
System.Runtime.NotifyRecords the contract notifications
System.Runtime.GetNotificationsGets all notifications executed by a contract
System.Runtime.GasLeftGets the number of remaining GAS

Storage API :

APIDescription
System.Storage.GetContextGets the context of the current contract storage
System.Storage.GetReadOnlyContextGets the context of the current contract storage in read-only mode
System.StorageContext.AsReadOnlyChanges the current context to read-only mode
System.Storage.GetGets the corresponding value from the storage.
System.Storage.FindFinds the specified prefix content in the context of the current storage.
System.Storage.PutWrites a Key to the storage based on the storage context
System.Storage.PutExWrites a Key to the storage according to the storage context and flag.
System.Storage.DeleteDeletes the Key from the storage based on the Key value

The source code of above API can be found under the path src\neo\SmartContract of Neo project.