Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with keypairs #115

Closed
Jaykingamez opened this issue May 17, 2018 · 9 comments
Closed

Issues with keypairs #115

Jaykingamez opened this issue May 17, 2018 · 9 comments

Comments

@Jaykingamez
Copy link

Going through the READ.ME docs, I hit a major roadblock.

Typing this:

from stellar_base.keypair import Keypair
kp = Keypair.random()

GIves me this error:

Traceback (most recent call last):
File "D:/Stellar toybox.py", line 5, in
kp1 = Keypair.deterministic(m,index=1)
File "D:\lib\site-packages\stellar_base\keypair.py", line 35, in deterministic
return cls.from_raw_seed(seed)
File "D:\lib\site-packages\stellar_base\keypair.py", line 53, in from_raw_seed
signing_key = ed25519.SigningKey(raw_seed)
File "D:\lib\site-packages\ed25519\keys.py", line 85, in init
vk_s, sk_s = _ed25519.publickey(sk_s)
MemoryError

Huh? MemoryError?

Ok, so the first method creating Stellar key pair doesn't work for me, let's try the eecond method. It works, very well and...

It comes to here:

kp = Keypair.deterministic(m) #I typed this out without defining language as I wanted it to be in Standard English

Traceback (most recent call last):
File "D:/Stellar toybox.py", line 4, in
kp = Keypair.deterministic(m)
NameError: name 'Keypair' is not defined

Ok so it's not defined, let me scroll down more to see whether anything can help.

kp1 = Keypair.deterministic(m, lang='chinese', index=1)#Same error
kp2 = Keypair.deterministic(m, lang='chinese', index=2) #Same error

Here's my code, I typed it all out as I really wanted to learn how to use the python-base package. (Some errors might be due to my bad typing)

from stellar_base.utils import StellarMnemonic
sm = StellarMnemonic()
m = sm.generate()
kp1 = Keypair.deterministic(m,index=1)
kp2 = Keypair.deterministic(m,index=2)

@bolshoy
Copy link
Contributor

bolshoy commented May 18, 2018

Keypair.random() always works for me. Maybe a problem with ed25519 package (it's compiled from C)?

@overcat
Copy link
Member

overcat commented May 18, 2018

In the second way, you need import Keypair.

from stellar_base.utils import StellarMnemonic
from stellar_base.keypair import Keypair
sm = StellarMnemonic()
m = sm.generate()
kp1 = Keypair.deterministic(m, index=1)
kp2 = Keypair.deterministic(m, index=2)

@Jaykingamez
Copy link
Author

@bolshoy "Maybe a problem with ed25519 package (it's compiled from C)?" I don't think the problem lies here, after all, in the earlier issue I faced, I went to the Stack Overflow site and used Microsoft Visual Studio with build tools to even pip install stellar_base. And one query, when you meant C, you meant C or C++?

@overcat Hmm, I kinda deduce that, but the issue is when I import Keypair

from stellar_base.keypair import Keypair

And type any code related to Keypair underneath it.

Traceback (most recent call last):
File "D:/fuck you.py", line 5, in
kp1 = Keypair.deterministic(m, index=1)
File "D:\lib\site-packages\stellar_base\keypair.py", line 35, in deterministic
return cls.from_raw_seed(seed)
File "D:\lib\site-packages\stellar_base\keypair.py", line 53, in from_raw_seed
signing_key = ed25519.SigningKey(raw_seed)
File "D:\lib\site-packages\ed25519\keys.py", line 85, in init
vk_s, sk_s = _ed25519.publickey(sk_s)
MemoryError

I somehow have memory issues?

@bolshoy
Copy link
Contributor

bolshoy commented May 19, 2018

@Jaykingamez I meant cl.exe. It does look like a platform related issue, because I work on Mac OSX, it's all fine there, and Memory Error is surely a native module related issue.
Hey, looks like people have already experienced the issue with python 3.6.4: warner/python-ed25519#12
What python version are you using?

@Jaykingamez
Copy link
Author

@bolshoy Python 3.6.5. Welp, I guess if i really want to learn to develop on Stellar, i have to

  1. Get another OS

Or

  1. Learn Javascript

@overcat
Copy link
Member

overcat commented May 19, 2018

@bolshoy Maybe you can try to downgrade to Python 3.5 first, the cases reported have all occurred in Win10 + Python 3.6

@Jaykingamez
Copy link
Author

Jaykingamez commented May 20, 2018

@overcat Downgraded to Python 3.5.0, Numpy not exactly working, receiving this error.

Traceback (most recent call last):
File "D:\lib\site-packages\numpy\core_init_.py", line 16, in
from . import multiarray
ImportError: cannot import name 'multiarray'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "D:/Stellarwhyyoudothis.py", line 1, in
from stellar_base.keypair import Keypair
File "D:\lib\site-packages\stellar_base\keypair.py", line 8, in
from .utils import decode_check, encode_check, StellarMnemonic
File "D:\lib\site-packages\stellar_base\utils.py", line 16, in
import numpy as np
File "D:\lib\site-packages\numpy_init_.py", line 142, in
from . import add_newdocs
File "D:\lib\site-packages\numpy\add_newdocs.py", line 13, in
from numpy.lib import add_newdoc
File "D:\lib\site-packages\numpy\lib_init_.py", line 8, in
from .type_check import *
File "D:\lib\site-packages\numpy\lib\type_check.py", line 11, in
import numpy.core.numeric as nx
File "D:\lib\site-packages\numpy\core_init
.py", line 26, in
raise ImportError(msg)
ImportError:
Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try git clean -xdf (removes all
files not under version control). Otherwise reinstall numpy.

Original error was: cannot import name 'multiarray'

Numpy i'm using came with the stellar_base. Oh and here's the code that triggered this error,

from stellar_base.keypair import Keypair
kp = Keypair.random()

@bolshoy
Copy link
Contributor

bolshoy commented May 20, 2018

@Jaykingamez this is a different problem, again related to python on Windows. See if you have a solution here: numpy/numpy#9272

@overcat overcat closed this as completed May 23, 2018
@manran
Copy link
Member

manran commented Jul 23, 2018

@Jaykingamez
try pip install pure25519 as a workaround at this moment.
check it out here: https://github.com/StellarCN/py-stellar-base/blob/master/stellar_base/keypair.py#L11-L16

@manran manran reopened this Jul 23, 2018
@overcat overcat closed this as completed Jul 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants