This is how to create a brainwallet with bitcore

const Bitcore = require("bitcore-lib");
// const Mnemonic = require("bitcore-mnemonic");
let brainsrc= 'satoshi'
let input = new Buffer(brainsrc)
let hash = Bitcore.crypto.Hash.sha256(input)
let bn = Bitcore.crypto.BN.fromBuffer(hash)
let pk = new Bitcore.PrivateKey(bn).toWIF()
let addy = new Bitcore.PrivateKey(bn).toAddress();
console.log('The brain wallet of '+brainsrc+' \nAddress: '+addy,' Private key:'+pk)

For bitcoinjs, I only know how to create random address:


const bitcoin = require('bitcoinjs-lib')
var keyPair = bitcoin.ECPair.makeRandom()
var secret = (keyPair.toWIF())
var addr = (keyPair.getAddress())

console.log('The brain wallet of '+brainsrc+' \nAddress: '+addr,' Private key:'+secret)

How to do it?

up vote 0 down vote accepted

First of all, don't use 1 word seeds, that will be too easy to brute force...


const bitcoin = require('bitcoinjs-lib')

const brainsrc = 'satoshi'
const hash = bitcoin.crypto.sha256(Buffer.from(brainsrc))
const keyPair = bitcoin.ECPair.fromPrivateKey(hash)
const addr = bitcoin.payments.p2pkh({ pubkey: keyPair.publicKey }).address
const secret = keyPair.toWIF()

console.log('The brain wallet of '+brainsrc+' \nAddress: '+addr,' Private key:'+secret)


$ node index.js
The brain wallet of satoshi
Address: 1xm4vFerV3pSgvBFkyzLgT1Ew3HQYrS1V  Private key:L4XnHhvLC1b4ag9L2PM9kRicQxUoYT1Q36PQ21YtLNkrAdWZNos6

Examples can be found on the git repo:

  • TypeError: bitcoin.ECPair.fromPrivateKey is not a function – TSR Sep 13 at 0:48
  • what version of bitcoinjs-lib and node are you using? – JBaczuk Sep 13 at 1:31
  • Yes node. I upgraded to 4.0.0 and it works. – TSR Sep 13 at 2:05
  • It would be a plus if you can provide a link to the documentation – TSR Sep 13 at 2:05
  • Good idea, just edited the answer, Bitcoinjs-lib doesn't have formal docs, but there are examples. – JBaczuk Sep 13 at 2:20

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.