-
Notifications
You must be signed in to change notification settings - Fork 9
Transaction Specs
Truong Hong Thi edited this page Aug 1, 2019
·
2 revisions
{
to: string | undefined
value: string | undefined
gasLimit: string | undefined
data: undefined | object
}
- When deploying a contract,
to
must either be omitted or set toundefined
. On other cases, it must be a valid user account address or smart contract address. -
value
andgasLimit
must be a string parsable to valid unsigned integer. Floating numbers are not supported. -
value
andgasLimit
unit are micro token. That is, 10-6 of a token
The data
field's value depends on the type of transaction.
data
must be either undefined
or an object in following form:
data: {
memo: string // e.g. Pay for last night party
}
data: {
op: number
mode: undefined | number
src: string
}
-
op
is0
-
mode
is0
for Javascript contract, or100
for Wasm. If this field is omitted or set toundefined
, it defaults to0
-
src
must be base64-encoded string of Javascript source/Wasm binary
data: {
op: number
name: string
params: undefined | Array
}
-
op
is1
-
name
: the name of the message (i.e. method/function name) -
params
: method parameters, ignored if the method does not take any parameter
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.