This documentation introduces IOST blockchain briefly. Target readers are developers of exchanges. The main content is the economic model of the IOST public chain, how to create an account, and send transactions, transaction confirmation。
Basic characteristics of the main network
- The network generates a block every 0.5s, and a single node continuously builds 6 blocks.
- The Block Production Committee has 17 seats and is renewed every 10 minutes. The 17 nodes with highest Servi values are selected into the committee each time, and the blocks are packed in turns.
- A block is irreversible after being confirmed by 2/3 + 1 block-producing nodes, about 40 seconds or so
- The minimum unit of IOST token is 8 digits after the decimal point.
- The system uses an account model
- Failed transactions will be included in the block and Gas fees will be deducted
Account creation process
A new IOST account must be created from an existing account.
When creating an account, at least 10 IOSTs are pledged for new account for Gas
How to get your first account：
If you do not have any account, you can use Create Account Service to create your first account.
Existing account, use SDK to create new account:
- First import the existing account into SDK, the account must ensure that there are enough tokens
- Generate a public and private key pair for the new account. The public and private key are stored in a byte array, and the output is encoded using base58.
- Generate and sign a transaction that creates an account
- Send the transaction to Main Network Node through rpc, and judge whether the creation is successful based on the return
IOST Transfer transaction process
Transfer transactions can only be sent between accounts, not public key addresses.
- Import the account to send the transaction
- Generate a transfer transaction and sign it
- Send the transaction through rpc, and Judge whether the execution was successful according to the return
Check whether transfers succeed
How to judge the irreversibility and successful execution of the transfer transaction is very important to the exchange, please read the Transaction Confirmation Document carefully
IOST deposit and withdrawal
IOST uses an account model. It needs to consume Token and Gas when creating an account. Therefore, it is not recommended that the exchange create a different account for each user. You can add MEMO to deposit and withdraw.
Sending an iost transfer transaction does not require the purchase of RAM. You only need to pledge IOST to obtain Gas. A transaction consumes approximately 9000Gas. Each additional pledge of IOST generates an additional 100,000 GAS per day. Any IOST account has been pledged at least 10 IOST, so any IOST account can support at least about 100 transfers per day. If you need to support more transfers, you need to pledge more IOST to get GAS
Suggested deposit process:
- The user submits a deposit request, and the exchange finds(or generates if not existed yet) a globally unique memo associated with the user
- The exchange monitors the IOST blockchain and finds the corresponding account and memo
- Transaction Confirmation
Suggested withdrawal process:
The user provides an IOST mainnet account, and the exchange sends the withdrawal transaction with reference to the above IOST transfer transaction process document.
With the help of the
txHandler of the iost.js SDK, it is convenient to poll the information on the chain and complete the withdrawal operation after confirmed on the chain.
IRC20, IRC21 Token
irc20, irc21 Token Introduction
irc20 does not need to write a contract, just sends a transaction, and calls create of the system contract token.iost; The irc21 token needs to write a contract to implement all the interfaces in the irc21 standard. Therefore, the irc21 token can meet some developers' customized needs for token transfer, freezing, and destruction. The irc21 token is aslo created by the
create method of the token.iost system contract internally.
The unique identifier of the irc20 and irc21 tokens is the token symbol. The token symbol is globally unique in the token system. For example, if there is an irc21 token with the token symbol
iet, then others will no longer be able to create irc20 or irc21 tokens with the token symbol
The transfer of irc20 tokens can be done by directly calling transfer method of token.iost. The transfer of irc21 token is to call the
transfer method of the token contract address. The transfer of irc20 and irc21 tokens may consume RAM. If you transfer tokens to an account that already owns the token, RAM is not consumed. If you transfer tokens to an account that has never owned the token, it will consume RAM around 60 bytes.
You can view the token information on the chain by calling the getTokenInfo api, an example is as follows：
"symbol": "iet", // token symbol, uniq globally
"full_name": "endless token", // full name, for display。
"issuer": "Contract8Hkb1ErxyBsHDYf3YHB7Ex9zuPkEQyNwSq1v4xEhzTqE", // issuer, can be account or contract
"decimal": 4, // precision
"current_supply": "529508805248513", // Count with minimum precision. Real amount is 529508805248513 / 10000 here, divided by precision value
"total_supply": "1000000000000000", // Upper limit of supply. Count with minimum precision. Generally set to a very large value.
"can_transfer": true, //
"only_issuer_can_transfer": false, // Are tokens only transferable through the token contract? ERC20 is all false. ERC21 is mostly true. The issuer may need to manage the transfer logic through the token contract, prohibiting direct transfers through system contracts.
"total_supply_float": 100000000000, // Upper limit of supply
You can check the balances of an account by calling the getTokenBalance api, such as：
"balance": 4292197.5628, // avaiable
"frozen_balances":  // all frozen balances
irc20, irc21 Token transfer example
IOST, IRC20, IRC21 tokens comparison
|inside genisis block
|users call create of token.iost
|Users deploy custom contracts and calls the create method of token.iost inside the contract
|tranfer of token.iost
|tranfer of token.iost
|tranfer of token's customized contract
|transfer resouce comsumption
|gas and ram
|gas and ram