Creating tokens smart contract on the Credits standard
Concept of a token
A token is a unit of value, issued by a private organization in the blockchain system. Physically exists as a record in the register, distributed in the blockchain.
A kind of ICO (Initial Coin Offering) projects shares. They can both be purchased and earned by participating in the Bounty and Airdrop programs used by the ICO creators to promote their project. Tokens are developed on one of the existing platforms, such as Credits. To receive tokens on the Credits platform, you will need a wallet with token support, such as Desktop Wallet. Tokens have a different cost, depending on the company conducting the ICO, the success of this company, investment, and other factors. As a rule, in the first stages of the ICO the price of tokens is small, but in case of success, at the end of ICO, tokens can reach a truly impressive price.
Types of tokens
- Tokens provided by the assets of the material world
Tokens of this category certify the rights of their owners in relation to objects of the material world.
- Tokens certifying rights in the material world
These tokens certify the right to receive certain actions from issuers.
- Tokens certifying rights within decentralized platforms
These tokens are also known as protocol tokens or intrinsic tokens. Their main feature is that they represent a certain right or an asset within the blockchain platform itself.
Cryptocurrency in its pure form does not give the holder any derivative rights and concludes all the value in Itself.
When creating a token on the Credits platform, two Java interfaces are provided by the standard:
- BasicStandard (implementation required by the standard)
- ExtensionStandard (implementation recommended by the standard)
Figure 1 shows the BasicStandard interface:
Description of the BasicStandard interface methods:
- “getName” is the name of the token as string
- “getSymbol” is the symbol of the token as string
- “getDecimals” returns a number indicating the number of decimal places (for example, 8)
- “setFrozen” (with True\False values) freezes all tokens of the smart contract. If True, the token cannot be sent\used\burned (you can give “approve”). False - the token is not frozen. There is an ability to send\use\burn.
- “totalSupply” total number of tokens
- “balanceOf” displays balance of the wallet, specified by the “owner” parameter (where owner is the wallet of interest)
- “allowance” guarantees that there are enough tokens on the address of the sender's wallet to send them to the address of the recipient's wallet.
- “transfer” implements the transfer of some amount in the network to a specific address from the initiator's account. Has the “to”, “amount” fields
- transferFrom implements the transfer of some amount in the network from the specified address to the given address. Has the “from”, “to”, “amount” fields
- “approve” confirmation of the possibility to work with a pre-set number of coins to a third party/contract.
- “burn” “burns” the specified number of tokens without the possibility of return. Has the “amount” field that displays the amount of “burned” currency.
- “payable” the method allows you to send money to the token
Figure 2 shows the ExtensionStandard interface:
Description of ExtensionStandard methods:
- "register" allows you to carry out registration in a smart contract