Giter VIP home page Giter VIP logo

Comments (7)

lattice0 avatar lattice0 commented on June 15, 2024

Also tried with BIP49:

print("P2WSH: m/49'/0'/0'/0/"+str(x)+": " + (key/49./0./0./0/x).address('P2WSH'))

but same error

from cryptotools.

mcdallas avatar mcdallas commented on June 15, 2024

For BIP49 you want to use P2WPKH-P2SH as an address type

You can’t generate P2WSH, P2SH or P2WSH-P2SH addresses from a public key, those require a script as the name suggests

from cryptotools.

lattice0 avatar lattice0 commented on June 15, 2024

Is it possible to generate them from an Xprv or xpub?

xprv = Xprv.from_mnemonic(seed)
xpub = xprv.to_xpub()
print(xprv.to_xpub.to_address('P2WPKH'))
print(xpub.to_address('P2WPKH'))

dit not work

from cryptotools.

lattice0 avatar lattice0 commented on June 15, 2024

I'm trying to generate all possible addresses that the coldcard generates. I used:

def print_addresses(key, max_count):
	for x in range(max_count):
		print("P2PKH: m/44./0./0./0/"+str(x)+": " + (key/44./0./0./0/x).address('P2PKH')) #appears on coldcard
		print("P2WPKH: m/44./0./0./0/"+str(x)+": " + (key/44./0./0./0/x).address('P2WPKH'))
		print("P2PKH: m/49'/0'/0'/0/"+str(x)+": " + (key/49./0./0./0/x).address('P2PKH'))
		print("P2WPKH:  m/49'/0'/0'/0/"+str(x)+": " + (key/49./0./0./0/x).address('P2WPKH'))
		print("P2WPKH-P2SH: m/49'/0'/0'/0/"+str(x)+": " + (key/49./0./0./0/x).address('P2WPKH-P2SH')) #appears 

on coldcard

but only

P2PKH: m/44./0./0./0/0
P2WPKH-P2SH: m/49'/0'/0'/0/0

matched, there are still 2 sets of addresses that are not covered in this and I don't know. one set starts with bc... and the other 1. Do you know which type are they and how to generate from the seed + passphrase?

from cryptotools.

lattice0 avatar lattice0 commented on June 15, 2024

Ok, turns out this:

def print_addresses(key, max_count):
	for x in range(max_count):
		print("P2PKH: m/44./0./0./0/"+str(x)+": " + (key/44./0./0./0/x).address('P2PKH'))
		print("P2WPKH: m/44./0./0./0/"+str(x)+": " + (key/44./0./0./0/x).address('P2WPKH'))
		print("P2WPKH-P2SH: m/49./0./0./0/"+str(x)+": " + (key/49./0./0./0/x).address('P2WPKH-P2SH'))
		print("P2PKH: m/49'/0'/0'/0/"+str(x)+": " + (key/49./0./0./0/x).address('P2PKH'))
		print("P2WPKH: m/49'/0'/0'/0/"+str(x)+": " + (key/49./0./0./0/x).address('P2WPKH'))
		print("P2WPKH-P2SH: m/49'/0'/0'/0/"+str(x)+": " + (key/49./0./0./0/x).address('P2WPKH-P2SH'))
		print("P2PKH: m/84'/0'/0'/0/"+str(x)+": " + (key/84./0./0./0/x).address('P2PKH'))
		print("P2WPKH: m/84'/0'/0'/0/"+str(x)+": " + (key/84./0./0./0/x).address('P2WPKH'))
		print("P2WPKH-P2SH: m/84'/0'/0'/0/"+str(x)+": " + (key/84./0./0./0/x).address('P2WPKH-P2SH'))

generates the 3 sets, except the first set of addresses, for which I don't know how to generate. Do you have an idea? Also feel free to put these in the readme if you want to.

from cryptotools.

mcdallas avatar mcdallas commented on June 15, 2024

BIP44 —> P2PKH
BIP49 —> P2WPKH-P2SH
BIP84 —> P2WPKH

from cryptotools.

lattice0 avatar lattice0 commented on June 15, 2024
def print_addresses(key, max_count):
	for x in range(max_count):
		print("P2PKH: m/0/"+str(x)+": " + (key/0/x).address('P2PKH'))
		print("P2WPKH: m/0/"+str(x)+": " + (key/0/x).address('P2WPKH'))
		print("P2WPKH-P2SH: m/0/"+str(x)+": " + (key/0/x).address('P2WPKH-P2SH'))
		
		print("P2PKH: m/44./0./0./0/"+str(x)+": " + (key/44./0./0./0/x).address('P2PKH'))
		print("P2WPKH: m/44./0./0./0/"+str(x)+": " + (key/44./0./0./0/x).address('P2WPKH'))
		print("P2WPKH-P2SH: m/49./0./0./0/"+str(x)+": " + (key/49./0./0./0/x).address('P2WPKH-P2SH'))
		print("P2PKH: m/49'/0'/0'/0/"+str(x)+": " + (key/49./0./0./0/x).address('P2PKH'))
		print("P2WPKH: m/49'/0'/0'/0/"+str(x)+": " + (key/49./0./0./0/x).address('P2WPKH'))
		print("P2WPKH-P2SH: m/49'/0'/0'/0/"+str(x)+": " + (key/49./0./0./0/x).address('P2WPKH-P2SH'))
		print("P2PKH: m/84'/0'/0'/0/"+str(x)+": " + (key/84./0./0./0/x).address('P2PKH'))
		print("P2WPKH: m/84'/0'/0'/0/"+str(x)+": " + (key/84./0./0./0/x).address('P2WPKH'))
		print("P2WPKH-P2SH: m/84'/0'/0'/0/"+str(x)+": " + (key/84./0./0./0/x).address('P2WPKH-P2SH'))

all of these appear on the coldcard now, thanks. The one missing was m/0/x

from cryptotools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.