【发布时间】:2020-09-13 09:07:37
【问题描述】:
我正在尝试制作一个循环,以便脚本不断生成哈希
from bitcoin import *
import os
import hashlib
import base58
while True:
priv = random_key()
pubkey = privtopub(priv)
compress_pubkey = False
if (compress_pubkey):
if (ord(pubkey[-2:].decode('hex')) % 2 == 0):
pubkey_compressed = '02'
else:
pubkey_compressed = '03'
pubkey_compressed += pubkey[2:66]
hex_str = bytearray.fromhex(pubkey_compressed)
else:
hex_str = bytearray.fromhex(pubkey)
key_hash = hash160(hex_str)
我正在使用 Python 3,但出现错误:
if (ord(pubkey[-2:].decode('hex')) % 2 == 0):
^
IndentationError: expected an indented block
【问题讨论】:
-
TL:DR 选择此 if 和下面的行,然后按键盘上的 TAB。 Python 需要缩进 if 块内的代码
标签: python python-3.x random