1

Imagine the following scenario:

I have 10 wallets with 1 ETH each. I want to send a 1 ETH transaction from each of these wallets to 0x0000000000000000000000000000000000000000

The solution "Use a smart contract" is not the solution I'm looking for.

Besides doing this manually, what tool would you use to achieve this as fast as possible?

1 Answer 1

1

You can jus automatize the execution of the transactions using any tool the allows you to interact with the network.

For instance, this is very easy to do with python and web3py, The only thing you need is a list containing the addresses and a for loop through it to send the transactions.

Step One: Code (I feeled the values with random numbers for the example)

  1. Get the infura link for mainnet and paste in the line 2 instad of 'https://--infuralink'

  2. In accounTarget write the address to which you want to send the ether

  3. In accountList write the addresses from which you will send ether

  4. In privatekeys write the private keys of the addresses in accountList, in order.

  5. save the code in a file with .py extension.

"""

from web3 import Web3, HTTPProvider
w3 = Web3(HTTPProvider('https://--infuralink'))


accountTarget = '0xfba3F929D2116868A77986cE017c91cCee3B03d9'
accountList = ['a905556532f8353195f389824fa34ea8f9719517', '0x7fd094cddd9d824b690c894ddbae63378d9de30b']
privatekeys = ['0x4c0562a69102937d6231471b5dbb6204fe5129617082792ae468d01a3f362318', 
               '0x7c283a69102937d6231471b5dbb6204fe5129617082792ae468d01a3f362318']


for i in range(0,len(accountList)):
    transaction = {
     'to': accountTarget,
     'value': w3.toWei(1,'ether'),
     'gas': 200000,
     'gasPrice': w3.eth.gasPrice,
     'nonce': w3.eth.getTransactionCount(w3.toChecksumAddress(accountList[i])),
     'chainId': 1
     }

    signed = w3.eth.account.signTransaction(transaction, privatekeys[i])
    w3.eth.sendRawTransaction(signed.rawTransaction)  

Step two: Requirements.

  1. You need to have python installed, see here how to install python 3.6

  2. Install web3 by doing in the command line (cmd) pip3 install web3

Step 3 run the code

  1. in the command line write python3 filename.py

  2. The code will print the transactionhash, so you can check them



You may try this in a test network first (I test it on rinkeby)

Hope this help.

17
  • Would you be willing to go more in depth on this? I would pay ETH for a tool and a walkthrough.
    – Okuui
    Commented Jun 8, 2018 at 14:48
  • Sure, I will elaborate it. Are you running a node in your computer?
    – Jaime
    Commented Jun 8, 2018 at 14:57
  • No, I am using Quiknode.
    – Okuui
    Commented Jun 8, 2018 at 15:07
  • 1
    I just posted the piece of code needed, I am assuming you have some knowledge of python. I do not know anything about your node so you will need to add the path to it. I hope this helps, let me know.
    – Jaime
    Commented Jun 8, 2018 at 15:41
  • I do not have knowledge of python. I am basically a noob in all this. Things I don't know: Where do I run the code you just posted, where to I put my wallet adresses (private keys is probably "passwords", so I understand that one I think), where do I put gas price? It would be fantastic if you could explain me where to run this code and fill the "gaps" with random data, so I can exactly see where I have to put my own data. Like this for instance: Put 5 adresses on the account list with random private keys, put the gas price to 100 gwei etc. etc.
    – Okuui
    Commented Jun 8, 2018 at 15:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.