Skip to main content

Runtime Environment

Contexts

  • __block: the block context
  • __transaction the transaction context
  • __debug the debug context (debug only)

Transaction Context

All variables and functions are const.

enum transaction_type{
normal_type, // invoked by a normal transaction
relay_type, // invoked by a relay call
system_type, // invoked by the system (the reserved on_xxx() functions)
scheduled_type // invoked by a scheduled transaction
}
NameTypeDescriptionNRSS
get_type()() -> transaction_typeget the type of transactionXXXX
get_self_address()() -> addressThe address of this (not accessible from shard functions)XXXX
get_sender()() -> addressReturns the first signer of the transaction or the contract that called the current contractXXXX
get_timestamp()() -> uint64Timestamp of the transactionXXXX
get_signers()() -> array<address>the number of signersX
verify_signer()(uint32) -> boolcheck the signature of a signerX
verify_signer()(address) -> boolcheck the signature of a signerX
get_originated_shard_index()() -> uint32Index of the originate shardX
get_originated_shard_order()() -> uint32Order of the originate shardX
get_initiator_address()() -> addressTarget address of originate transactionX

Block Context

All variables and functions are const.

NameTypeDescription
get_height()() -> uint64Height of the block
get_shard_index()() -> uint32Index of the shard
get_shard_order()() -> uint32Order of the shard
get_timestamp()() -> uint64Timestamp of the block
get_random_number()() -> uint64get random number based on block metadata
get_miner_address()() -> addressget address of the block miner

Debug Context

All variables and functions are const.

NameTypeDescription
assert()(bool) -> voidif false: raise assertion failure exception and terminate execution
assert()(bool, string) -> voidif false: raise assertion failure exception and terminate execution, display the string in log
print()(arbitrary) -> voidprint informational message