I need to repair the script code. The script generates from a random personal key Bitcoin Tackle by perform (pubtoaddr) and works
on the Bitcoin module:

https://github.com/primal100/pybitcointools/blob/master/cryptos/main.py

from bitcoin import *
import os

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

....
....

However I must get from a Random Non-public Key in Hash160

For some purpose I couldn’t discover such a perform in major.py

I searched and located an article

>>> import pybitcointools
>>> privkey = pybitcointools.random_key ()
>>> privkey
'34030ce14e32ac982419b3683af3b59d64a29cc93798cf479d610af49d425d13'
>>> pubkey = pybitcointools.privtopub (privkey)
>>> pubkey
'04ce0ed35340803b0c21f2f7f5d5ab9d687e5fa95a79471c9b5c9d97a0bb170eac1045230cc51d13b85a5f64feb80f8fc19358a396797926e3f89d49066b1abc07'
>>> h160 = pybitcointools.hash160 (pubkey.decode ('hex'))
>>> h160
'1558c7cd9825447a31990ff964f347bb2dbfe9be'
>>> addr = pybitcointools.hex_to_b58verify (h160)
>>> addr
'12wsYc4B9c9JeREqstLZXNWa3n4i42M5jg'

Sadly I couldn’t get from

 priv = random_key ()  --- > Hash160

The way to do it?

Source link

LEAVE A REPLY

Please enter your comment!
Please enter your name here