Skip to content

Instantly share code, notes, and snippets.

@fu5ha
Last active March 2, 2018 20:36
Show Gist options
  • Save fu5ha/74db5d02b2ebcee22665db988afef97a to your computer and use it in GitHub Desktop.
Save fu5ha/74db5d02b2ebcee22665db988afef97a to your computer and use it in GitHub Desktop.
//////////////////////////////
///////// CAUTION!!! /////////
//// ANY NANO YOU SEND TO ////
//// AN ADDRESS YOU MAKE ////
//// WITH THIS TOOL YOU ////
//// CANNOT GET BACK!!!! ////
//// THAT NANO IS GONE ////
//////// FOREVER!!!! /////////
//////////////////////////////
/////// HOW TO USE: //////////
/// Install npm or yarn, make a new folder, and put this script into that folder
/// Then do:
/// $ npm install nano-base32 hex-to-array-buffer array-buffer-to-hex blakejs
/// Next, change the variables below to whatever you'd like
/// Finally, do:
/// $ node nano_vanity_burn.js
//////////////////////////////
//////// Variables: //////////
const vanity_part = 'fushasburnaddress' // Change this to whatever you want, must be 51 characters or less and only contain 13456789abcdefghijkmnopqrstuwxyz
const padding = '1' // One character used to pad the rest of the address, must be from same character list
const start = '1' // must be either 1 or 3, the first character in the address after xrb_
//////////////////////////////
const nanoBase32 = require('nano-base32')
const hexToArrayBuffer = require('hex-to-array-buffer')
const arrayBufferToHex = require('array-buffer-to-hex')
const blake = require('blakejs')
let main = start + vanity_part
for (let i = main.length; i < 52; i++) {
main += padding
}
const pubKeyBytes = nanoBase32.decode(main)
const checksumBytes = blake.blake2b(pubKeyBytes, null, 5).reverse()
const checksum = nanoBase32.encode(checksumBytes)
const final = 'xrb_' + main + checksum
console.log(`Final generated address: ${final}`)
// Outputs: xrb_1fushasburnaddress11111111111111111111111111111111115g6dhxjw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment