sidebar_label | sidebar_position |
---|---|
'Developing a contract' | 3 |
Developing a contract
We have completed setting up the private chain and configuring the node. In this section we will walk you through configuring the environment, writing, and compiling an NEP17 contract using C#.
The following steps are applicable to multiple system platforms, such as Windows, macOS, and Ubuntu.
Installing tools
-
Download and install Visual Studio Code
-
Download and install .NET 8.0 SDK
-
Run the command line and enter the following command to check if you have installed SDK successfully.
If there is no issue the SDK version number is displayed.
Installing contract template
Neo.SmartContract.Template is a project template used when developing Neo smart contracts. After installing the template, you can create a Neo smart contract project using either the Terminal or Visual Studio.
Install the template
List all dotnet templates
These default templates are available after installing Neo.SmartContract.Template :
-
neocontractowner - Standard contract template with the Owner, including the GetOwner and SetOwner methods.
-
neocontractoracle - A contract template using OracleRequest.
-
neocontractnep17 - NEP-17 contract template, including the Mint and Burn methods.
The
neocontract
template previously used has been renamed toneocontractowner
.
Create a project using templates with Terminal
The project name defaults to the name of the current directory. You can also specify the project name with -n, --name <name>
, e.g. dotnet new neocontractnep17 -n MyFirstContract
.
Compiling contract file
In the Terminal interface, go to the project path and run the following command to build your contract:
or
Related contract files are outputted under bin\sc
path in the contract project directory.
See also
For more information about writing contracts, refer to Basics .
For information about differences between Neo N3 and Neo Legacy contracts, refer to Differences than Neo Legacy