Author

Topic: custom mnemonic wordlist to generate deterministic keys and compare to addresses (Read 42 times)

legendary
Activity: 3430
Merit: 10505
What exactly are you trying to do that requires high speed? Is it some sort of brute forcing? Because in that case optimization is more complex than just using a certain programming language and a library.
hero member
Activity: 630
Merit: 731
Bitcoin g33k
good ideas! Thank you. I will dig into it soon and hopefully will find a suitable solution. Of course I need to adapt it to my needs but with some Python code this shouldn't be too difficult. The only bad thing on Python over C++ is the speed, so I guess I'll stick with secp256k1 from ice and multiprocessing or concurrent features for a fast key generation.

Thanks guys!
legendary
Activity: 3430
Merit: 10505
other special characters.
Electrum (https://github.com/spesmilo/electrum/blob/master/electrum/mnemonic.py) allows you enter your own custom word list and uses that when generating your BIP32 seed without a problem and in case by "special characters" you mean stuff that are outside of UTF8 range, Electrum handles that well too since it treats all inputs as Unicode (eg. it covers emojis). It is also not strict about the word count in that list.

The rest of the stuff like generating keys at certain derivation paths, storing to disk, etc. is something you should handle yourself by writing some script on top of mnemonic.py.
hero member
Activity: 882
Merit: 5818
not your keys, not your coins!
I don't know of any ready-made tool for this, but it sounds rather simple.

You could start with the Python reference implementation, from the BIP39 itself, for instance.

Wordlists are already in the format you describe, as shown here: https://github.com/bitcoin/bips/blob/master/bip-0039/bip-0039-wordlists.md
You just add yours in this directory: python-mnemonic/src/mnemonic/wordlist/

So let's assume you have a new wordlist at python-mnemonic/src/mnemonic/wordlist/klingon.txt and a list of addresses (one per line) in your working directory, called addresslist.txt.
Then your code would look something like this:
Code:
from mnemonic import Mnemonic
import bip32utils

# Import list of known addresses
addresslist = open("./addresslist.txt", "r").readlines()

mnemo = Mnemonic("klingon")
while True:
  # Create new random seed
  words = mnemo.generate(strength=256)
  seed = mnemo.to_seed(words)

  # Calculate root key, first child key and corresponding address
  root_key = bip32utils.BIP32Key.fromEntropy(seed)
  child_key = root_key.ChildKey(0).ChildKey(0) #adjust for custom derivation paths or add another loop
  child_address = child_key.Address()

  # Check if address is in given list of addresses
  if child_address in addresslist:
    print(f"Seed: {words} produces address: {child_address}")
hero member
Activity: 630
Merit: 731
Bitcoin g33k
Hi all

do any of you know of an open source project preferably on github for free use that I could use as a basis for the following?

a custom mnemonic wordlist should be used, let's call it Smiley this klingon wordlist contains 2048 lines in total, a line can contain special characters like hyphens or an equal sign or other special characters. Spaces are also considered special characters. One word (or words) per line, so in summary the word list has 2048 lines.

Then there is another file called . The tool should mass-gen n deterministic keys by using x words of the given mnemonic word list. The user should also be able to input how many derivation paths should be used for the generation. Then the seed should be generated and used to generate priv keys and their addresses. It should instantly check against the given list of Bitcoin addresses and if a hit occurs it should output the result also to a log file

Which freely available program (preferably Python or C++) can already handle this and I could use it as the basis for a test project so that I don't have to reinvent the wheel?

I look forward to helpful answers and thank you in advance.
Jump to: