Smart Contract .NET framework
The .NET Framework is an encapsulation of the Smart Contract API so that .NET programmers can use the classes, methods, and properties of .NET directly to interact with the API to obtain blockchain data, storage data and so on.
Interoperability Layer Methods
The namespace for interoperability layer is divided into
Neo.SmartContract.Framework.Services.System. Click on the links for more details.
|Neo||The NEO namespace is the API provided by the NEO blockchain, providing a way to access the blockchain data and manipulate the persistent store.|
|System||System namespace is the API provided by the Smart Contract Execution Engine (NeoVM), which provides access to the execution environment.|
In addition to calling methods from the Interoperability layer, smart contracts can also call methods provided by the framework. These methods are found within
Neo.SmartContract.Framework and can be called directly by smart contracts.
SmartContract Class Methods
In the NEO Smart Contract Tutorial, we observe that our contracts inherit from either
VerificationCode. These two classes inherit from the
SmartContract class which provides us with the hash algorithms and signature methods.
|Sha1(byte)||Hashes the input bytes using SHA1|
|Sha256(byte)||Hashes the input bytes using SHA256|
|Hash160(byte)||Hashes the input bytes using SHA256, followed by RIPEMD160|
|Hash256(byte)||Hashes the input bytes twice using SHA256|
|VerifySignature(byte pubkey, byte signature)||Verifies the signature using the given pubkey|
Byte Array Helper Methods
The methods below are helper methods for byte arrays provided by the .NET framework's Helper class.
|Concat(this byte, byte)||Concatenate 2 byte arrays|
|Range(this byte, int, int)||Returns a portion of the byte array, params: index, count|
|Take(this byte, int)||Returns the left-most X bytes from the byte array，params: count|