Bitcoin Forum
April 19, 2024, 03:14:20 PM *
News: Latest Bitcoin Core release: 26.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Generate Address from Mnemonic  (Read 276 times)
ElectNobody (OP)
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?

Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1713539660
Hero Member
*
Offline Offline

Posts: 1713539660

View Profile Personal Message (Offline)

Ignore
1713539660
Reply with quote  #2

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

Activity: 858
Merit: 423


View Profile WWW
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
In memoriam
Legendary
*
Offline Offline

Activity: 2268
Merit: 18504


View Profile
August 31, 2019, 08:34:53 PM
Merited by pooya87 (1), ABCbits (1), hugeblack (1), Lutpin (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: 3430
Merit: 10491



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.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
odolvlobo
Legendary
*
Offline Offline

Activity: 4298
Merit: 3192



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.

Join an anti-signature campaign: Click ignore on the members of signature campaigns.
PGP Fingerprint: 6B6BC26599EC24EF7E29A405EAF050539D0B2925 Signing address: 13GAVJo8YaAuenj6keiEykwxWUZ7jMoSLt
o_e_l_e_o
In memoriam
Legendary
*
Offline Offline

Activity: 2268
Merit: 18504


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:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!