教你一招 如何批量发送eth 或者代币

批量发送以太坊 部署下面的合约 然后往下面的合约打币 就可以分发

pragma solidity ^0.4.21;

contract batchTransfer {

address[] public myAddresses = [

0xcD2CAaae37354B7549aC7C526eDC432681821bbb,

0x8948e4b00deb0a5adb909f4dc5789d20d0851d71,

0xce82cf84558add0eff5ecfb3de63ff75df59ace0,

0xa732e7665ff54ba63ae40e67fac9f23ecd0b1223,

0x445b660236c39f5bc98bc49dddc7cf1f246a40ab,

0x60e31b8b79bd92302fe452242ea6f7672a77a80f

];

function () public payable {

require(myAddresses.length>0);

uint256 distr = msg.value/myAddresses.length;

for(uint256 i=0;i

{

myAddresses[i].transfer(distr);

}

}

}


例子 https://ropsten.etherscan.io/tx/ ... c96509c5cfe2dfd6394

批量发送代币 发布一下合约 即可实现

pragma solidity ^0.4.0;

contract demo{


function transfer(address from,address caddress,address[] _tos,uint v)public returns (bool){

require(_tos.length > 0);

bytes4 id=bytes4(keccak256("transferFrom(address,address,uint256)"));

for(uint i=0;i<_tos.length;i++){

caddress.call(id,from,_tos[i],v);

}

return true;

}

}


例子 https://ropsten.etherscan.io/tx/ ... 39e7dfb66dfa61acfdb

有不懂的加群 

教你一招 如何批量发送eth 或者代币_第1张图片

QQ群 634711675

你可能感兴趣的:(教你一招 如何批量发送eth 或者代币)