See a lot of online articles about ethereum batch transfer, either directly implemented as APP to let you to the private key to operate (and for the private key is our life, resolutely not divulge, this is the bottom line), or write half half, or copy and paste others, irresponsible, hiding, Think that year I was because it took a lot of time to learn from scratch ETH to fix, and sometimes we do the demand of the development does not need to master one thing, just need to know how to use, efficiency, the most important, right, and could be because of the delayed the process efficiency for leading group head of a big scold, one day the mood is lost, how can have a good job right.

Look at the picture, this is definitely what you need. I test based on ETH Ropsten, and pay attention to FanQiang. As for the method of FanQiang, I will not say more, you know.Ropsten. Etherscan. IO/tx / 0 xe38225…

In the figure, 3 transfers from form transfer to multiple addresses have been realized in TO. The actual consumption is 0.2 and the amount returned is 0.78

You need to know solidity if you want to develop smart contracts. You need to know web3py if you want to develop eth in Python. You need to know geth, Ethereum networks and Parity if you want to build private links. The fact that you’ve searched for bulk transfers means that you’ve already established yourself.

From solidity smart contract compilation to deployment to invocation, I won’t bother here, there are more detailed tutorials online.

Here is a set of batch transfer DAPP, which has a detailed ETH transfer and token transfer code implementation, can go to the reference, it also has detailed documentation, but also packaged into a DAPP for you to test github.com/rstormsf/mu…

And it is based on we3.js development, here we mainly talk about the development of Web3py, development we need to test account, need ETH balance, and private chain nodes for WE3 connection.

I’m using Infura’s Ropsten test network here. For the test account, I’m using the Metamask plugin. For installation, um, FanQiang is required

Ropsten needs to get the test currency and the method

Click on your profile picture in the upper right to create an account, or select the default account and click on the center to select Ropsten Test Network

Click the Buy button

Click Get and remember to get test coins, one at a time, up to 5 ok, we have the account, we also need the private key to transfer money

Click on the right… Three vertical dots to view account details and export the private key

The next step is to use WE3PY to implement the transfer operation, directly on the code

#! /usr/bin/python3 # -*- coding: Utf-8 -*- from web3 import web3 import json utF-8 -*- from web3 import web3 import json Web3 (Web3 HTTPProvider (" https://ropsten.infura.io/v3/cf9f29fb4f674714be8047085920bbd9 ")) fromAddress = # Metamask transfer account Xa22faf9ad34c9b7b7dfc1520cbffc3fe4dee1ee8 web3. ToChecksumAddress (" 0 ") private key private_key = # Metamask account "0 x6442818855fd7dc3429351a8c35fee52245a26880e5e0ea638fa69322a9fe781" # define mass transfer contract multiSenderAddr = web3.toChecksumAddress("0xa5025faba6e70b84f74e9b1113e5f7f4e7f4859f") multiSenderAbi = [] with open("./abis/StormMultisender.json", 'r', encoding='utf8') as data: Multi_sender = web3.eth. Contract (address=multiSenderAddr, Gas_price = web3.eth. GasPrice = web3.eth Web3. Eth. GetTransactionCount (fromAddress) # transfer eth addresses_to_send = [x5844de50cf99f95ca073ac7b205f9c0c75e827a8 "0", "0 x8775039fca840bde05519e4a743b2973f3c30b24"] balances_to_send = [web3 toWei (0.1, "Mr"), web3. ToWei (0.1, "Mr")] # building trading data TXN. = multi_sender functions provides. MultisendEther (addresses_to_send, balances_to_send).buildTransaction({ "from": fromAddress, "gasPrice": Web3. toHex(web3.toWei(90, "Gwei")),# specify gas price: web3.toHex(210, "Gwei"),# specify gas price: Web3.tohex (web3.towei (1, "ether")),# toHex(web3.towei (1, "ether")) Nonce # replay nonce, this is a must}) print (TXN) # send transaction signed_txn = web3. Eth. The signTransaction (TXN, Private_key =private_key) Need packing completed to another web3. Eth. SendRawTransaction (signed_txn. RawTransaction) hash txhash = # made by bank transfer Web3.tohex (web3.sha3(signed_txn.rawTransaction)) # Print transaction hash similar 0xe382252b45073788e015d6d7e3e4847cef540ed24fa0e4c3ec43f8adaf4cd210 print(txhash)Copy the code

Need to pay attention to in the code,. / abis/StormMultisender json ABI data, this file is the smart contracts get way github.com/rstormsf/mu in making the source code for it… But can be by etherscan ropsten browser query 0 ABI xa5025faba6e70b84f74e9b1113e5f7f4e7f4859f obtained the contract to this address

Also note that the number of transfers in buildTransaction parameter value must be greater than the number of bulk transfers you can make plus the eth fees that may be consumed, otherwise the package will fail. Add the following code to calculate the gas that may be consumed before building TXN

EncodeABI (fn_name="multisendToken",args=[token_address, addresses_to_send, args=[token_address, addresses_to_send, Gas = web3.eth. EstimateGas ({"from": fromAddress, "data": {"from": fromAddress, "data": {"from": fromAddress, "data": EncodedData, "value": web3.toHex(web3.toWei(0.1, "ether")), "to": multiSenderAddr})Copy the code

Here the contract is tested using its already deployed contract address, Interested in compiling contracts and on-line deployment into themselves special contract can refer to its source directory multisender/contracts/flats/UpgradebleStormSender_flat sol this file, Then copy it to remix.ethereum.org/ and compile the test, referring to its multisendToken and multisendEther methods