bitcoin_tools icon indicating copy to clipboard operation
bitcoin_tools copied to clipboard

No module named 'bitcoin_tools.core'

Open santoshgadagamma opened this issue 3 years ago • 5 comments

Hello,

I am installing all the packages using pip command but still i am facing the below error.

Traceback (most recent call last): File "C:\Users\GSK\AppData\Local\Programs\Python\Python37-32\mybit.py", line 1, in from bitcoin_tools.core.keys import generate_keys, store_keys ModuleNotFoundError: No module named 'bitcoin_tools.core'

How can i overcome this error. Please guide me.

santoshgadagamma avatar Dec 19 '20 17:12 santoshgadagamma

Looks like you're trying to install the library using Python3, but the library is written in Python2.

You should use a Python2 interpreter.

sr-gi avatar Dec 21 '20 13:12 sr-gi

The above issue is resolved but new issue raised, see the below description. How to resolve this issue. Traceback (most recent call last): File "<pyshell#3>", line 1, in from bitcoin_tools.core.keys import generate_keys, store_keys File "C:\Python27\lib\site-packages\bitcoin_tools_init_.py", line 1, in from bitcoin_tools.S256Point import * File "C:\Python27\lib\site-packages\bitcoin_tools\S256Point.py", line 168, in 0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8) File "C:\Python27\lib\site-packages\bitcoin_tools\S256Point.py", line 32, in init a, b = S256Field(A), S256Field(B) File "C:\Python27\lib\site-packages\bitcoin_tools\S256Point.py", line 16, in init super().init(num=num, prime=P) TypeError: super() takes at least 1 argument (0 given)

santoshgadagamma avatar Jan 01 '21 18:01 santoshgadagamma

Can you provide what file or script are you running so I can test this myself?

sr-gi avatar Jan 05 '21 09:01 sr-gi

Installing packages pip install python_bitcoin_tools pip install bit See the below script which is provided in the website.

from bitcoin_tools.core.keys import generate_keys, store_keys from bitcoin_tools.wallet import generate_wif, generate_btc_addr

First of all the ECDSA keys are generated.

sk, pk = generate_keys()

Then, the Bitcoin address is derived from the public key created above.

btc_addr = generate_btc_addr(pk)

Both the public and private key are stored in disk in pem format. The Bitcoin address is used as an identifier in the

name of the folder that contains both keys.

store_keys(sk.to_pem(), pk.to_pem(), btc_addr)

Finally, the private key is encoded as WIF and also stored in disk, ready to be imported in a wallet.

generate_wif(btc_addr, sk)

And error:

Traceback (most recent call last): File "C:\Python27\FirstBtc.py", line 1, in from bitcoin_tools.core.keys import generate_keys, store_keys File "C:\Python27\lib\site-packages\bitcoin_tools_init_.py", line 1, in from bitcoin_tools.S256Point import * File "C:\Python27\lib\site-packages\bitcoin_tools\S256Point.py", line 168, in 0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8) File "C:\Python27\lib\site-packages\bitcoin_tools\S256Point.py", line 32, in init a, b = S256Field(A), S256Field(B) File "C:\Python27\lib\site-packages\bitcoin_tools\S256Point.py", line 16, in init super().init(num=num, prime=P) TypeError: super() takes at least 1 argument (0 given)

i am using python2.

santoshgadagamma avatar Jan 05 '21 18:01 santoshgadagamma

Oh OK, I see.

Looks like you have not properly installed the library. You need to follow the installing instructions under INSTALL.md, otherwise python cannot find the library.

sr-gi avatar Jan 08 '21 19:01 sr-gi