Creating "Hello-world" Smart Contract

Smart Contract on SWT Platform

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() {

    }

    @Override

    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.

Last updated