Skip to content

Runtime Syscalls

Back to Syscalls

Runtime API

Runtime syscalls provide access to execution context, authorization, notifications, and platform metadata.

Syscall NameGas CostDescriptionDevpack Wrapper
System.Runtime.GetTrigger1Get execution trigger typeSyscalls.getTrigger()
System.Runtime.Platform1Get platform string ("NEO")Syscalls.getPlatform()
System.Runtime.GetNetwork1Get network magic numberSyscalls.getNetwork()
System.Runtime.GetAddressVersion1Get address version byteSyscalls.getAddressVersion()
System.Runtime.GetTime1Get current block timestamp (ms)Syscalls.getTime()
System.Runtime.GetScriptContainer1Get transaction containerSyscalls.getScriptContainer()
System.Runtime.GetExecutingScriptHash1Get current contract hashSyscalls.getExecutingScriptHash()
System.Runtime.GetCallingScriptHash1Get caller contract hashSyscalls.getCallingScriptHash()
System.Runtime.GetEntryScriptHash1Get entry point hashSyscalls.getEntryScriptHash()
System.Runtime.LoadScript1Registered but intentionally unsupported in the embedded runtime; use System.Contract.CallSyscalls.loadScript(script, flags, args)
System.Runtime.CheckWitness200Verify witness authorizationSyscalls.checkWitness(hash)
System.Runtime.GetInvocationCounter1Get call count for current contractSyscalls.getInvocationCounter()
System.Runtime.GetRandom50Get deterministic random numberSyscalls.getCurrentRandom()
System.Runtime.Log1Emit log messageSyscalls.log(message)
System.Runtime.Notify1Emit notification (event)Syscalls.notify(data)
System.Runtime.GetNotifications1Embedded runtime returns []; notification lookup state is not exposedSyscalls.getNotifications()
System.Runtime.GasLeft1Get remaining GASSyscalls.gasLeft()
System.Runtime.BurnGas1Burn specified GAS amountSyscalls.burnGas(amount)
System.Runtime.CurrentSigners1Embedded runtime returns []; transaction signers are not modeledSyscalls.getCurrentSigners()
System.Runtime.GetMsgValue1Get host-injected Solidity msg.valueCompiler runtime intrinsic

Example Usage

solidity
import "devpack/contracts/Syscalls.sol";

contract Guarded {
    address public owner;

    modifier onlyOwner() {
        // CheckWitness verifies the transaction includes a valid
        // signature for the given address (200 GAS units)
        require(Syscalls.checkWitness(owner), "unauthorized");
        _;
    }

    function sensitiveAction() external onlyOwner {
        // Only executes if the transaction signer controls `owner`
        Syscalls.log("sensitiveAction executed");
    }

    function getExecutionInfo() external view returns (
        address executing,
        address caller,
        uint256 timestamp,
        uint256 remainingGas
    ) {
        executing = Syscalls.getExecutingScriptHash();  // address(this)
        caller = Syscalls.getCallingScriptHash();        // msg.sender
        timestamp = Syscalls.getTime();                  // block.timestamp
        remainingGas = Syscalls.gasLeft();               // gasleft()
    }
}

Gas Cost Guidance

CheckWitness Gas Cost

System.Runtime.CheckWitness costs 200 GAS units — the most expensive runtime syscall. It performs cryptographic signature verification against the transaction's witness list. Avoid calling it in tight loops. Cache the result in a local variable when you need to check the same witness multiple times within a single execution.

MIT Licensed