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.NEO and Neo.SmartContract.Framework.Services.System. Click on the links for more details.

System namespace is the API provided by the Smart Contract Execution Engine (NeoVM), which provides access to the execution environment.

Framework Methods

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

The SmartContract class provides us with the hash algorithms and signature methods.

Name

Description

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[] signature, byte[] pubkey)

Verifies the signature using the given pubkey

Note: These methods are available through inheritance. If you can't find these methods, make sure your class inherits from the SmartContract class.

Serialization and Deserialization

You can use extension methods in order to persist and retrieve objects from the SmartContract storage.