Git Product home page Git Product logo

bitcoinaddress's People

Contributors

bjorn-qb avatar fortesp avatar jolly-pirate avatar streamofstars avatar teimoon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bitcoinaddress's Issues

Add Hash160

hash160 (20byte) format is very important and missing from output.

Output is wrong

Instead of

Public Address bc1 P2WPKH: bc1qdveuf0egtfdnd2fnsp0lzfukn2e58czf8323ky6xt8ydew4ecfcqv3ettx    
Public Address bc1 P2WSH: bc1q2jxe5azr6zmhk3258av7ul6cqtu4eu4mps8f4p

it should be

Public Address bc1 P2WSH: bc1qdveuf0egtfdnd2fnsp0lzfukn2e58czf8323ky6xt8ydew4ecfcqv3ettx    
Public Address bc1 P2WPKH: bc1q2jxe5azr6zmhk3258av7ul6cqtu4eu4mps8f4p

Why all generated address in range 00 and how to change range to 0000

Could you help me please
Why all generated address hex start with 00? How to change it to start for example 0000 or 000000
I tried to to change key, address, key, seed but no success for making this change
Hex 160:

00C32DE061453296E71E9E9E9D5636E7E7FEE272C7
00BB9EB37303709E92C7D121F8751ECD97B5D407EB
00DFD584C7534C1B8E0BB41AF2C64DC2EE479A7895

Base58:

1Jo1ixjbSN9nzdavauqFNCsNPMBxANyErF
1J73UcLXkeTYXDq9qycDMwwUf1EVbNgh8Y
1MQXUKHP29jVBq6rrmiQzKv6w1kfcBWtdE

Thank you

How to use it programatically?

This library print the address data very pretty but when you want to use it's API to get some information out of it and get different addresses it become really frustrating..Please review and setup some helper functions to retrieve each address accordingly

p2wsh addresses

I'm looking for to double check some of my python code outputs and find that your outputs for p2wsh doesnt match this sample which I was guided:

https://bc-2.jp/tools/bech32demo/index.html

Could You check your metod for this and explain how there is difference.

Thanks in advance.

Openssl removed ripemd160 - issues on Ubuntu22

Type "help", "copyright", "credits" or "license" for more information.
>>> from bitcoinaddress import Wallet
>>> wallet = Wallet()
Traceback (most recent call last):
  File "/usr/lib/python3.10/hashlib.py", line 160, in __hash_new
    return _hashlib.new(name, data, **kwargs)
ValueError: [digital envelope routines] unsupported

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/user/.local/lib/python3.10/site-packages/bitcoinaddress/wallet.py", line 16, in __init__
    self.address = Address.of(self.key)
  File "/home/user/.local/lib/python3.10/site-packages/bitcoinaddress/address.py", line 88, in of
    address.generate()
  File "/home/user/.local/lib/python3.10/site-packages/bitcoinaddress/address.py", line 94, in generate
    self.mainnet.generate_publicaddress1()
  File "/home/user/.local/lib/python3.10/site-packages/bitcoinaddress/address.py", line 38, in generate_publicaddress1
    self.pubaddr1 = self.instance._generate_publicaddress1(Address.MainNet.PREFIX_A,
  File "/home/user/.local/lib/python3.10/site-packages/bitcoinaddress/address.py", line 107, in _generate_publicaddress1
    m = prefix_a + hash160(p).digest()
  File "/home/user/.local/lib/python3.10/site-packages/bitcoinaddress/util.py", line 20, in hash160
    return ripemd(hashlib.sha256(v).digest())
  File "/home/user/.local/lib/python3.10/site-packages/bitcoinaddress/util.py", line 24, in ripemd
    r = hashlib.new('ripemd160')
  File "/usr/lib/python3.10/hashlib.py", line 166, in __hash_new
    return __get_builtin_constructor(name)(data)
  File "/usr/lib/python3.10/hashlib.py", line 123, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name) ```
    ```

ValueError: unsupported hash type ripemd160

Kernel: 5.15.0-33
Ubuntu 22.04 LTS
OpenSSL: OpenSSL 3.0.2 15 Mar 2022 (Library: OpenSSL 3.0.2 15 Mar 2022)
https://www.openssl.org/news/changelog.html

The low-level MD2, MD4, MD5, MDC2, RIPEMD160 and Whirlpool digest functions have been deprecated.

I would need some advice here ?

Actually it's not issue, it's 2 questions

First thank you so much for the library, really it's big effort from you:

Q1: Where is the wif or wifc for eth {bc1}. your code creates BTC uncompresed and compresed and privatekey for every one
is there is privatekey for bc1 address?

Q2. is this random number can bring real existing BTC address with balance ?

Q3. how can I have your package 2 time inside my pc. I need to edit the library files and keep original one?

Thank you again

Best Regards,

Need explanation on Wallet()

Hi,
first of all, thank you very much for your job, It's fantastic.

Is it possible to use Wallet() with a defined private key in string format?
Can you provide a quickly example for this?

Thank you in advance.

'seed' is not stored as instance variable in __init__ method of Key class

First of all, thank you for sharing this library.

I noticed that the __init__ method of the Key class does not store the optionally passed seed value as an instance variable:

def __init__(self, seed=None):

Also, the generate() method does not try to use self.seed in case it was defined upon instantiation.

Consequently, when you do:

key = Key('some seed')
key.generate()

It will generate from a random seed instead of the value passed upon instantiation. For example here:

self.key.generate()

To work, it would need to look like this (currently):

key = Key()
key.generate('some seed')

(Unrelated: it would be interesting if the Address class would provide convenience functions to convert one format to another without having a private key. The use case would be: I have a bc1 address and want to know its base58 version starting with 1 etc. This means one can have an Address instance without having a private key, but at least one version of the public key.)

Wallet generator failing

Cloned and just running the example immediately fails:

In [11]: from bitcoinaddress import Wallet

In [12]: wallet = Wallet()

AttributeError Traceback (most recent call last)
in
----> 1 wallet = Wallet()

/usr/lib/python3.9/site-packages/bitcoinaddress/wallet.py in init(self, hash_or_seed, testnet)
13 def init(self, hash_or_seed=None, testnet=False):
14 if hash_or_seed is None: hash_or_seed = Seed()
---> 15 self.key = Key.of(hash_or_seed)
16 self.address = Address.of(self.key)
17 self.testnet = testnet

/usr/lib/python3.9/site-packages/bitcoinaddress/key/key.py in of(obj)
57 key = Key()
58 if isinstance(obj, Seed):
---> 59 key._from_seed(obj)
60 else:
61 try:

/usr/lib/python3.9/site-packages/bitcoinaddress/key/key.py in _from_seed(self, seed)
77 self._generate_digest()
78 self._generate_hex()
---> 79 self.mainnet.generate_wif()
80 self.mainnet.generate_wif_compressed()
81 self.testnet.generate_wif()

/usr/lib/python3.9/site-packages/bitcoinaddress/key/key.py in generate_wif(self)
28
29 def generate_wif(self):
---> 30 self.wif = self.instance._generate_wif(Key.MainNet.PREFIX)
31
32 def generate_wif_compressed(self):

/usr/lib/python3.9/site-packages/bitcoinaddress/key/key.py in _generate_wif(self, prefix)
110 digest = prefix + self.digest
111 c = checksum(digest)
--> 112 return base58.b58encode(digest + c).decode('utf-8')
113
114 def _generate_wif_compressed(self, prefix, suffix):

AttributeError: 'str' object has no attribute 'decode'

Need help

Good day,
would you mind providing a small example, how do I generate all possible BTC public addresses (P2PKH, P2SH, Bech32) using existing WIF private key, in string format?

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.