Skip to content

Syscall Implementation

Back to Runtime Specification

Syscalls are the bridge between NeoVM bytecode and the Neo N3 platform services. They are invoked via the SYSCALL opcode followed by a 4-byte interop ID.

Syscall ID Computation

Syscall IDs are the first 4 bytes of the SHA-256 hash of the syscall name string:

ID = SHA256("System.Storage.Get")[0..4]

This is computed at compile time and embedded in the bytecode.

Storage Syscalls

SyscallDescription
System.Storage.GetContextGet the current contract's read-write storage context
System.Storage.GetReadOnlyContextGet a read-only storage context
System.Storage.AsReadOnlyConvert a context to read-only
System.Storage.GetRead a value by key from storage
System.Storage.PutWrite a key-value pair to storage
System.Storage.DeleteDelete a key from storage
System.Storage.FindFind entries by key prefix, returns iterator
System.Storage.Local.GetRead from local storage
System.Storage.Local.PutWrite to local storage
System.Storage.Local.DeleteDelete from local storage
System.Storage.Local.FindFind in local storage by prefix

Iterator Syscalls

SyscallDescription
System.Iterator.NextAdvance iterator to next entry; returns boolean
System.Iterator.ValueGet current iterator entry value

Iterator handles are created by Storage.Find and are validated by ISTYPE (type code 0x80) while alive.

INFO

The embedded runtime currently registers Iterator.Next and Iterator.Value. It does not expose an Iterator.Dispose syscall.

Runtime Syscalls

SyscallDescription
System.Runtime.GetTriggerGet execution trigger type
System.Runtime.PlatformGet platform identifier string
System.Runtime.GetNetworkGet network magic number
System.Runtime.GetAddressVersionGet address version byte
System.Runtime.GetTimeGet current block timestamp
System.Runtime.GetScriptContainerGet the transaction that triggered execution
System.Runtime.GetExecutingScriptHashGet hash of currently executing contract
System.Runtime.GetCallingScriptHashGet hash of the calling contract
System.Runtime.GetEntryScriptHashGet hash of the entry-point contract
System.Runtime.LoadScriptRegistered for Neo N3 parity, but intentionally unsupported in the embedded runtime; use System.Contract.Call for inter-contract calls
System.Runtime.CheckWitnessVerify that the specified account has witnessed the transaction
System.Runtime.GetInvocationCounterGet number of times current contract was called
System.Runtime.GetRandomGet a pseudo-random number
System.Runtime.LogEmit a log message
System.Runtime.NotifyEmit a notification event (name + state array)
System.Runtime.GetNotificationsEmbedded runtime returns []; notification lookup state is not exposed
System.Runtime.GasLeftGet remaining gas
System.Runtime.BurnGasBurn specified amount of gas
System.Runtime.CurrentSignersEmbedded runtime returns []; transaction signer set is not modeled
System.Runtime.GetMsgValueRead the runtime-side msg.value override; returns 0 when no host override is set

Neo-side ABI serialization fallbacks use the StdLib native contract (serialize / deserialize) rather than System.Runtime.Serialize or System.Runtime.Deserialize.

Crypto Syscalls

SyscallDescription
System.Crypto.CheckSigVerify a single signature (secp256k1)
System.Crypto.CheckMultisigVerify multiple signatures

Additional crypto operations are available through the CryptoLib native contract: SHA256, RIPEMD160, Keccak256, Murmur32, Hash160, Hash256.

Contract Syscalls

SyscallDescription
System.Contract.CallCall another contract by hash
System.Contract.GetCallFlagsGet current call flags
System.Contract.CreateStandardAccountCreate standard account script hash from public key
System.Contract.CreateMultisigAccountCreate multisig account script hash

MIT Licensed