Skip to content

Instantly share code, notes, and snippets.

@mangadul
Last active October 1, 2019 10:25
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 mangadul/0227d6f236291f558bde15420225917c to your computer and use it in GitHub Desktop.
Save mangadul/0227d6f236291f558bde15420225917c to your computer and use it in GitHub Desktop.
Bitcoin segwit vanity address generator
const bitcoin = require("bitcoinjs-lib")
const axios = require("axios")
var find_str = "3BMEX"; // find 5 first char or string
var is_bmex = false
while(is_bmex === false){
var NETWORK = bitcoin.networks.bitcoin
var privatekey = bitcoin.ECPair.makeRandom().toWIF();
var keyPair = bitcoin.ECPair.fromWIF(privatekey);
var pubKey = keyPair.publicKey
const { address } = bitcoin.payments.p2sh({
redeem: bitcoin.payments.p2wpkh({ pubkey: keyPair.publicKey }),
});
axios.get('https://blockchain.info/rawaddr/' + address)
.then(function (response) {
console.log(privatekey, address)
console.log(response.data);
});
var str_3bmex = address.substring(0, 5);
if(str_3bmex === find_str) {
is_bmex = true
console.log(privatekey,address);
}
}
{
"name": "segwit",
"version": "1.0.0",
"description": "Bitcoin vanity address generator",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "MIT",
"dependencies": {
"axios": "^0.19.0",
"bitcoinjs-lib": "^5.1.6"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment