Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to create addresses from pubkey ? #371

Open
mamumi opened this issue Jun 13, 2020 · 1 comment
Open

how to create addresses from pubkey ? #371

mamumi opened this issue Jun 13, 2020 · 1 comment

Comments

@mamumi
Copy link

mamumi commented Jun 13, 2020

`

(base) C:\Users\MM>ku 04c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee51ae168fea63dc339a3c58419466ceaeef7f632653266d0e1236431a950cfe52a

input : >04c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5
1ae168fea63dc339a3c58419466ceaeef7f632653266d0e1236431a950cfe52a
network : Bitcoin mainnet
symbol : BTC
public pair x : 89565891926547004231252920425935692360644145829622209833684329913297188986597
public pair y : 12158399299693830322967808612713398636155367887041628176798871954788371653930
x as hex : c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5
y as hex : 1ae168fea63dc339a3c58419466ceaeef7f632653266d0e1236431a950cfe52a
y parity : even
key pair as sec : 02c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5
uncompressed : 04c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5
1ae168fea63dc339a3c58419466ceaeef7f632653266d0e1236431a950cfe52a
hash160 : 06afd46bcdfd22ef94ac122aa11f241244a37ecc
uncompressed : d6c8e828c1eca1bba065e1b83e1dc2a36e387a42
Bitcoin address : 1cMh228HTCiwS8ZsaakH8A8wze1JR5ZsP
Bitcoin address uncompressed : 1LagHJk2FyCV2VzrNHVqg3gYG4TSYwDV4m
Bitcoin segwit address : bc1qq6hag67dl53wl99vzg42z8eyzfz2xlkvxechjp
p2sh segwit : 3FWHHE3RVgyv5vYmMrcoRdA25uugWvQbso
corresponding p2sh script : 001406afd46bcdfd22ef94ac122aa11f241244a37ecc



(base) C:\Users\MM>python
Python 3.7.4 (default, Aug 9 2019, 18:34:13) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.

from pycoin.encoding.hexbytes import h2b
from pycoin.symbols.btc import network
pub = '04c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee51ae168fea63dc339a3c58419466ceaeef7f632653266d0e1236431a950cfe52a'
hpub = h2b(pub)
key = network.keys.public(hpub)
key
BTCSEC:04c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee51ae168fea63dc339a3c58419466ceaeef7f632653266d0e1236431a950cfe52a
key.address()
'1LagHJk2FyCV2VzrNHVqg3gYG4TSYwDV4m'

`

hello
i am new on python, i know it
how to create Bitcoin address , p2sh segwit and Bitcoin segwit address on python console ?

@psqnt
Copy link

psqnt commented Nov 12, 2020

Once you have your xprv or xpub from ku create
you can generate child nodes from that, each node has an associated address.

$ ku create
$ ku <your-xpub-here> -s 0/0-10

This will generate 10 subkeys (using -s). If you are only interested in new addresses add the -a parameter to the end:

ku <xpub> -s 0/0-10 -a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants