为什么我会收到这个错误? “模块”对象不可调用

问题描述 投票:0回答:0

为什么我会收到这个错误?我很困惑。

Traceback (most recent call last):
  File "main.py", line 18, in <module>
    private_key = keccak(token_bytes(32)).digest()
TypeError: 'module' object is not callable

{ 从秘密导入 token_bytes 从 coincurve 导入公钥 从 Crypto.Hash 导入 keccak k = keccak.new(digest_bits=256) #from sha3 导入 keccak_256 导入时间

# these ethereum addresses are hacker addresses
adresler="0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,    
0x742d35cc6634c0532925a3b844bc454e4438f44e, 
0xbe0eb53f46cd790cd13851d5eff43d12404d33e8"

a=1
found_nmbr=0
number = int(input("please enter the number"))
start = time.time()

for x in range(number):
time1 = time.time() - start
private_key = keccak(token_bytes(32)).digest()
public_key = 
PublicKey.from_valid_secret(private_key).format(compressed=False) 
[1:]
addr = keccak(public_key).digest()[-20:].hex()
public_address="0x"+addr
#public_address="0x229b5c097f9b35009ca1321ad2034d4b3d5070f6"
aranan_varmi=adresler.find(public_address)
if aranan_varmi !=-1:
print("aha eslesme var ya la")
dosya2 = open("eslesme.txt", "a")
dosya2.write(private_key.hex() + " " + public_address + "\n")
dosya2.close()
print("Private key  :  : " + private_key.hex())
print("Address  : " + public_address)
dosya2 = open("eslesme.txt", "a")
dosya2.write(private_key.hex() + " " + public_address + "\n")
time.sleep(3)
found_nmbr=found_nmbr+1
else:
print(" "+private_key.hex() + "-" + public_address + '\t' + 
str(a)+" Founded = "+str(found_nmbr))
a+=1
print("total time %s second" % time1)

}

我该如何解决这个错误?

python python-3.x python-2.7 ethereum web3
© www.soinside.com 2019 - 2024. All rights reserved.