<p>Using <a href="https://github.com/bitcoinjs/bitcoinjs-lib" rel="nofollow noreferrer">bitcoinjs-lib</a> and <a href="https://www.npmjs.com/package/bip39" rel="nofollow noreferrer">bip39</a>. You can install those with <code>npm install bitcoinjs-lib bip39 --save</code></p>

<pre><code>const Bitcoin = require('bitcoinjs-lib');
const Bip39 = require('bip39');
const Bip32 = require('bip32');

function getAddress (node, network) {
  return Bitcoin.payments.p2pkh({ pubkey: node.publicKey, network }).address
}

const mnemonic = `entire taste skull already invest view turtle surge razor key next \
buffalo venue canoe sheriff winner wash ten subject hamster scrap unit shield garden`;

const seed = Bip39.mnemonicToSeed(mnemonic);

const root = Bip32.fromSeed(seed, Bitcoin.networks.bitcoin);

const child1 = root.derivePath("m/44'/0'/0'/0/0");
const child2 = root.deriveHardened(44).deriveHardened(0).deriveHardened(0).derive(0).derive(0);

console.log(getAddress(child1)); //1ENQm8nEP7sd6dqXbAMYZ4AuqcP8Y7AtR
console.log(getAddress(child2)); //1Hb6Z1uZ1RuZ6GXTvedQ2ETYKYsMc5qynN
</code></pre>

<p>You can check the code is working using <a href="https://iancoleman.io/bip39/" rel="nofollow noreferrer">this website</a>. You might also want to read up a little about BIP32, BIP39 and BIP44. An executive summary below:</p>

<ul>
<li><p>The BIP32 describes how you can generate new child keys programmatically from a single key and a few other properties.</p></li>
<li><p>BIP39 defines a set of standard words used to mimic a key and how to transform them back to the original "seed" (the key from BIP32).</p></li>
<li><p>BIP44 specifies how you should compute the child keys from the parent one. You can see from my code that I used <code>derivePath("m/44'/0'/0'/0/0");</code> in conformance of its specification.</p></li>
</ul>

CC BY-SA 4.0
2021-07-25T00:32:06.217Z
Does the GUI have a way?
caveman
CC BY-SA 4.0
2019-03-28T13:52:29.283Z
2019-03-28T13:57:35.397Z
2019-03-28T13:57:35.397Z
Tiago Loriato Simões
<p>Here's the complete code to run everything from your browser:</p>
<pre><code>#!/bin/bash 
#
# call this {anything}.sh
# when finished, run chmod +x *.sh
# then ./*.sh should execute the script 
#
# Create a ECDSA keypair for use with crypto currencies
# The key will be derived from whatever seed phrase is entered by the user
#
# Copyright (c) 2019 B Tasker

read -p &quot;Enter a seed sentence: &quot; seedphrase

# Derive a private key
privkey=$(echo &quot;$seedphrase&quot; | openssl sha256 | cut -d\  -f2)

# Get a proper copy of the private key
privkeyfull=$(openssl ec -inform DER -in &lt;(cat &lt;(echo -n &quot;302e0201010420&quot;) &lt;(echo -n &quot;$privkey&quot;) &lt;(echo -n &quot;a00706052b8104000a&quot;) | xxd -r -p) 2&gt;/dev/null)

# Now start creating the pub key 
longpub=$(openssl ec -inform DER -text -noout -in &lt;(cat &lt;(echo -n &quot;302e0201010420&quot;) &lt;(echo -n &quot;$privkey&quot;) &lt;(echo -n &quot;a00706052b8104000a&quot;) | xxd -r -p) 2&gt;/dev/null  | tail -6 | head -5 | sed 's/[ :]//g' | tr -d '\n' &amp;&amp; echo)

# Create the compressed version
compub=$(echo -n &quot;$longpub&quot; | cut -c1-66 | sed 's/^04/02/')

# Now RipeMD it:
hash256=$(echo &quot;$compub&quot; | xxd -r -p | openssl sha256 | cut -d\  -f2)
ripemd=$(echo &quot;$hash256&quot; | xxd -r -p | openssl ripemd160 | cut -d\  -f2)

# Now RipeMD the uncompressed :
hash256=$(echo &quot;$longpub&quot; | xxd -r -p | openssl sha256 | cut -d\  -f2)
ripemdunc=$(echo &quot;$hash256&quot; | xxd -r -p | openssl ripemd160 | cut -d\  -f2)

# And a version we can pass into OpenSSL if we need to
pubkeyfull=$(openssl ec -inform DER -in &lt;(cat &lt;(echo -n &quot;302e0201010420&quot;) &lt;(echo -n &quot;e359ae12b3c49fa0d59d0947a97acc9d8595017205909a883501ae09d4ea1888&quot;) &lt;(echo -n &quot;a00706052b8104000a&quot;) | xxd -r -p) -pubout 2&gt;/dev/null)

cat &lt;&lt; EOM
Seed Phrase: 
$seedphrase

Keys:

Private: $privkey
Long public: $longpub
Compressed Public: $compub
RipeMD (Compressed) Public: $ripemd
RipeMD (Uncompressed) Public: $ripemdunc

PEMs:

$privkeyfull
$pubkeyfull

Keep these safe
EOM
</code></pre>

CC BY-SA 4.0
2020-12-18T05:26:57.537Z
2020-12-18T05:26:57.537Z
librehash
<p>It is simpler than you think using command lines. Look at <a href="https://github.com/libbitcoin/libbitcoin-system/wiki/Altcoin-Version-Mappings#7-bitcoin-btc-bip-3944-technology-examples" rel="nofollow noreferrer">https://github.com/libbitcoin/libbitcoin-system/wiki/Altcoin-Version-Mappings#7-bitcoin-btc-bip-3944-technology-examples</a>.</p>

CC BY-SA 4.0
2019-03-28T05:01:53.037Z
2019-03-28T05:01:53.037Z
skaht
<p>Hi i am new to bitcoin all i want to know is how to generate address using mnemonic seed?</p>

<pre><code>let testnet =Bitcoin.networks.testnet;
let keypair =Bitcoin.ECPair.makeRandom({network:testnet});
let address=keypair.getAddress();
let privateKey=keypair.toWIF();
res.json("Public Address  "+ address+ "  "+privateKey)
</code></pre>

<blockchain><bitcore><bitcoinjs>
how to generate bitcoin adddres using seed?
syeda Roushan Arshid
# how to generate bitcoin adddres using seed?

(Asked by: username_0 on 2019-03-28)

Hi i am new to bitcoin all i want to know is how to generate address using mnemonic seed?
let testnet =Bitcoin.networks.testnet;
let keypair =Bitcoin.ECPair.makeRandom({network:testnet});
let address=keypair.getAddress();
let privateKey=keypair.toWIF();
res.json("Public Address  "+ address+ "  "+privateKey)

**Tags:** blockchain, bitcore, bitcoinjs


---

## 3 answers

### Answer by username_1 on 2019-03-28. Score: 1

Using bitcoinjs-lib and bip39. You can install those with npm install bitcoinjs-lib bip39 --save
const Bitcoin = require('bitcoinjs-lib');
const Bip39 = require('bip39');
const Bip32 = require('bip32');

function getAddress (node, network) {
  return Bitcoin.payments.p2pkh({ pubkey: node.publicKey, network }).address
}

const mnemonic = `entire taste skull already invest view turtle surge razor key next \
buffalo venue canoe sheriff winner wash ten subject hamster scrap unit shield garden`;

const seed = Bip39.mnemonicToSeed(mnemonic);

const root = Bip32.fromSeed(seed, Bitcoin.networks.bitcoin);

const child1 = root.derivePath("m/44'/0'/0'/0/0");
const child2 = root.deriveHardened(44).deriveHardened(0).deriveHardened(0).derive(0).derive(0);

console.log(getAddress(child1)); //1ENQm8nEP7sd6dqXbAMYZ4AuqcP8Y7AtR
console.log(getAddress(child2)); //1Hb6Z1uZ1RuZ6GXTvedQ2ETYKYsMc5qynN

You can check the code is working using this website. You might also want to read up a little about BIP32, BIP39 and BIP44. An executive summary below:

The BIP32 describes how you can generate new child keys programmatically from a single key and a few other properties.
BIP39 defines a set of standard words used to mimic a key and how to transform them back to the original "seed" (the key from BIP32).
BIP44 specifies how you should compute the child keys from the parent one. You can see from my code that I used derivePath("m/44'/0'/0'/0/0"); in conformance of its specification.

> **Comments:**
> **username_2**: Does the GUI have a way?  

---

### Answer by username_3 on 2020-12-18. Score: 1

Here's the complete code to run everything from your browser:
#!/bin/bash 
#
# call this {anything}.sh
# when finished, run chmod +x *.sh
# then ./*.sh should execute the script 
#
# Create a ECDSA keypair for use with crypto currencies
# The key will be derived from whatever seed phrase is entered by the user
#
# Copyright (c) 2019 B Tasker

read -p "Enter a seed sentence: " seedphrase

# Derive a private key
privkey=$(echo "$seedphrase" | openssl sha256 | cut -d\  -f2)

# Get a proper copy of the private key
privkeyfull=$(openssl ec -inform DER -in <(cat <(echo -n "302e0201010420") <(echo -n "$privkey") <(echo -n "a00706052b8104000a") | xxd -r -p) 2>/dev/null)

# Now start creating the pub key 
longpub=$(openssl ec -inform DER -text -noout -in <(cat <(echo -n "302e0201010420") <(echo -n "$privkey") <(echo -n "a00706052b8104000a") | xxd -r -p) 2>/dev/null  | tail -6 | head -5 | sed 's/[ :]//g' | tr -d '\n' && echo)

# Create the compressed version
compub=$(echo -n "$longpub" | cut -c1-66 | sed 's/^04/02/')

# Now RipeMD it:
hash256=$(echo "$compub" | xxd -r -p | openssl sha256 | cut -d\  -f2)
ripemd=$(echo "$hash256" | xxd -r -p | openssl ripemd160 | cut -d\  -f2)

# Now RipeMD the uncompressed :
hash256=$(echo "$longpub" | xxd -r -p | openssl sha256 | cut -d\  -f2)
ripemdunc=$(echo "$hash256" | xxd -r -p | openssl ripemd160 | cut -d\  -f2)

# And a version we can pass into OpenSSL if we need to
pubkeyfull=$(openssl ec -inform DER -in <(cat <(echo -n "302e0201010420") <(echo -n "e359ae12b3c49fa0d59d0947a97acc9d8595017205909a883501ae09d4ea1888") <(echo -n "a00706052b8104000a") | xxd -r -p) -pubout 2>/dev/null)

cat << EOM
Seed Phrase: 
$seedphrase

Keys:

Private: $privkey
Long public: $longpub
Compressed Public: $compub
RipeMD (Compressed) Public: $ripemd
RipeMD (Uncompressed) Public: $ripemdunc

PEMs:

$privkeyfull
$pubkeyfull

Keep these safe
EOM


---

### Answer by username_4 on 2019-03-28. Score: 0

It is simpler than you think using command lines. Look at <https://github.com/libbitcoin/libbitcoin-system/wiki/Altcoin-Version-Mappings#7-bitcoin-btc-bip-3944-technology-examples>.


---

