Skip to content

Transaction Specs

Truong Hong Thi edited this page Aug 1, 2019 · 2 revisions

ICETEA TRANSACTION SPEC

The transaction format

{
  to: string | undefined
  value: string | undefined
  gasLimit: string | undefined
  data: undefined | object
}
  1. When deploying a contract, to must either be omitted or set to undefined. On other cases, it must be a valid user account address or smart contract address.
  2. value and gasLimit must be a string parsable to valid unsigned integer. Floating numbers are not supported.
  3. value and gasLimit unit are micro token. That is, 10-6 of a token

The data field's value depends on the type of transaction.

1. For regular transfer

data must be either undefined or an object in following form:

data: {
  memo: string // e.g. Pay for last night party
}

2. For deploying contract

data: {
  op: number
  mode: undefined | number
  src: string
}
  • op is 0
  • mode is 0 for Javascript contract, or 100 for Wasm. If this field is omitted or set to undefined, it defaults to 0
  • src must be base64-encoded string of Javascript source/Wasm binary

3. For calling contract method (i.e. sending message to contract)

data: {
  op: number
  name: string
  params: undefined | Array
}
  • op is 1
  • name: the name of the message (i.e. method/function name)
  • params: method parameters, ignored if the method does not take any parameter

Gas handling

There is no gas price concept. Every transaction has same gas price.

Every transfer (no contract involvement) takes same amount of gas. Users don't need to set gasLimit in this case. Currently, transfers are free.

For contract deployment and calls, gasLimit is the maximum amount of gas the user is willing to pay. Remaining gas will be returned. In case of 'out of gas' or 'insufficient balance', used gas will not be returned.