Developers
  • SWT PROTOCOL
    • Introduction
    • Accounts
    • Transactions
    • Fees
    • Smart Contracts
  • GETTING STARTED
    • Network Node
      • Introduction
      • STEP 1:RENTING A LINUX VPS
      • STEP 2:INSTALLATION OF PUTTY
      • STEP 3:INSTALLATION OF FILEZILLA
      • STEP 4:VPS CONNECTION AND LINUX CONFIGURATION WITH PUTTY (SSH)
      • STEP 5:HOW TO SECURE YOUR VPS
      • STEP 6:USING TMUX THROUGH PUTTY
      • STEP 7:UPLOAD OF THE SWT SOFTWARE WITH FILEZILLA
      • STEP 8:EXTRACT THE SWT SOFTWARE FOLDER
      • STEP 9:RUNNING THE SWT NODE THROUGH TMUX
      • STEP 10:RUNNING THE MONITORING TOOLS
  • API REFERENCE
    • Apache Thrift API
      • Transactions
      • Blocks
      • Smart contract
      • Tokens
      • Wallets
      • Sync info
      • Data structures
    • REST API
      • GetBlocks()
      • GetNodeInfo()
      • GetBalance()
      • GetWalletInfo()
      • GetTokenBalance()
      • GetTransactionsByWallet()
      • GetTransactionInfo()
      • GetEstimatedFee()
      • GetContractByAddress()
      • GetContractFromTransaction()
      • GetContractMethods()
      • ContractValidation()
      • ContractCall()
      • TransactionPack()
      • TransactionExec()
  • SMART CONTRACTS
    • Creating "Hello-world" Smart Contract
    • Smart Contract Methods
    • Smart Contract Standarts
      • Token Smart Contract
      • Escrow Smart Contract
      • Stable coin Token
  • HOW TO REST API
    • Introduction
    • Retrieve a balance from the blockchain
    • Request a specific transaction from the blockchain
    • Sending Transactions to the SWT Blockchain
    • Validating and deploying a Smart Contract with REST API
Powered by GitBook
On this page
  • Smart Contract on SWT Platform
  • Hello-World Smart Contract
  1. SMART CONTRACTS

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.

PreviousTransactionExec()NextSmart Contract Methods

Last updated 1 year ago