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

Economic Contract

gas.aiou


GAS related contract, including pledging AIOU for gas, unpleding, transferring GAS.
Details of economic model are introduced on GAS economic model。

Info

contract_idgas.aiou
languagenative
version1.0.0

API

pledge(pledgor, to, amount)

pledge aiou for gas. minimum pledging amount is 1 aiou.

Example

["user1","user1","100"]:user1 pledge 100 aiou for himslef. So user1 costs 100 aiou, and obtains some gas.
["user1","user2","100"]:user1 pledge 100 aiou for user2. So user1 costs 100 aiou, and user2 obtains some gas.

Parameter ListParameter TypeRemark
pledgorstringthe account who pledges aiou. Calling this interface requires this account's "transfer" permission
tostringthe account who gets gas
amountstringaiou amount for pledging

unpledge

undo pledge. aiou pledged earlier will be returned. minimum unpledging amount is 1 aiou.

Example

["user1","user1","100"]:user1 unpledge 100 aiou from his earlier pledgement for himself.
["user1","user2","100"]:user1 unpledge 100 aiou from his earlier pledgement for user2.

Parameter ListParameter TypeRemark
pledgorstringthe account who pledges aiou. Calling this interface requires this account's "transfer" permission
tostringthe account who gets gas
amountstringaiou amount for pledging

ram.aiou


ram related contract, including buying/selling/transferring.
Details of economic model are introduced on RAM economic model.
You can get price estimate in RPC when you buy or sell a little ram.

Info

contract_idram.aiou
languagejavascript
version1.0.0

API

buy(payer, receiver, amount)

buy RAM from system. minimum buying amount is 10 bytes.
contract will return the amount of aiou costed.

Example

["user1","user1",1024]: user1 buys 1024 bytes ram for himself
["user1","user2",1024]: user1 buys 1024 bytes ram for user2

Parameter ListParameter TypeRemark
payerstringthe account who buys ram. Calling this interface requires this account's "transfer" permission
receiverstringthe account who gets the bought ram
amountintram bytes to buy

sell(account, receiver, amount)

Sell unused ram to system. minimum selling amount is 10 bytes.
contract will return the amount of aiou returned.

Example

["user1","user1",1024]: user1 sells unused 1024 bytes ram to system, he himself gets aiou returned. 。
["user1","user2",1024]: user1 sells unused 1024 bytes ram to system, user2 gets aiou returned.

Parameter ListParameter TypeRemark
payerstringthe account who sells ram. Calling this interface requires this account's "transfer" permission
receiverstringthe account who gets the aiou returned
amountintram bytes to sell

lend(from, to, amount)

transfer ram to others.
Only ram one bought can be transferred to others. So ram others transferred to you cannot be sold to system nor transferred to others.
minimum transferring amount is 10 bytes.

Example

["user1","user2",1024]: user1 transfers unused 1024 bytes ram to user2.

Parameter ListParameter TypeRemark
fromstringthe account who transfers ram. Calling this interface requires this account's "transfer" permission
tostringthe account who receives ram
amountintram bytes to transfer
← System ContractToken Contract →
  • gas.aiou
    • Info
    • API
  • ram.aiou
    • Info
    • API
AIOU Chain Docs
Community
BlogGitHubStar
Facebook Open Source
Copyright © 2021 Your Name or Your Company Name