11

I am trying to know how ICO works (on a high, intuition-level), somehow it is hard to find information on the following questions.

  1. As I understand this minting is the process where you create the tokens. What exactly is happening there? You create an erc20 contract and it has a list of people who paid into your ico and then you more or less say balance of the address of the investor is now XY coins? (and maybe convert it later if you have a non-eth blockchain)

  2. What prevents me from minting afterwards again if I am the owner/creator of the token-contract?

  3. Somewhere I read that you should do minting on separate offline machine and transfer ownership after that to not expose your private key? Why would the private key get exposed while doing the ICO?

1
  • guess for 2) you set a variable like mintingover to true and there is no way to set it to false again
    – solaire
    May 29 '18 at 13:38
11

Smart contracts are computer programs. You can code almost any business logic you want in them. That includes the business logic for minting new coins.

The trust of your ICO contributors is the reason why you should have clear rules regarding when you wouldn't be able to mint new coins. Who would send you money for tokens if you can print an unlimited amount of them any time?

You can implement some stop conditions in your mint() function:

  • require that the total number of tokens to be less than a max hard cap
  • require that the current block height to be less than a specific height (to put a deadline in the ICO contribution phase for example)
  • keep a counter for the number of participants and require that number to be less than 100k for example.

Given all the ICO scams that are currently running, people tend to be as cautious as possible when sending money to an ICO. One such measure is to actually read the source code of the ICO smart contract. I wouldn't participate in an ICO with mintable tokens where I can't see the mint() function for example.

1
  • "Who would send you money for tokens if you can print an unlimited amount of them any time?" You mean like the Federal Reserve?
    – Suisse
    Feb 21 '21 at 23:17
1

As already pointed out, smart contracts are programs.
But unlike regular programs they also holds a balance of tokens on the blockchain.
Actually, they can hold any data they want, like (but not limited to) :

  1. How much tokens were already created (minted) - this is called total supply.
  2. The list of addresses that minted the token to and their balance.
  3. The name of the token.
  4. The symbol of the token.
  5. What is the cap of the token (this is optional for ERC20 tokens) etc...

This is very similar to a bank account, the bank have your balance, your record data etc.

Minting will be just a process of increasing the total supply of the token and the balance of the address that the contract minted the token for.

Again, just like a bank, if it would be allowed to create tokens or money, the bank would just update two numbers once they decide to do this : the total supply and the balance of the account that got the newly created token.

Now, naturally you don't allow anybody to touch the total supply and the balances of your token. For this smart contract have special mechanism that allows certain parts of the program to be called only by somebody that have a special private key. Most likely, this will be the token creator but that can be anybody, it solely depends on the smart contract program code.

Now to your questions:

  1. What happens on minting is just a process of updating of the total supply and of the balance that the token is minted for, nothing more. ICO ERC20 smart contract is not required to have knowledge of who paid who, it is most likely programmed just to hold the balances. There is for sure a possibility to create a contract that will mint in response to money (ether) being sent to it. And I am sure some ICO just exactly this, but this is not required. You will have to look into the contract code to understand how exactly the minting is done.
  2. Nothing actually, however, most of the contract implement a Capable functionality i.e. once certain amount of tokens were minted (the total supply reached a predefined number) the contract will disable the minting.
  3. I am not sure what you mean. The private key is used to sign transactions on blockchain and a care should be taken to not expose it. Sometimes, mintable smart contracts are created in a way that , there is a special address/account that allows minting of token, that account's private key can be destroyed once the minting is finished.

There are actually endless possibilities and ways to create tokens, but most of them follow ERC20 standard and use OpenZeppelin as a basic library.

ERC20 OpenZeppelin

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.