批量发送以太坊,部署下面的合约,然后往下面的合约打币,就可以分发
ragma 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.length;i++)
{
myAddresses[i].transfer(distr);
}
}
}
例子 https://ropsten.etherscan.io/tx/0x0817c26d71cdf4b6e2571bad06f5e4d200ba1873efc1ac96509c5cfe2dfd6394
批量发送代币,发布一下合约,即可实现
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/0x9da02fc890e74898f97d0499a0727bbf0028c88b9759539e7dfb66dfa61acfdb
原文地址:https://www.cnblogs.com/xiaocongcong888/p/9497590.html