Created
January 31, 2019 02:20
-
-
Save kvhnuke/59e9b04ca3edbaa557f135e9c5e63a4a to your computer and use it in GitHub Desktop.
Generate 200 million eth account genesis
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const fs = require("fs"); | |
| var JSONStream = require("JSONStream"); | |
| var LIMIT = 200000000; | |
| var transformStream = JSONStream.stringifyObject( | |
| '{"config":{"chainId":15,"homesteadBlock":0,"eip155Block":0,"eip158Block":0},"difficulty":"20","gasLimit":"2100000","alloc":{', | |
| ",", | |
| "}}" | |
| ); | |
| var outputStream = fs.createWriteStream("./sample-genesis.json"); | |
| transformStream.pipe(outputStream); | |
| const gen = () => { | |
| var ok = true; | |
| do { | |
| LIMIT--; | |
| if (LIMIT % 100000 === 0) console.log(LIMIT); | |
| if (LIMIT === 0) { | |
| transformStream.write([ | |
| Number(LIMIT) | |
| .toString(16) | |
| .padStart(40, "0"), | |
| { | |
| balance: "30000000000000000000" | |
| } | |
| ]); | |
| transformStream.end(); | |
| } else { | |
| ok = transformStream.write([ | |
| Number(LIMIT) | |
| .toString(16) | |
| .padStart(40, "0"), | |
| { | |
| balance: "30000000000000000000" | |
| } | |
| ]); | |
| } | |
| } while (LIMIT > 0 && ok); | |
| if (LIMIT > 0) { | |
| transformStream.once("drain", gen); | |
| } | |
| }; | |
| gen(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment