I created my erc20 and i would like no one, except me and those people to whom I send them, to generate my tokens.

Is it possible to generate all the tokens and send them to one wallet during the erc20 contract, and then send them to my friends wallets only?

Is it possible that there are other ways to do the same thing?


Basically if you create the token contract you can do whatever you want with the tokens. Your only restrictions are (if you want to be ERC20 compatible, that is, that your token is an ERC20 token) that you have to implement the ERC20 standard/interface.

When creating the contract it is quite typical to create all of the tokens and assign them to the creator for example. This can be done in the contract's constructor. After that you can just use the contract in a "normal" way to transfer the tokens wherever you wish.

Here for example is a rather typical token which utilizes OpenZeppelin's contracts. It sets the total amount of tokens and assigns them to the creator:

pragma solidity 0.4.24;

import './DetailedERC20.sol';

contract OwnToken is DetailedERC20
    constructor(uint256 initialAmount, string _name, uint8 _decimals, string _symbol) 
    DetailedERC20(_name, _symbol, _decimals) 
        totalSupply_ = initialAmount;
        balances[msg.sender] = initialAmount;

Sending the tokens to yourself and then to your friend's works, but nothing prevents your friends from sending the tokens to other people.

You may need to create a whitelist and limit the transfers to those in the list.

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.