Creating "Hello-world" Smart Contract
Smart Contract on Credits Platform
Credits Platform uses Desktop Wallet development environment for the development of smart contracts. They are developed with Java programming language, which allows one to develop and test smart contracts on any platform without the need to install a special development environment.
Hello-World Smart Contract
Extending the class “SmartContract” is a mandatory condition for the implementation of a smart contract class.
package com.example.contract;
import com.credits.scapi.annotations.*;
import com.credits.scapi.v2.SmartContract;
import com.credits.scapi.v1.*;
import java.math.BigDecimal;
public class my extends SmartContract {
public my() {
}
public String payable(BigDecimal amount, byte[] userData) {
return null;
}
public String hello() {
return "Hello!";
}
}
This simple smart contract contains only a class constructor and a class method that returns the string.
Smart Contract Testing
You should click "Deploy New Smart" in the Desktop Wallet menu (picture 1)

(Picture 1)
Then a window to input smart contract code will open

The right side of the window contains the constructor and method(s) of a smart contract.
The steps are as follows: input smart contract code and press “Build”, then if there are no errors in the smart contract, the bottom part of the window with the smart contract will show no messages, press “Deploy”. The message about successful smart contract deployment will pop up:

Note that for a successful deployment of a smart contract you need full synchronization of the network node.
After pressing “Build” and if there are errors in the smart contract code, you will see the following message:

Smart Contract Execution
To find a deployed smart contract, you should press on “Execute smart” in the “Smart Contracts” tab.

Window with the deployed smart contracts looks as follows:

“Execute smart” page also displays methods of the selected smart contract.
To see the source code of a smart contract, click on the tab “See the code”.
