0
  1. Hello everyone when i start this code on PYCHARM looks like no problem. But when i turned this code to from python to exe and exe dont start and it says : import error : cannot import name "privtopub" from ‘bitcoin’

import random

import requests

import base58

import hashlib

from bitcoin import privtopub, pubtoaddr

…… …… …… ……

while True:

i += 1

first_character = "89ABCDEF"
first_character.encode('utf-8')
last_15_character = "0123456789ABCDEF"
last_15_character.encode('utf-8')
privateKeyByte = ("000000000000000000000000000000000000000000000000" + "".join(
    random.choice(first_character) for _ in range(1)) + "".join(
    random.choice(last_15_character) for _ in range(15))).encode('utf-8')
privateKey = str(privateKeyByte)[2:-1]
extendedPrivateKey = ("80" + privateKey)
extendedPrivateKeyByte = bytearray.fromhex(extendedPrivateKey)
firstHash = hashlib.sha256()
firstHash.update(extendedPrivateKeyByte)
secondHash = hashlib.sha256()
firstHashFromHex = bytearray.fromhex(firstHash.hexdigest())
secondHash.update(firstHashFromHex)
checksum = secondHash.hexdigest()[0:8]
finalPrivateKey = extendedPrivateKey + checksum
encodedKey = bytes.fromhex(finalPrivateKey)
wifKey = base58.b58encode(encodedKey)
wifKeyString = str(wifKey)[2:-1]
publicKey = privtopub(privateKey)
btcAddress = pubtoaddr(publicKey)
  1. Last 2 code i mean publicKey = privtopub(privateKey) and btcAddress = pubtoaddr(publicKey) cannot import from bitcoin ? why ?
Asked question