Smart Contract Methods

sendTransaction

Transfers funds from one wallet address to another, using a specified number of Credits (CS) coins. Optional data can be sent to the receiver, as long as the data is formatted using Base58 formatting.

protected final void sendTransaction(String from, String to, double amount, byte... userData)

  • “addressFrom” - address funds are sent from.
  • “addressTo” - address that receives sent funds
  • "amount" - number of transferred funds
  • "userData" - data uploaded by the user
Java
Copy

invokeExternalContract

Invokes a method from another smart contract:

Object invokeExternalContract(String contractAddress, String method, Object params)

  • "ContractAddress" - is the smart contract address
  • "Method" - is the method that needs to be invoked
  • "Params" - are the smart contract parameters, passed as an object
Java
Copy
  • Specify smart contract address, example: tokenKey;
  • Smart contract method, example: myMethod;
  • Specify method parameters, example: Object[] params = new Object[] {param1, param2};
  • Object invokeExternalContract(String contractAddress, String method, Object... params).

getSeed

Generates a random 8 bit number used for development of gambling or gaming dApps.

byte[] getSeed()

Java
Copy

getBalance

Returns the Credits (CS) coin balance for a wallet address.

BigDecimal getBalance(String addressBase58)

  • "addressBase58" - the wallet address, in Base58 format
Java
Copy

getBlockchainTimeMills

Requests network time in milliseconds

long getBlockchainTimeMills()

Java
Copy

payable

This event is invoked when a smart contract receives Credits (CS) coins via the Smart Contract Method called "sendTransaction".

String payable(BigDecimal amount, byte[] userData)

This event is triggered within the Smart Contract AFTER the Smart Contract "sendTransaction" method has finalized.

If an exception occurs within this event code, then the "sendTransaction" method fails and no Credits (CS) is transferred and no transaction fees are charged.

Java
Copy
Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard