Smart Contract Methods
sendTransaction
Transfers funds from one wallet address to another, using a specified number of 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
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
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()
getBalance
Returns the coin balance for a wallet address.
BigDecimal getBalance(String addressBase58)
"addressBase58" - the wallet address, in Base58 format
getBlockchainTimeMills
Requests network time in milliseconds
long getBlockchainTimeMills()
payable
This event is invoked when a smart contract receives 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.
Last updated