Show / Hide Table of Contents

System Namespace

The interop service layer provides APIs for smart contracts to access the blockchain data, including the block information, transaction information, contract information, asset information, etc. Besides, the interop service layer provides the persistent storage for each contract.

Binary API :

System.Binary.Base64DecodeDecodes Base64-encoded string into byte array
System.Binary.Base64EncodeEncodes byte array to Base64 string
System.Binary.SerializeSerializes stack elements into byte array
System.Binary.DeserializeDeserializes the byte array into stack elements
System.Binary.Base58DecodeDecodes Base58-encoded string into byte array
System.Binary.Base58EncodeEncodes byte array to Base58 string

BlockChain API :

System.Blockchain.GetHeightGets the height of the current block
System.Blockchain.GetBlockGets a block with the hash or block height
System.Blockchain.GetTransactionGets a transaction with the txid
System.Blockchain.GetTransactionHeightGets the height of the block where the transaction included with the txid
System.Blockchain.GetTransactionFromBlockGets a transaction with the txid in the block
System.Blockchain.GetContractGets a contract with the hash

Callback API :

System.Callback.CreateCreates a callback service according to the stack pointer
System.Callback.CreateFromMethodCreates a callback service for the specified method of the specified contract
System.Callback.CreateFromSyscallCreates a callback service for system call
System.Callback.InvokeInvokes the callback method

Contract API :

System.Contract.CreateDeploys a contract
System.Contract.UpdateUpgrades a contract
System.Contract.DestroyDestroys a contract
System.Contract.CallInvokes a contract
System.Contract.CallExInvokes a contract with the Flag
System.Contract.IsStandardChecks whether the contract is a standard contract
System.Contract.GetCallFlagsGets the execution permission of the current context

Crypto API :

System.Crypto.RIPEMD160Calculates the RIPEMD160 hash value of stack elements
System.Crypto.SHA256Calculates the Sha256 hash value of stack elements
System.Crypto.VerifyWithECDsaSecp256r1Uses the Secp256r1 curve to verify single signature
System.Crypto.VerifyWithECDsaSecp256k1Uses the Secp256k1 curve to verify single signature
System.Crypto.CheckMultisigWithECDsaSecp256r1Uses the Secp256r1 curve to verify multi-signature
System.Crypto.CheckMultisigWithECDsaSecp256k1Uses the Secp256k1 curve to verify multi-signature

Enumerator API :

System.Enumerator.CreateCreates a enumerator
System.Enumerator.NextChecks if the enumerator has more element
System.Enumerator.ValueGets the current value of the enumerator
System.Enumerator.ConcatConcats two enumerators

Iterator API :

System.Iterator.CreateCreates an iterator
System.Iterator.KeyGets the current key of the iterator
System.Iterator.KeysGets all keys of the iterator
System.Iterator.ValuesGets all values of the iterator
System.Iterator.ConcatConcats two iterators

Json API :

System.Json.SerializeSerializes a stack item to byte array
System.Json.DeserializeConverts json object to stack item

Runtime API :

System.Runtime.PlatformGets the platform information of the contract being executed
System.Runtime.GetTriggerGets the triggering condition of the contract
System.Runtime.GetTimeGets the timestamp of the current block
System.Runtime.GetScriptContainerGets the script container of the smart contract (the first trigger)
System.Runtime.GetExecutingScriptHashGets the script hash 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 call chain)
System.Runtime.CheckWitnessVerifies whether the container calling the contract is signed by the
script hash of the specific account
System.Runtime.GetInvocationCounterGets invocation count of the current contract
System.Runtime.LogRecords the log
System.Runtime.NotifyRecords the contract notification
System.Runtime.GetNotificationsGets notifications of a contract
System.Runtime.GasLeftGets the unconsumed gas

Storage API :

System.Storage.GetContextGets storage context of the current contract
System.Storage.GetReadOnlyContextGets storage context of the current contract in read-only mode
System.Storage.AsReadOnlySets the current context to read-only mode
System.Storage.GetGets value from the storage by key
System.Storage.FindFinds the data in the storage area of the current storage context with the specified prefix
System.Storage.PutPuts key-value into storage based on the storage context
System.Storage.PutExPuts Key-Value into the storage based on the storage context and the flag
System.Storage.DeleteDeletes the stored Key-Value data from the storage area by the Key

The source code for the API above can be found under Neo in the

src\neo\SmartContract file.