Skip to main content

neo_syscalls/
syscalls.rs

1// Copyright (c) 2025-2026 R3E Network
2// Licensed under the MIT License
3
4use super::NeoVMSyscallInfo;
5
6/// Neo N3 System Calls
7pub const SYSCALLS: &[NeoVMSyscallInfo] = &[
8    NeoVMSyscallInfo {
9        name: "System.Contract.Call",
10        hash: 0x525b7d62,
11        parameters: &["Hash160", "String", "Integer", "Array"],
12        return_type: "StackItem",
13        gas_cost: 32768,
14        description: "Calls a method on a smart contract. Takes the script hash of the target contract, the method name to call, the operation method (0 for default), and an array of arguments. The call flags are inherited from the current execution context.",
15    },
16    NeoVMSyscallInfo {
17        name: "System.Contract.CallNative",
18        hash: 0x677bf71a,
19        parameters: &["Integer"],
20        return_type: "Void",
21        gas_cost: 0,
22        description: "Calls a native contract by its registered ID. The integer parameter specifies which native contract to invoke (e.g., NEO, GAS, Policy, etc.).",
23    },
24    NeoVMSyscallInfo {
25        name: "System.Contract.CreateMultisigAccount",
26        hash: 0x09e9336a,
27        parameters: &["Integer", "Array"],
28        return_type: "Hash160",
29        gas_cost: 0,
30        description: "Creates a multi-signature account from an array of public keys and the minimum number of signatures required (m-of-n). Returns the script hash of the resulting multi-signature account.",
31    },
32    NeoVMSyscallInfo {
33        name: "System.Contract.CreateStandardAccount",
34        hash: 0x028799cf,
35        parameters: &["ByteString"],
36        return_type: "Hash160",
37        gas_cost: 0,
38        description: "Creates a standard contract account from a single public key. Returns the script hash of the resulting account.",
39    },
40    NeoVMSyscallInfo {
41        name: "System.Contract.GetCallFlags",
42        hash: 0x813ada95,
43        parameters: &[],
44        return_type: "Integer",
45        gas_cost: 1024,
46        description: "Gets the call flags of the current execution context. Call flags control what operations are permitted during contract execution, such as allowing state modifications or contract calls.",
47    },
48    NeoVMSyscallInfo {
49        name: "System.Contract.NativeOnPersist",
50        hash: 0x93bcdb2e,
51        parameters: &[],
52        return_type: "Void",
53        gas_cost: 0,
54        description: "Internal native contract callback triggered when a block is about to be persisted. Called by the VM during the persist phase of block processing.",
55    },
56    NeoVMSyscallInfo {
57        name: "System.Contract.NativePostPersist",
58        hash: 0x165da144,
59        parameters: &[],
60        return_type: "Void",
61        gas_cost: 0,
62        description: "Internal native contract callback triggered after a block has been persisted. Called by the VM after all block transactions have been processed.",
63    },
64    NeoVMSyscallInfo {
65        name: "System.Crypto.CheckMultisig",
66        hash: 0x3adcd09e,
67        parameters: &["Array", "Array"],
68        return_type: "Boolean",
69        gas_cost: 0,
70        description: "Verifies a multi-signature against the current script context. Takes an array of signatures and an array of public keys. Returns true if the signatures are valid for the accumulated script hash and enough signatures are verified.",
71    },
72    NeoVMSyscallInfo {
73        name: "System.Crypto.CheckSig",
74        hash: 0x27b3e756,
75        parameters: &["ByteString", "ByteString"],
76        return_type: "Boolean",
77        gas_cost: 32768,
78        description: "Verifies a single ECDSA signature against the current script context. Takes the signature and public key as byte strings. Returns true if the signature is valid for the accumulated script hash.",
79    },
80    NeoVMSyscallInfo {
81        name: "Neo.Crypto.VerifyWithECDsa",
82        hash: 0xcf822a6a,
83        parameters: &["ByteString", "ByteString", "ByteString", "Integer"],
84        return_type: "Boolean",
85        gas_cost: 32768,
86        description: "Verifies an ECDSA signature with an explicit curve parameter. Takes the message hash, public key, signature, and a curve identifier (0 = secp256k1, 1 = secp256r1).",
87    },
88    NeoVMSyscallInfo {
89        name: "System.Iterator.Next",
90        hash: 0x9ced089c,
91        parameters: &["Iterator"],
92        return_type: "Boolean",
93        gas_cost: 32768,
94        description: "Advances an iterator to its next element. Returns true if there is a next element available, or false if the iterator has been exhausted.",
95    },
96    NeoVMSyscallInfo {
97        name: "System.Iterator.Value",
98        hash: 0x1dbf54f3,
99        parameters: &["Iterator"],
100        return_type: "StackItem",
101        gas_cost: 16,
102        description: "Gets the current value of an iterator. Must be called after System.Iterator.Next returns true. Returns the value at the current iterator position.",
103    },
104    NeoVMSyscallInfo {
105        name: "System.Runtime.BurnGas",
106        hash: 0xbc8c5ac3,
107        parameters: &["Integer"],
108        return_type: "Void",
109        gas_cost: 16,
110        description: "Burns a specified amount of GAS. The gas is permanently destroyed and cannot be recovered. Used for scenarios requiring deliberate GAS consumption beyond regular execution costs.",
111    },
112    NeoVMSyscallInfo {
113        name: "System.Runtime.CheckWitness",
114        hash: 0x8cec27f8,
115        parameters: &["ByteString"],
116        return_type: "Boolean",
117        gas_cost: 1024,
118        description: "Checks if the specified account has provided a witness (signature) in the current verification context. Takes a script hash or public key hash as input. Returns true if the account is a witness in the current transaction.",
119    },
120    NeoVMSyscallInfo {
121        name: "System.Runtime.CurrentSigners",
122        hash: 0x8b18f1ac,
123        parameters: &[],
124        return_type: "Array",
125        gas_cost: 16,
126        description: "Gets the list of signers (accounts) that signed the current transaction. Returns an array of script hashes representing the signers with their corresponding scopes.",
127    },
128    NeoVMSyscallInfo {
129        name: "System.Runtime.GasLeft",
130        hash: 0xced88814,
131        parameters: &[],
132        return_type: "Integer",
133        gas_cost: 16,
134        description: "Gets the amount of GAS remaining for the current execution. Used to check available gas before performing gas-consuming operations.",
135    },
136    NeoVMSyscallInfo {
137        name: "System.Runtime.GetAddressVersion",
138        hash: 0xdc92494c,
139        parameters: &[],
140        return_type: "Integer",
141        gas_cost: 8,
142        description: "Gets the address version used by the current network. The address version is part of the Neo address format and differs between MainNet and TestNet.",
143    },
144    NeoVMSyscallInfo {
145        name: "System.Runtime.GetCallingScriptHash",
146        hash: 0x3c6e5339,
147        parameters: &[],
148        return_type: "Hash160",
149        gas_cost: 16,
150        description: "Gets the script hash of the contract that called the current contract. Returns the script hash of the immediate caller in the call chain. Returns empty if called directly from an invocation transaction.",
151    },
152    NeoVMSyscallInfo {
153        name: "System.Runtime.GetEntryScriptHash",
154        hash: 0x38e2b4f9,
155        parameters: &[],
156        return_type: "Hash160",
157        gas_cost: 16,
158        description: "Gets the script hash of the entry script that started the current execution chain. This is the script hash of the contract or transaction that initiated the entire call sequence.",
159    },
160    NeoVMSyscallInfo {
161        name: "System.Runtime.GetExecutingScriptHash",
162        hash: 0x74a8fedb,
163        parameters: &[],
164        return_type: "Hash160",
165        gas_cost: 16,
166        description: "Gets the script hash of the currently executing script. Returns the script hash of the contract that is currently running.",
167    },
168    NeoVMSyscallInfo {
169        name: "System.Runtime.GetInvocationCounter",
170        hash: 0x43112784,
171        parameters: &[],
172        return_type: "Integer",
173        gas_cost: 16,
174        description: "Gets the number of times the current script has been invoked during the current execution. The counter starts at 1 and increments with each recursive or nested invocation.",
175    },
176    NeoVMSyscallInfo {
177        name: "System.Runtime.GetNetwork",
178        hash: 0xe0a0fbc5,
179        parameters: &[],
180        return_type: "Integer",
181        gas_cost: 8,
182        description: "Gets the network ID of the current blockchain. MainNet uses 1, TestNet uses 2, and other values are used for private networks.",
183    },
184    NeoVMSyscallInfo {
185        name: "System.Runtime.GetNotifications",
186        hash: 0xf1354327,
187        parameters: &["Hash160"],
188        return_type: "Array",
189        gas_cost: 4096,
190        description: "Gets all notifications emitted during the execution of a specific contract. Takes a script hash parameter to filter notifications by source contract. Returns an array of notification objects containing the event name and data.",
191    },
192    NeoVMSyscallInfo {
193        name: "System.Runtime.GetRandom",
194        hash: 0x28a9de6b,
195        parameters: &[],
196        return_type: "Integer",
197        gas_cost: 0,
198        description: "Gets a pseudo-random number generated from the current block's random seed and the transaction hash. The value is deterministic for the same block and transaction.",
199    },
200    NeoVMSyscallInfo {
201        name: "System.Runtime.GetScriptContainer",
202        hash: 0x3008512d,
203        parameters: &[],
204        return_type: "StackItem",
205        gas_cost: 8,
206        description: "Gets the current script container, which is typically the transaction that triggered the contract execution. Returns a StackItem representing the script container.",
207    },
208    NeoVMSyscallInfo {
209        name: "System.Runtime.GetTime",
210        hash: 0x0388c3b7,
211        parameters: &[],
212        return_type: "Integer",
213        gas_cost: 8,
214        description: "Gets the timestamp of the current block. The timestamp is in Unix epoch format (seconds since January 1, 1970).",
215    },
216    NeoVMSyscallInfo {
217        name: "System.Runtime.GetTrigger",
218        hash: 0xa0387de9,
219        parameters: &[],
220        return_type: "Integer",
221        gas_cost: 8,
222        description: "Gets the trigger type that started the contract execution. Returns 0x01 (Verification) for verification context, or 0x10 (Application) for application context.",
223    },
224    NeoVMSyscallInfo {
225        name: "System.Runtime.LoadScript",
226        hash: 0x8f800cb3,
227        parameters: &["ByteString", "Integer", "Array"],
228        return_type: "Void",
229        gas_cost: 32768,
230        description: "Loads and executes a script from a byte string. Takes the script bytecode, the call flags to use, and an array of arguments. Used for dynamic script execution within a contract.",
231    },
232    NeoVMSyscallInfo {
233        name: "System.Runtime.Log",
234        hash: 0x9647e7cf,
235        parameters: &["ByteString"],
236        return_type: "Void",
237        gas_cost: 32768,
238        description: "Emits a log message that is stored in the application log. The message is recorded as part of the transaction execution results and can be used for debugging and monitoring.",
239    },
240    NeoVMSyscallInfo {
241        name: "System.Runtime.Notify",
242        hash: 0x616f0195,
243        parameters: &["ByteString", "Array"],
244        return_type: "Void",
245        gas_cost: 32768,
246        description: "Emits a notification event from the smart contract. Takes an event name and an array of data items. Notifications are stored in the application log and can be watched by external applications.",
247    },
248    NeoVMSyscallInfo {
249        name: "System.Runtime.Platform",
250        hash: 0xf6fc79b2,
251        parameters: &[],
252        return_type: "String",
253        gas_cost: 8,
254        description: "Returns the platform identifier string. For Neo N3, this returns \"NEO\" to identify the blockchain platform.",
255    },
256    NeoVMSyscallInfo {
257        name: "System.Storage.AsReadOnly",
258        hash: 0xe9bf4c76,
259        parameters: &["StorageContext"],
260        return_type: "StorageContext",
261        gas_cost: 16,
262        description: "Converts a storage context to a read-only context. The returned context can be used for read operations but any write attempts will fail. Useful for safely passing storage access to other contracts.",
263    },
264    NeoVMSyscallInfo {
265        name: "System.Storage.Delete",
266        hash: 0xedc5582f,
267        parameters: &["StorageContext", "ByteString"],
268        return_type: "Void",
269        gas_cost: 32768,
270        description: "Deletes a storage entry by its key. Takes a storage context and a key byte string. The entry is permanently removed from the contract's storage.",
271    },
272    NeoVMSyscallInfo {
273        name: "System.Storage.Find",
274        hash: 0x9ab830df,
275        parameters: &["StorageContext", "ByteString", "Integer"],
276        return_type: "Iterator",
277        gas_cost: 32768,
278        description: "Returns an iterator for searching storage entries. Takes a storage context, a prefix key, and a search options flags. The options can specify whether to search keys only, values only, or both.",
279    },
280    NeoVMSyscallInfo {
281        name: "System.Storage.Get",
282        hash: 0x31e85d92,
283        parameters: &["StorageContext", "ByteString"],
284        return_type: "ByteString",
285        gas_cost: 32768,
286        description: "Gets the value of a storage entry by its key. Takes a storage context and a key byte string. Returns the stored value as a byte string, or null if the key does not exist.",
287    },
288    NeoVMSyscallInfo {
289        name: "System.Storage.GetContext",
290        hash: 0xce67f69b,
291        parameters: &[],
292        return_type: "StorageContext",
293        gas_cost: 16,
294        description: "Gets the storage context for the current contract. The storage context is required for all storage operations and defines the current contract's storage partition.",
295    },
296    NeoVMSyscallInfo {
297        name: "System.Storage.GetReadOnlyContext",
298        hash: 0xe26bb4f6,
299        parameters: &[],
300        return_type: "StorageContext",
301        gas_cost: 16,
302        description: "Gets a read-only storage context for the current contract. Any attempts to modify storage using this context will fail. Useful for safely exposing storage access to other contracts.",
303    },
304    NeoVMSyscallInfo {
305        name: "System.Storage.Put",
306        hash: 0x84183fe6,
307        parameters: &["StorageContext", "ByteString", "ByteString"],
308        return_type: "Void",
309        gas_cost: 32768,
310        description: "Stores a key-value pair in the contract's persistent storage. Takes a storage context, a key, and a value as byte strings. If the key already exists, the value is overwritten.",
311    },
312];