I want to fix the script code. The script generates from a random private key Bitcoin Address by function (pubtoaddr) and works
on the Bitcoin module:


from bitcoin import *
import os

    priv = random_key ()
    pub = privtopub (priv)
    addr = pubtoaddr (pub)


But I need to get from a Random Private Key in Hash160

For some reason I could not find such a function in main.py

I searched and found an article

>>> import pybitcointools
>>> privkey = pybitcointools.random_key ()
>>> privkey
>>> pubkey = pybitcointools.privtopub (privkey)
>>> pubkey
>>> h160 = pybitcointools.hash160 (pubkey.decode ('hex'))
>>> h160
>>> addr = pybitcointools.hex_to_b58check (h160)
>>> addr

Unfortunately I could not get from

 priv = random_key ()  --- > Hash160

How to do it?


By pplny

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다