<p>I have run into a problem when trying to generate public keys from my mnemonics via privatekeys. The mnemonic -> privkey is fairly fast. Although when deriving the m/44./0./0./0/0 public adress it takes about a 1.2s, which is way too slow. I first thought this was typical for the hasing functions, but when generating privatekeys online I see that one can generate 20-30 publickeys per seconds on a simple web-script. </p>

<p>Do anyone have a solution or could point me in the right direction on how to do this? I have a text-document with a couple of million privkeys to go through and would appreciate all help.</p>

<p>Br</p>

CC BY-SA 4.0
2019-01-29T15:24:47.147Z
Right now I am using the python lib btctools, if it is of interest. I am not sure why it take such a long time generating the addresses.
Auxilium
CC BY-SA 4.0
2019-01-29T15:31:34.743Z
you could try using an optimized library such as https://github.com/bitcoin-core/secp256k1
JBaczuk
CC BY-SA 4.0
2019-01-29T15:35:08.380Z
Point operations over 256bits are expensive, even with double and add algorithm which is O(logn) complexity. @JBaczuk What algorithm is used in libsecp256k1?
James C.
CC BY-SA 4.0
2019-01-29T16:13:47.930Z
@JamesC good question, from what I can tell, there are different optimizations depending on the operation https://github.com/bitcoin-core/secp256k1#implementation-details
JBaczuk
CC BY-SA 4.0
2019-01-29T16:34:05.133Z
So the 1.2s seems to be slow? So that I am not looking for an answer that is impossible to find. I will look into that, sadly I haven't been coding a lot...
Auxilium
CC BY-SA 4.0
2019-01-29T17:51:29.587Z
Author here, it's just a toy library written in pure python with no optimizations at all. I don't think libsecp can generate HD keys. Maybe give pywallet a try.
Mike D
<private-key><python>
Fastest way to generate millions of public keys from private keys (Python/C#)
Auxilium
# Fastest way to generate millions of public keys from private keys (Python/C#)

(Asked by: username_0 on 2019-01-29)

I have run into a problem when trying to generate public keys from my mnemonics via privatekeys. The mnemonic -> privkey is fairly fast. Although when deriving the m/44./0./0./0/0 public adress it takes about a 1.2s, which is way too slow. I first thought this was typical for the hasing functions, but when generating privatekeys online I see that one can generate 20-30 publickeys per seconds on a simple web-script.

Do anyone have a solution or could point me in the right direction on how to do this? I have a text-document with a couple of million privkeys to go through and would appreciate all help.

Br

**Tags:** private-key, python

> **Comments:**
> **username_0**: Right now I am using the python lib btctools, if it is of interest. I am not sure why it take such a long time generating the addresses.  
> **username_1**: you could try using an optimized library such as https://github.com/bitcoin-core/secp256k1  
> **username_2**: Point operations over 256bits are expensive, even with double and add algorithm which is O(logn) complexity. @username_1 What algorithm is used in libsecp256k1?  
> **username_1**: @JamesC good question, from what I can tell, there are different optimizations depending on the operation https://github.com/bitcoin-core/secp256k1#implementation-details  
> **username_0**: So the 1.2s seems to be slow? So that I am not looking for an answer that is impossible to find. I will look into that, sadly I haven't been coding a lot...  
> **username_3**: Author here, it's just a toy library written in pure python with no optimizations at all. I don't think libsecp can generate HD keys. Maybe give pywallet a try.  

---

## 0 answers

