Bitcoin Forum
September 16, 2019, 03:35:40 PM *
News: Latest Bitcoin Core release: 0.18.1 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Generate Address from Mnemonic  (Read 149 times)
ElectNobody
Newbie
*
Offline Offline

Activity: 1
Merit: 1


View Profile
August 31, 2019, 05:56:54 PM
Merited by o_e_l_e_o (1)
 #1

I am looking to understand how HD wallets work clearly enough to create one.

I would like to write a test script that accepts a mnemonic phrase, and generates the same addresses that coinomi would produce from that phrase.

using bx, how would this be one?

1568648140
Hero Member
*
Offline Offline

Posts: 1568648140

View Profile Personal Message (Offline)

Ignore
1568648140
Reply with quote  #2

1568648140
Report to moderator
1568648140
Hero Member
*
Offline Offline

Posts: 1568648140

View Profile Personal Message (Offline)

Ignore
1568648140
Reply with quote  #2

1568648140
Report to moderator
1568648140
Hero Member
*
Offline Offline

Posts: 1568648140

View Profile Personal Message (Offline)

Ignore
1568648140
Reply with quote  #2

1568648140
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1568648140
Hero Member
*
Offline Offline

Posts: 1568648140

View Profile Personal Message (Offline)

Ignore
1568648140
Reply with quote  #2

1568648140
Report to moderator
1568648140
Hero Member
*
Offline Offline

Posts: 1568648140

View Profile Personal Message (Offline)

Ignore
1568648140
Reply with quote  #2

1568648140
Report to moderator
1568648140
Hero Member
*
Offline Offline

Posts: 1568648140

View Profile Personal Message (Offline)

Ignore
1568648140
Reply with quote  #2

1568648140
Report to moderator
100bitcoin
Sr. Member
****
Offline Offline

Activity: 587
Merit: 271


View Profile
August 31, 2019, 07:03:23 PM
 #2

I would like to write a test script that accepts a mnemonic phrase, and generates the same addresses that coinomi would produce from that phrase.
Address generation from mnemonic phrase is random. There is no guarantee that you'll end up creating the exact same address set as of Coinomi.

using bx, how would this be one?
What is 'bx'?

o_e_l_e_o
Hero Member
*****
Offline Offline

Activity: 686
Merit: 2714



View Profile
August 31, 2019, 08:34:53 PM
Merited by ETFbitcoin (1), pooya87 (1), Lutpin (1), hugeblack (1)
 #3

What is 'bx'?
BX is Bitcoin Explorer: https://github.com/libbitcoin/libbitcoin-explorer/wiki

I would like to write a test script that accepts a mnemonic phrase, and generates the same addresses that coinomi would produce from that phrase.
This page will guide you through all the steps you need to go from mnemonic to address: https://github.com/libbitcoin/libbitcoin-explorer/wiki/Wallet-Commands

Mnemonic to seed: https://github.com/libbitcoin/libbitcoin-explorer/wiki/bx-mnemonic-to-seed
Code:
$ bx mnemonic-to-seed WORD1 WORD2 WORD3 ...

Seed to HD private key: https://github.com/libbitcoin/libbitcoin-explorer/wiki/bx-hd-new
Code:
$ bx hd-new SEED

HD private key to public key: https://github.com/libbitcoin/libbitcoin-explorer/wiki/bx-hd-to-public
Code:
$ bx hd-public HD_PRIVATE_KEY

HD public key to EC public key: https://github.com/libbitcoin/libbitcoin-explorer/wiki/bx-hd-to-ec
Code:
$ bx hd-to-ec HD_KEY

EC public key to address: https://github.com/libbitcoin/libbitcoin-explorer/wiki/bx-ec-to-address
Code:
$ bx ec-to-address EC_PUBLIC_KEY

You can use "-h" with all of these commands to display a help menu. You can also chain all these commands together as such:
Code:
% echo "WORD1 WORD2 WORD3 ..." | bx mnemonic-to-seed | bx hd-new | bx hd-public | bx hd-to-ec | bx ec-to-address

Assuming the Coinomi derivation path is 44'/0'/0'/0/0, then your command would look like this:
Code:
% echo "WORD1 WORD2 WORD3 ..." | bx mnemonic-to-seed | bx hd-new | bx hd-private -d -i 44 | bx hd-private -d -i 0 | bx hd-private -d -i 0 | bx hd-public -i 0  | bx hd-public -i 0  | bx hd-to-ec | bx ec-to-address



pooya87
Legendary
*
Offline Offline

Activity: 1764
Merit: 1874


Remember tonight for it's the beginning of forever


View Profile
September 01, 2019, 03:35:06 AM
 #4

Address generation from mnemonic phrase is random. There is no guarantee that you'll end up creating the exact same address set as of Coinomi.

the mnemonic phrase itself is generated at random not the addresses. they are in fact reproducible and that is the whole point of deterministic design, to be able to generate the same exact address from the same exact seed anytime you want.

odolvlobo
Legendary
*
Offline Offline

Activity: 2618
Merit: 1401



View Profile
September 01, 2019, 06:46:40 AM
 #5

The methods for generating keys are described in several BIPs, especially BIP-32 and BIP-44

Address generation from mnemonic phrase is random. There is no guarantee that you'll end up creating the exact same address set as of Coinomi.

While the mnemonic phrase might be random, the addresses that are generated from it are always the same.

Buy stuff on Amazon at a discount with bitcoins or convert Amazon points to bitcoins: Purse.io
Join an anti-signature campaign: Click ignore on the members of signature campaigns.
o_e_l_e_o
Hero Member
*****
Offline Offline

Activity: 686
Merit: 2714



View Profile
September 05, 2019, 10:40:11 AM
 #6

If your piece of paper becomes damaged, or the ink smudges, or similar, and you lose a couple of your words, you will need to brute force around 4 million combinations (2048^2) to regain access to your coins. If you are storing your private key in base58 wallet import format and lose say 10 characters of your key, you are looking at around 430 quadrillion combinations (58^10), meaning your coins are probably lost forever. (In reality these numbers would be slightly smaller as not all combinations of words are valid, but the principle is the same).

The same applies if you write down a few mistakes, mix up characters or words, or so forth. Not only is it harder to make a mistake writing down words than writing down random characters, but it is also easier to figure out or brute force any mistakes you have made.

Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!