Tokens and smart contracts: things you need to know to understand developers.

Andrey Petrunin
6 min readMay 26, 2018

--

Smart contracts are becoming increasingly popular among tech enthusiasts as a mean to keep virtually any agreement. In terms of ICOs, these contracts are used to produce and distribute tokens that can act like shares or currency for the projects, in time, creating value for the investors. Let us study what is smart contract, what features it may have in terms of ICO and how to distinguish between good code and bad.

What is smart contract

Smart contract is, essentially, a piece of code that regulates relations between parties. Just like traditional contract, it can be used in most spheres of relations between persons and entities, replacing both paper agreements and supervisors, who warrant their execution. This is possible thanks to interlinked nature of blockchain, allowing preservation of unchangeable data within blocks. Simply speaking, smart contracts, uploaded to blockchain, cannot be changed by any party, and can only execute actions allowed from the start.

In the context of an ICO, smart contract is needed to regulate all aspects of token sale — numbers of tokens, prices, stages, wallets, outcome-related actions and so on. It is recommended to hire a competent developer or order a smart contract form specialized agency. Read on to understand better what specifics you can request.

What is token

Token is a kind of cryptocurrency you issue to give to the investors in exchange for their money. Tricky thing is — in fact, tokens are not your company shares. They are not directly tied to your company value, being just some cryptocurrency on sale. One of the main tasks of ICO is to invent how to implement tokens in your business model, and give them a growing value. In simple economic terms, you business needs to create more demand for the tokens than there is offer. This can be achieved it by integrating tokens as a form of currency into their project — allowing to buy services with tokens, and as services will grow in value, so will the token. Token can grow value in other ways — for example, by allowing more input on your project to the ones with bigger amounts through voting mechanisms. Tokens can be artificially tied to our company value by being just an investment mechanism, and act like substitute shares.

There are many ways of controlling token value — capping tokens, burning tokens, issuing tokens, allowing people to mine tokens. All of the options you need should be implemented in the smart contract, as it is the main governing document for your tokens.

What is ERC20 standard

Smart contracts are usually developed for the Ethereum blockchain, which was made specifically to host electronic agreements. Ethereum features a specific coding language for smart contracts, Solidity, and unified token standard all the tokens within the blockchain conform to, the ERC20 standard. Conforming to this standard allows tokens to be easily exchangeable for other compatible currencies and enables them to be used in Dapps. More importantly, all ERC20 smart contract should have open code for public to be sure of its functions. There are other blockchains that can host smart contracts and issue tokens, like Ripple and Wave, but most projects still prefer Ethereum. Blockchain takes small fee for the use of its resource for issuing and distributing tokens in a form of ‘gas’.

What is gas

Gas, simply explained, is a value of one computing operation in Ethereum network. Operations have fixed gas values, e.g. simple transaction costs 21000 gas. Gas price, meaning how much is gas in ETH, is an adjustable value, indicating the reward miners receive from landing their resources to process your transactions. Putting higher price on gas can allow your transactions to come through faster, while making the fee bigger. Expertly developed smart contract keeps balance between gas price and speed of transactions to get the most value, and stores any complex computation and data off-chain, only referencing it in smart contract to avoid spending gas on it.

What parameters a token sale can have

Normally, token sales have a number of defining parameters you need to decide on.

  • Token name — 3 to 5 letters that will be an indication of your currency, e.g. BUXX
  • Token price — a fixed price of a token for ICO. It can be modified by other sale specifics, i.e. early stage discount.
  • Minimum transaction — the lowest amount of currency you are willing to accept.
  • Caps — soft and hard cap for token sale, determining the success of ICO and limiting offer.
  • Available amounts — total amount of tokens issued and amount available for sale. Difference is usually distributed between founders and interested parties.
  • ICO terms and stages — start and end dates of different stages of ICO (and pre-ICO), as well as discounts associated with terms and amount sold.
  • Token allocation — some ICOs allocate a percentage of tokens for bounty campaigns, airdrops and to give as bonuses to the investors, depending on amount bought or as referral program rewards. All of these functions should be coded in the smart contract accordingly.
  • Additional token parameters — weather tokens should be locked on investors wallets until the ICO is over, should they be burnable, mintable or have specific properties within ERC20 standard.
  • Additional functions to the smart contract — contracts can have unorthodox functions, however, it is not recommended from credibility perspective.

What else can be done using smart contracts

Technically, smart contracts allow for many things: sealing property deals, verifying authenticity, storing data and funds until certain conditions, and many more. However, in context of ICOs, smart contract acts as an accounting tool that distributes tokens in exchange for funds, and sends collected funds to specific wallets. If your project has a need of additional functions smart contracts could provide, it is recommended to use a separate contract for this purpose, as adding functions, not directly related to ICO to the token contract may be considered suspicious by the investors.

How to check smart contracts for quality

Audit of a smart contract is a good way to make sure it is most credible, has no security issues and uses less gas. It is recommended to hire several specialized companies for independent audit. Normally, audit includes running smart contract code through word engines that check it for most common mistakes and vulnerabilities. After that, an expert verifies results and looks for less obvious problems by checking code string by string, an provides a report with suggestions on security and optimization. A proper audit can be critical to ICO success, as it fights potentially exploitable vulnerabilities and, in the end, helps you save money.

Smart contract is the beating heart of ICO, as it does all the math, distributes tokens and funds, and represents the quality of your approach with its code. However, even a good ERC20 contract is a relatively small part of ICO, an electronic accountant for your fundraising undertaking. It requires a bone cage of personal cabinet to encase it, muscle tissue of landing page to be accessible, nervous system of whitepaper to convey its message and the skin of marketing to reach out.

Read more in my article cycle about technical specifics of ICOs:

Overview of ICO technical challenges

How to write a white paper

How to build a landing page

Why you need a personal cabinet

Marketing tips

--

--

Andrey Petrunin

Markeing Director @ loftchain.io | We help ICOs and develop for blockchain.