Bitcoin Forum

Alternate cryptocurrencies => Altcoin Discussion => Topic started by: hokkanen959 on October 11, 2017, 01:50:59 PM



Title: sending erc20 token to multiple addresses
Post by: hokkanen959 on October 11, 2017, 01:50:59 PM
hi all,

what would be the best way to send erc20 token to multiple addresses? like 5-10k different addresses?

thanks!


Title: Re: sending erc20 token to multiple addresses
Post by: Herdirfauzi on October 11, 2017, 04:02:31 PM
hi all,

what would be the best way to send erc20 token to multiple addresses? like 5-10k different addresses?

thanks!
all you can do to send ERC20 to some address you want, provided you have ether in account which you will use to send ERC20, for example in MyEtherWallet. you must have multiple balances to be able to send to some address you want.


Title: Re: sending erc20 token to multiple addresses
Post by: hokkanen959 on October 11, 2017, 04:45:35 PM
Thanks. can you give me an example of the code, to send, lets say 500 tokens to 10 000 different MEW wallets? distribute command? I dont want to use send command (because of the gas issue) Thanks in advance!


Title: Re: sending erc20 token to multiple addresses
Post by: romanlanskoj on October 12, 2017, 11:17:29 PM
pragma solidity ^0.4.17;

import "./Token.sol";

contract StandardToken is Token {
function StandardToken(){
    balances[yourDesiredAddress] = yourDesiredAmount;
    balances[yourDesiredAddress] = yourDesiredAmount;
    balances[yourDesiredAddress] = yourDesiredAmount;
    balances[yourDesiredAddress] = yourDesiredAmount;
    //etc. for all the addresses
}
    uint256 constant MAX_UINT256 = 2**256 - 1;

    function transfer(address _to, uint256 _value) returns (bool success) {
        //Default assumes totalSupply can't be over max (2^256 - 1).
        //If your token leaves out totalSupply and can issue more tokens as time goes on, you need to check if it doesn't wrap.
        //Replace the if with this one instead.
        //require(balances[msg.sender] >= _value && balances[_to] + _value > balances[_to]);
        require(balances[msg.sender] >= _value);
        balances[msg.sender] -= _value;
        balances[_to] += _value;
        Transfer(msg.sender, _to, _value);
        return true;
    }

    function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {
        //same as above. Replace this line with the following if you want to protect against wrapping uints.
        //require(balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value > balances[_to]);
        uint256 allowance = allowed[_from][msg.sender];
        require(balances[_from] >= _value && allowance >= _value);
        balances[_to] += _value;
        balances[_from] -= _value;
        if (allowance < MAX_UINT256) {
            allowed[_from][msg.sender] -= _value;
        }
        Transfer(_from, _to, _value);
        return true;
    }

    function balanceOf(address _owner) constant returns (uint256 balance) {
        return balances[_owner];
    }

    function approve(address _spender, uint256 _value) returns (bool success) {
        allowed[msg.sender][_spender] = _value;
        Approval(msg.sender, _spender, _value);
        return true;
    }

    function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
      return allowed[_owner][_spender];
    }

    mapping (address => uint256) balances;
    mapping (address => mapping (address => uint256)) allowed;
}


Title: Re: sending erc20 token to multiple addresses
Post by: March on October 12, 2017, 11:33:17 PM
pragma solidity ^0.4.17;

import "./Token.sol";

contract StandardToken is Token {
function StandardToken(){
    balances[yourDesiredAddress] = yourDesiredAmount;
    balances[yourDesiredAddress] = yourDesiredAmount;
    balances[yourDesiredAddress] = yourDesiredAmount;
    balances[yourDesiredAddress] = yourDesiredAmount;
    //etc. for all the addresses
}
    uint256 constant MAX_UINT256 = 2**256 - 1;

    function transfer(address _to, uint256 _value) returns (bool success) {
        //Default assumes totalSupply can't be over max (2^256 - 1).
        //If your token leaves out totalSupply and can issue more tokens as time goes on, you need to check if it doesn't wrap.
        //Replace the if with this one instead.
        //require(balances[msg.sender] >= _value && balances[_to] + _value > balances[_to]);
        require(balances[msg.sender] >= _value);
        balances[msg.sender] -= _value;
        balances[_to] += _value;
        Transfer(msg.sender, _to, _value);
        return true;
    }

    function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {
        //same as above. Replace this line with the following if you want to protect against wrapping uints.
        //require(balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value > balances[_to]);
        uint256 allowance = allowed[_from][msg.sender];
        require(balances[_from] >= _value && allowance >= _value);
        balances[_to] += _value;
        balances[_from] -= _value;
        if (allowance < MAX_UINT256) {
            allowed[_from][msg.sender] -= _value;
        }
        Transfer(_from, _to, _value);
        return true;
    }

    function balanceOf(address _owner) constant returns (uint256 balance) {
        return balances[_owner];
    }

    function approve(address _spender, uint256 _value) returns (bool success) {
        allowed[msg.sender][_spender] = _value;
        Approval(msg.sender, _spender, _value);
        return true;
    }

    function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
      return allowed[_owner][_spender];
    }

    mapping (address => uint256) balances;
    mapping (address => mapping (address => uint256)) allowed;
}


how to use these codes? what application that i need to use for the code will be work ?
will i just need to make a smart contract on ethereum platform ?


Title: Re: sending erc20 token to multiple addresses
Post by: retob on August 20, 2018, 03:40:48 AM
https://gwei.network/bulkTransfer

you can use this app
no fees