AIOU Chain Docs

AIOU Chain Docs

  • Docs
  • Languages iconEnglish
    • 中文

›Reference

Getting started

  • Overview
  • Quickstart

AIOU Design and Concepts

  • Account
  • Economic model

Smart Contract

  • Smart Contract Quick Start
  • AIOU Blockchain API
  • Update Contract
  • Generate Receipt in Smart Contract
  • Create IRC20 Token

Running AIOU node

  • Join AIOU Network
  • Become Servi Node

Reference

  • API
  • System Contract
  • Economic Contract
  • Token Contract
  • Gas Charge Table

AIOU Javascript SDK

  • AIOU
  • Blockchain
  • KeyPair
  • Transaction

AIOU Tech Internals

  • VM
  • Database
  • Network layer

Gas Charge Table

Start Up

NameOperationcost
StartUpinitialize virtual machine30000gas

Basic Grammar

NameOperationcost
ArrayPatternlet [a, b, ...c] = [1,2,3,4,5]ban
ObjectPatternlet {p0, p1} = {"p0": 123, "p1": 345}ban
RegularExpression/ab{2,5}c/gban
ThrowStatementthrow "justtest"50gas
CallExpressionf("justtest")4gas
TemplateLiteral`that ${ person } is a ${ age }`4gas + 8gas * string length
TaggedTemplateExpressionmyTag`that ${ person } is a ${ age }`4gas
NewExpressionnew Number(10)8gas
YieldExpressionyield "justtest"8gas
MemberExpressiona.member4gas
MetaPropertynew.target4gas
AssignmentExpression'=' '*=' '/=' '%=' '+=' '-=' '<<=' '>>=' '>>>=' '&=' '^=' '|='3gas + BinaryExpression charge
'='3gas
UpdateExpression'++' '--'3gas
BinaryExpression'-' '' '/' '%' '*' '|' '^' '&' '<<' '>>' '>>>'3gas
'+' '==' '!=' '===' '!==' '<' '<=' '>' '>='3gas + (1gas * (left op length + right op length) if op is string)
'instanceof' 'in'3gas
UnaryExpression'+' '-' '~' '!' 'delete' 'void' 'typeof'3gas
LogicalExpression'||' '&&'3gas
ConditionalExpression... ? ... : ...3gas
SpreadElementf(...[10, 11, 12, 13])1gas * arguments length
ObjectExpression{ name:"Jack", age:10, 5:true }2gas + 0.1gas * array length
ArrayExpression[ 3, 5, 100 ]2gas + 0.1gas * array length
FunctionExpressionlet a = function(width, height) { return width * height }1gas
ArrowFunctionExpressionmaterial => material.length3gas
ClassDeclarationclass Polygon { ... }150gas
FunctionDeclarationfunction a(width, height) { return width * height }3gas
VariableDeclaratorlet a = 13gas
VariableDeclaratorWithoutInitlet a3gas
MethodDefinitionlet obj = { foo() {return 'bar';} }2gas
StringLiteral"justtest"0.1gas * string length
ForStatementfor ( ... ) { ... }1gas * cycles
ForInStatementfor ... in ...4gas * cycles
ForOfStatementfor ... of ...2gas * cycles
WhileStatementwhile ( ... ) { ... }1gas * cycles
DoWhileStatementdo { ... } while ( ... )1gas * cycles

Library

NameOperationcost
StringCharAt("redbluegreen").charAt(3)1gas
StringCharCodeAt("redbluegreen").charCodeAt(3)1gas
StringLength("redbluegreen").lengthX
StringConstructorString.constructor("yellow")1gas + 0.1gas * string length
StringToString("redbluegreen").toString()X
StringValueOf("redbluegreen").valueOf()1gas
StringConcat("redbluegreen").concat("redbluegreen")1gas + 0.1gas * res string length
StringIncludes("redbluegreen").includes("red")1gas + 0.1gas * string length
StringEndsWith("redbluegreen").endsWith("red")1gas + 0.1gas * string length
StringIndexOf("redbluegreen").indexOf("red")1gas + 0.1gas * string length
StringLastIndexOf("redbluegreen").lastIndexOf("red")1gas + 0.1gas * string length
StringReplace("redbluegreen").replace("red", "blue")1gas + 0.1gas * string length
StringSearch("redbluegreen").search("red")1gas + 0.1gas * string length
StringSplit("redbluegreen").split("red")1gas + 0.1gas * string length
StringStartsWith("redbluegreen").startsWith("red")1gas + 0.1gas * string length
StringSlice("redbluegreen").slice()1gas + 0.1gas * string length
StringSubstring("redbluegreen").substring(3)1gas + 0.1gas * string length
StringToLowerCase("redbluegreen").toLowerCase()1gas + 0.1gas * string length
StringToUpperCase("redbluegreen").toUpperCase()1gas + 0.1gas * string length
StringTrim("redbluegreen").trim()1gas + 0.1gas * string length
StringTrimLeft("redbluegreen").trimLeft()1gas + 0.1gas * string length
StringTrimRight("redbluegreen").trimRight()1gas + 0.1gas * string length
StringRepeat("redbluegreen").repeat(10)1gas + 0.1gas * res string length
ArrayConstructorArray.constructor(["red", "blue", "green"])1gas + 0.2gas * res array length
ArrayToString(["red", "blue", "green"]).toString()1gas + 1gas * array length
ArrayConcat(["red", "blue", "green"]).concat(["red", "blue", "green"])1gas + 1gas * res array length
ArrayEvery(["red", "blue", "green"]).every(function (x) { return true; })1gas + 1gas * array length
ArrayFilter(["red", "blue", "green"]).filter(function (x) { return true; })1gas + 10gas * array length
ArrayFind(["red", "blue", "green"]).find(function (x) { return true; })1gas + 1gas * array length
ArrayFindIndex(["red", "blue", "green"]).findIndex(function (x) { return true; })1gas + 1gas * array length
ArrayForEach(["red", "blue", "green"]).forEach(function (x) { return; })1gas + 1gas * array length
ArrayIncludes(["red", "blue", "green"]).includes("red")1gas + 1gas * array length
ArrayIndexOf(["red", "blue", "green"]).indexOf("red")1gas + 0.2gas * array length
ArrayJoin(["red", "blue", "green"]).join()1gas + 1gas * array length
ArrayKeys(["red", "blue", "green"]).keys()1gas + 0.2gas * array length
ArrayLastIndexOf(["red", "blue", "green"]).lastIndexOf("red")1gas + 0.2gas * array length
ArrayMap(["red", "blue", "green"]).map(function (x) { return x; })1gas + 10gas * array length
ArrayPop(["red", "blue", "green"]).pop()1gas
ArrayPush(["red", "blue", "green"]).push("yellow")1gas
ArrayReverse(["red", "blue", "green"]).reverse()1gas + 0.2gas * array length
ArrayShift(["red", "blue", "green"]).shift()1gas
ArraySlice(["red", "blue", "green"]).slice()1gas + 10gas * array length
ArraySort(["red", "blue", "green"]).sort()1gas + 1gas * array length
ArraySplice(["red", "blue", "green"]).splice(0)1gas + 10gas * array length + (arguments length -2)
ArrayUnshift(["red", "blue", "green"]).unshift("yellow")1gas
JSONParseJSON.parse({"array": ["red", "blue", "green"], "string": "", "float": 100})10gas + 10gas * string length
MathAbsMath.abs(-1)2gas
MathCbrtMath.cbrt(2.5)2gas
MathCeilMath.ceil(-1.5)2gas
MathFloorMath.floor(1.5)2gas
MathLogMath.log(5)2gas
MathLog10Math.log10(1234)2gas
MathLog1pMath.log1p(0.7)2gas
MathMaxMath.max(3, 10, 5)2gas
MathMinMath.min(3, 10, 5)2gas
MathPowMath.pow(3, 15.5)2gas
MathRoundMath.round(2.7)2gas
MathSqrtMath.sqrt(3.4)2gas
BigNumberConstructorBigNumber.prototype.constructor("99999999999999999")20gas
BigNumberAbsnew BigNumber("-99999999999999999").abs()20gas
BigNumberDivnew BigNumber("-99999999999999999").div("99999")20gas + 10gas * (number length + args[0] length)
BigNumberIdivnew BigNumber("-99999999999999999").idiv("99999")20gas + 10gas * (number length + args[0] length)
BigNumberPownew BigNumber("-99999999999999999").pow("99999")20gas + 10gas * (number length + args[0] length)
BigNumberIntegerValuenew BigNumber("-99999999999999999").integerValue()20gas + 4gas * number length
BigNumberEqnew BigNumber("-99999999999999999").eq("99999")20gas + 2gas * (number length + args[0] length)
BigNumberIsFinitenew BigNumber("-99999999999999999").isFinite()20gas
BigNumberGtnew BigNumber("-99999999999999999").gt("99999")20gas + 2gas * (number length + args[0] length)
BigNumberGtenew BigNumber("-99999999999999999").gte("99999")20gas + 2gas * (number length + args[0] length)
BigNumberIsIntegernew BigNumber("-99999999999999999").isInteger()20gas
BigNumberLtnew BigNumber("-99999999999999999").lt("99999")20gas + 2gas * (number length + args[0] length)
BigNumberLtenew BigNumber("-99999999999999999").lte("99999")20gas + 2gas * (number length + args[0] length)
BigNumberIsNaNnew BigNumber("-99999999999999999").isNaN()20gas
BigNumberIsNegativenew BigNumber("-99999999999999999").isNegative()20gas
BigNumberIsPositivenew BigNumber("-99999999999999999").isPositive()20gas
BigNumberIsZeronew BigNumber("-99999999999999999").isZero()20gas
BigNumberMinusnew BigNumber("-99999999999999999").minus("99999")20gas + 10gas * (number length + args[0] length)
BigNumberModnew BigNumber("-99999999999999999").mod("99999")20gas + 10gas * (number length + args[0] length)
BigNumberTimesnew BigNumber("-99999999999999999").times("99999")20gas + 4gas * (number length + args[0] length)
BigNumberNegatednew BigNumber("-99999999999999999").negated()20gas
BigNumberPlusnew BigNumber("-99999999999999999").plus("99999")20gas + 10gas * (number length + args[0] length)
BigNumberSqrtnew BigNumber("-99999999999999999").sqrt()20gas + 4gas * number length
BigNumberToFixednew BigNumber("-99999999999999999").toFixed(5)20gas + 4gas * number length

Storage:

NameOperationcost
Putstorage.put("key", "value")300gas
Getstorage.get("key")300gas
Hasstorage.has("key")300gas
Delstorage.del("key")300gas
MapPutstorage.mapPut("key", "field", "value")300gas
MapGetstorage.mapGet("key", "field")300gas
MapHasstorage.mapHas("key", "field")300gas
MapDelstorage.mapDel("key", "field")300gas
MapKeysstorage.mapKeys("key")300gas
MapLenstorage.mapLen("key")300gas

Network:

NameOperationcost
transactiontransaction size (byte)10gas * transaction size
receiptreceipt size (byte)10gas * receipt size
← Token ContractAIOU →
AIOU Chain Docs
Community
BlogGitHubStar
Facebook Open Source
Copyright © 2021 Your Name or Your Company Name