title: How Create Bitcoin wallet from a private key works?
body: <p>I'm trying to understand how i can create a pair of bitcoin private key and public key and import them in electrum wallet</p>
  <p>1 try with : <a href="https://github.com/Destiner/blocksmith" rel="nofollow noreferrer">https://github.com/Destiner/blocksmith</a></p>
  <p>for example :</p>
  <pre><code> import blocksmith
   
   kg = blocksmith.KeyGenerator()
  
   kg.seed_input(&quot;(/sgroxa)n;[&amp;1ox7fioqg4*v8&quot;)
   #seed is the private key ?
  
   key = kg.generate_key()
   #returned key : 7e659f56d6f20a64258b65445c825e62edf6b89219d4b3eb3ebec6ecb8f62859
   #this key is a formated &quot;(/sgroxa)n;[&amp;1ox7fioqg4*v8&quot; version  ?
  
   address = blocksmith.BitcoinWallet.generate_address(key)
   #returned address : 112qrCJdHgudHmsKKKwvj3AM3aN2eN9wpP
  </code></pre>
  <p><strong>how to import this in electrum wallet?</strong></p>
  <hr />
  <p>2 try : <a href="https://github.com/mcdallas/cryptotools" rel="nofollow noreferrer">https://github.com/mcdallas/cryptotools</a></p>
  <pre><code>#python38 setup.py install
  
  import os
  os.environ['CRYPTOTOOLS_NETWORK'] = 'main'
  
  from cryptotools.BTC import PrivateKey, Address
  
  #private = PrivateKey.random()
  
  mystring='supersecret'.encode('utf-8')
  mystring2 = mystring.hex()
  private = PrivateKey.from_hex(mystring2)
  #private = PrivateKey.random()
  print(&quot;PRIVATE NOR: &quot;+str(mystring))
  print(&quot;PRIVATE HEX: &quot;+mystring2)
  #private = PrivateKey.from_wif('yourwifhere')
  
  #and then to get the hex representation use private.hex() of private.wif()
  
  
  public = private.to_public()
  print(&quot;PUBLIC NOR: &quot;+str(public))
  print(&quot;PUBLIC HEX: &quot;+public.hex())
  #public.hex(compressed=True)
  
  addrp2pkh = public.to_address('P2PKH')
  print(&quot;ADDR addrp2pkh: &quot;+addrp2pkh)
  #'16B2Ghyu5C1CofKfXF2Zi9JycqaAyaE8cd'
  addrp2wpkh = public.to_address('P2WPKH')
  print(&quot;ADDR addrp2wpkh: &quot;+addrp2wpkh)
  </code></pre>
  <p>return</p>
  <pre><code>PRIVATE NOR: b'supersecret'
  PRIVATE HEX: 7375706572736563726574
  PUBLIC NOR: PublicKey(8168986507460029097250523306678031295706525425592031410379320603875628502471, 68217540890844357698499484021605168903182743958311172870030299256854130530932)
  PUBLIC HEX: 04120f7b85fbc8d10d7564fe6dcb99291661014e87d2579068448f8d0b54bf4dc796d1c2869226dfb3609808158d1c4cec9a3a1ebee12994a2779e1d2dac851a74
  ADDR addrp2pkh: 15nTqJEGWZg9DTjj7KSjwwKf3xHhpSiQyQ
  ADDR addrp2wpkh: bc1q3pv43a0tujsy9kp526su2fz93at70demcj4phw
  </code></pre>
  <p><strong>how to import this in electrum wallet?</strong></p>
  <p>i cant see how i cant key my pub key for import it into electrum wallet for example ?
  Cant you help to understand my mistake  or if i confuse something?</p>
  <p>Thanks</p>