Deploying the HelloWorld Smart Contract Example

Now let’s look into deploying the HelloWorld Smart Contract in C# on your local network, firstly, let’s take a look at the contract itself.

Compiling the HelloWorld smart contract

A smart contract in C# must be compiled into CIL before it can be deployed. For this, we are going to use the Stratis Smart Contract Tool.

You will need to obtain the Stratis Smart Contract Tool, this can be done using the below command

git clone

Follow below steps to validate and compile Smart Contract:

cd Stratis.SmartContracts.Tools.Sct\Stratis.SmartContracts.Tools.Sct\
dotnet run -- validate [PATH_TO_SMART_CONTRACT] -sb

To see more information on the options available for the sct validate command, use the following command:

dotnet run -- validate --help


If you are building the Stratis Smart Contract Tool from source and have previously cloned the repository, please ensure that before you compile any smart contracts, you sync the repository to the latest version of the source code and rebuild the tool.

Deploying the HelloWorld smart contract

Begin by making sure that you have the Local Smart Contract network running. You should now be in possession of 1,000,000 TCRS-TEST tokens within your cirrusdev wallet. You can deploy the token from the Cirrus Core UI or via Swagger which can be launched from the Wallet drop-down in the top right. This tutorial will demonstrate the deployment from the Cirrus Core GUI.

Navigate to the Smart Contracts tab within the Cirrus Core wallet and select the Create Contract button


You will now be presented with the Create Contract dialog. To deploy the contract, you will need to complete the relevant fields. Each member of the object is fully documented in the API. Use the CIL code you generated in the previous section for the Byte Code field.


Once completed, select the Create Contract button to deploy the contract. Once deployed, the contract will be visible on the Smart Contracts Dashboard as per below:


To interact with the deployed contract, you can simply select the Browse API hyperlink to be directed to Swagger.


This will then launch your defined Internet Browser


Select the SayHello post method to display the available parameters


Calling the SayHello() method

We are going to call the SayHello() method, to do this click the Try it out button.


A lot of the text fields are pre-populated, all that is required is to enter the password and replace the SayHello() string  with ().


Click the Execute button to call the method. The response can be seen below instantaneously.


As detailed in the response, we need to check the receipt to view what was returned from the Smart Contract. Navigate back to the Smart Contracts Dashboard within Cirrus Core where you will find your balance has reduced slightly and in addition there is a new type of Smart Contract execution listed.

Click the hyperlinked hash text to view the receipt.


Upon clicking the hyperlinked text, you will be presented with a new dialog that displays the receipt of the Smart Contract call. Here we can see the returnValue proving that the Smart Contract call was successful!


Alternatively, you can call the contract from wallet as well. To call it, just copy the contract address as depicted below and click call contract button.


Provide the method name, contract address, password, parameters, and click call contract as illustrated below.


Now we have deployed a basic HellowWorld contract, we can now look at extending the functionality in Tutorial 3.