ICOs & Custom Cryptocurrencies On Ethereum Classic
Many initiatives are raising capital with initial coin offerings (ICOs). The Ethereum (ETH) project raised 18 million dollars and the DAO project raised 150 million dollars! Furthermore, the entire blockchain space is worth 90 billion dollars! I will describe ICOs and their custom cryptocurrencies on Ethereum Classic (ETC).
ICO Basics
An ICO is a method of raising funds with the sale of a new cryptocurrency. These cryptocurrencies are often required to purchase goods and services from the issuing organizations. For example, the ETH cryptocurrency (ether) is used to rent ETH system resources. Upcoming ICOs are typically announced on Bitcointalk.org forums and heavily marketed beforehand. Buyers often purchase the new cryptocurrencies by sending bitcoins or ether to escrow accounts. The initial prices are set, then supply and demand determines the future prices. If the organizations are well managed, and their cryptocurrencies prove useful, they should both increase in value. If prices skyrocket, miniscule cryptocurrency subdivisions can typically be used. For example, ETC cryptocurrency tokens can be subdivided into as many as 1018 pieces.
Caution is required with ICOs as they are effectively unregulated. Participants do not purchase ownership in companies, nor, many privileges protected by established case law. There is great potential for innovation as well as scams. Smith & Crown and ICOrating are two resources that can assist with ICO research.
ICO Cryptocurrencies
Cryptocurrencies are implemented with smart contracts. ETC provides an excellent smart contract platform. It has all of the functionality of ETH at a fraction of the cost.
Many exchanges and other users prefer crytocurrencies to adhere to the Ethereum Token Standard. This standard specifies the following interfaces for cryptocurrency smart contracts:
INTERFACE | DESCRIPTION |
---|---|
transfer(receiving_address, transfer_amount) | Transfers funds between accounts. |
balanceOf(account_address) | Returns account balances. |
totalSupply() | Returns the total supply. |
The standard also specifies the following interfaces for when a user wants another account to also manage their funds:
INTERFACE | DESCRIPTION |
---|---|
approve(approved_address, approved_amount) | Allows other accounts to also transfer funds. |
transferFrom(sending_address, receiving_address, transfer_amount) | Transfers funds between accounts. |
allowance(shared_address, approved_address) | Returns approved amounts. |
It is also common to include the following named constants:
NAMED CONSTANT | DESCRIPTION |
---|---|
name | cryptocurrency name |
symbol | exchange ticker symbol |
decimals | maximum number of subdivision decimal places |
For example, the ETC cryptocurrency exchange ticker symbol is ETC. Since ETC cryptocurrency tokens can be divided into as many as 1018 pieces, the maximum number of subdivision decimal places is 18.
Sample Code
There are many Ethereum Token Standard compliant Solidity smart contract examples available. Here is an example of an Ethereum Token Standard compliant Serpent smart contract:
#
# Implements a cryptocurrency.
#
# Contains the Ethereum Token Standard interfaces.
#
data NAME
data SYMBOL
data DECIMALS
data TOTAL_SUPPLY
data balance[]
data approved[][]
def init():
#
# Sets the named constants and the initial balance(s).
#
self.NAME = "Example"
self.SYMBOL = "EXPL"
self.DECIMALS = 18
self.TOTAL_SUPPLY = 1000000
self.balance[msg.sender] = self.TOTAL_SUPPLY
def name():
#
# Returns the cryptocurrency name.
#
return self.NAME
def symbol():
#
# Returns the exchange ticker symbol.
#
return self.SYMBOL
def decimals():
#
# Returns the maximum number of subdivision decimal places.
#
return self.DECIMALS
def totalSupply():
#
# Returns the total supply.
#
return self.TOTAL_SUPPLY
def balanceOf(account_add):
#
# Returns account balances.
#
return self.balance[account_add]
def valid_transfer(sending_add, receiving_add, transfer_amount):
#
# Determines the validity of transfers.
#
positive_amount = transfer_amount > 0
sufficient_funds = self.balance[sending_add] >= transfer_amount
same_add = sending_add == msg.sender
approved_amount = self.approved[sending_add][msg.sender]
approved = same_add or (approved_amount >= transfer_amount)
new_receiving_bal = self.balance[receiving_add] + transfer_amount
no_overflow = new_receiving_bal > self.balance[receiving_add]
return positive_amount and sufficient_funds and approved and no_overflow
def update_approved(sending_add, transfer_amount):
#
# Updates the approved array.
#
if sending_add != msg.sender:
self.approved[sending_add][msg.sender] -= transfer_amount
def transferFrom(sending_add, receiving_add, transfer_amount):
#
# Transfers funds between accounts.
#
result = False
if self.valid_transfer(sending_add, receiving_add, transfer_amount):
self.balance[sending_add] -= transfer_amount
self.balance[receiving_add] += transfer_amount
self.update_approved(sending_add, transfer_amount)
result = True
return result
def transfer(receiving_add, transfer_amount):
#
# Transfers funds between accounts.
#
return self.transferFrom(msg.sender, recieving_add, transfer_amount)
def approve(approved_add, approved_amount):
#
# Allows other accounts to also transfer funds.
#
self.approved[msg.sender][approved_add] = approved_amount
return True
def allowance(shared_add, approved_add):
#
# Returns approved amounts.
#
return self.approved[shared_add][approved_add]
Conclusion
ICOs are a new way to raise funds and the ETC platform is an excellent choice for the required cryptocurrency smart contracts. Vigilance due to the lack of regulations remains important. Hopefully, mechanisms to protect against abuse will allow an ever growing number of people to reap the benefits.
Feedback
Feel free to leave any comments or questions below. You can also contact me by clicking any of these icons:
Acknowledgements
I would like to thank IOHK (Input Output Hong Kong) for funding this effort.
License
This work is licensed under the Creative Commons Attribution ShareAlike 4.0 International License.
Saw this the other day, made me laugh for its honesty https://classicetherwallet.com/#ico
NOTE FROM AUTHOR!!!!!! ......Please only use the UPDATED cryptocurrency Serpent code here: https://bitbucket.org/seberino/cryptocurrency
That repository also has unit tests and more.