0

It almost seems necessary to give the tokens to the creater of a token contract all of the tokens.

For instance, in https://www.ethereum.org/token#central-mint

/* Initializes contract with initial supply tokens to the creator of the contract */ function MyToken( uint256 initialSupply ) { balanceOf[msg.sender] = initialSupply; // Give creator all tokens }

I'm guessing the initiallySupply is later subtracted from this owner's balance, but why do this step at all? Why not just create the initialSupply and leave it there?

3
  • Your questions is not very clear. You are creating a token contract. You have an initial supply (say 100 coins). Who else would they be assigned to? Jul 16, 2017 at 17:32
  • It's not obvious why the person that will not end up with them get them in the first place. Why issue the tokens at all? I thought they were for later issuance. So why give them to the creator of the contract.
    – JohnAllen
    Jul 16, 2017 at 17:43
  • Say I started a bank. I form a company that is a bank. Then the founder of the bank gets all of the money. Then the money goes from the founder to the later borrowers of the bank. Wouldn't that be weird?
    – JohnAllen
    Jul 16, 2017 at 17:44

2 Answers 2

1

That is just how the tutorial contract has opted to handle the initial allocation.

If you want, you do not need to assign an initial balance to a particular address.

You can hardcode a contract property with the 'supply' of your token, and remove the initial allocation from your constructor. You then need to write appropriate functions to handle the allocation of your token how you wish.

0

If tokens are not assigned to someone they cannot be used for anything, it is like they didn't exist at all.

2
  • Why can't they sit in the contract like ether do during ICOs? Why do they have to be issued to anyone? That part is not immediately obvious.
    – JohnAllen
    Jul 16, 2017 at 17:45
  • If you put a non zero initial supply I understand that they are already assigned, or else you will put zero as initial supply. Because you can always mint new tokens.
    – Ismael
    Jul 16, 2017 at 17:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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