Skip to content

Instantly share code, notes, and snippets.

@nnkken
Created June 23, 2020 10:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nnkken/2d8416ca5dab9ed8019e3b5e4afa87d9 to your computer and use it in GitHub Desktop.
Save nnkken/2d8416ca5dab9ed8019e3b5e4afa87d9 to your computer and use it in GitHub Desktop.
create 200000 Cosmos addresses test
const crypto = require('crypto');
const secp256k1 = require('secp256k1');
const bech32 = require('bech32');
const createHash = require('create-hash');
function createSigner(privateKey) {
const publicKeyArr = secp256k1.publicKeyCreate(privateKey, true);
const publicKey = Buffer.from(publicKeyArr);
const sha256 = createHash('sha256');
const ripemd = createHash('ripemd160');
sha256.update(publicKey);
ripemd.update(sha256.digest());
const rawAddr = ripemd.digest();
const cosmosAddress = bech32.encode('cosmos', bech32.toWords(rawAddr));
console.log(`address: ${cosmosAddress}`);
}
for (let i = 0; i < 200000; i += 1) {
const privKey = crypto.randomBytes(32);
createSigner(privKey);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment