Skip to content

Instantly share code, notes, and snippets.

@tgerring
Last active August 29, 2015 14:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tgerring/bd267e641e6fba63a126 to your computer and use it in GitHub Desktop.
Save tgerring/bd267e641e6fba63a126 to your computer and use it in GitHub Desktop.
// This is free and unencumbered software released into the public domain.
//
// Paste this function into the JavaScript console and execute like so:
// sendLots(eth.coinbase, eth.accounts[1])
// This can be saved to a file and loaded with loadScript('/path/to/sendLots.js')
sendLots = function(fromAccount, toAccount) {
loops = 5;
txcount = 2;
waitBlocks = 1;
i = 0;
do {
i++;
j = 0;
do {
j++;
//customize the transaction here
wei = (i-1)*10+j;
tx = eth.sendTransaction({from: fromAccount, to: toAccount, value: wei});
console.log("tx"+j+": "+tx+" for "+wei+" wei");
} while (j < txcount)
if (i != loops) {
console.log(i+": Waiting "+waitBlocks+" block for "+(eth.blockNumber+waitBlocks));
admin.debug.waitForBlocks(eth.blockNumber-1+waitBlocks); // This seems off
} else {
console.log(i+": Next block is "+(eth.blockNumber+waitBlocks)+"... wait for it :)")
}
} while (i < loops)
return
}
@juscamarena
Copy link

I'll have fun with this for a while. haha

@juscamarena
Copy link

Can I run a script like that can automatically make new accounts and have it send each tx to a new account?

@tgerring
Copy link
Author

You can create new accounts at-will, but you'll be prompted for an encryption password with each one. You could try to pre-generate them from the CLI ahead of time

@juscamarena
Copy link

How do you change the gas fee per tx to be higher? I'm currently running into the problem of my tx's being ignored due to needing a high gas fee because of the single address spam. edit: Found it.

@Ulysseus
Copy link

Something not right I get unexpected token ILLEGAL ( and 3 more errors)
Or if input it line by line when I get to } while (i < loops); if crashes out with Line23:1 Unexpected end of input

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment