Giter Site home page Giter Site logo

pybitcoin's People

Contributors

deftnerd avatar ibrahimahmed443 avatar jcnelson avatar lionzeye avatar muneeb-ali avatar shea256 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pybitcoin's Issues

How to run sequential deterministic wallet?

I have successfully run the setup.py however when I try to run wallet.py I received the following error:

: line 8: $'\n pybitcoin\n ~~~~~\n\n ©️ (c) 2014 by Halfmoon Labs\n :license: MIT, see LICENSE for more details.\n': command not found
from: can't read /var/mail/inspect
from: can't read /var/mail/.keypair
from: can't read /var/mail/.passphrases
./wallet.py: line 16: syntax error near unexpected token (' ./wallet.py: line 16: def is_cryptocurrency_keypair_class(cls):'

Dependency Issues

Upon trying to import and use any of the coinkit functionality, I get this error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "coinkit/__init__.py", line 14, in <module>
    from .b58check import b58check_encode, b58check_decode, b58check_unpack, \
  File "coinkit/b58check.py", line 14, in <module>
    from characters.charset import change_charset
ImportError: No module named characters.charset

I haven't been able to identify a package to install that contains this module. Any help would be appreciated.

I am running CrunchBang Linux (a Debian derivative).

converting public keys to addresses (idk if its featured and I just don't know it, or if it should be added)

I have public keys in the form of 2 integers being x,y, in normal integer format. I don't see how to convert that to use public_key.address() or the other commands. public_key.to_hex() seems to be something that would work, but it doesn't specify what format the public_key needs to be in (assuming I'm even knowledgeable enough to convert my x,y coordinates into what it requires). Am I merely ignorant about the existence of this feature, or am I asking for it to be added? Idk

Any way to derive another address from a private key?

In most wallets, you can derive a new address from a private key. You should be able to get a practically infinite number of addresses from a private key. Is there any parameter similar to this in the library?

Inconsistent management of invalid values in BitcoinPrivateKey

BitcoinPublicKey("wrong")
result: ValueError: Public key is not in proper format

BitcoinPrivateKey("wrong")
result: AssertionError


Explanation:
Unless there are some reasons why this has been implemented this way, I believe BitcoinPrivateKey should follow the same behavior of BitcoinPublicKey.

try/exception of invalid keys should look the same, while (as it is now) different exceptions are being presented.


Reason:
While the file publickey.py presents a get_public_key_format function (which handles invalid formats with a ValueError), its counterpart get_privkey_format in main.py leaves this job to the function b58check_to_bin.


Possible solution:
the call to b58check_to_bin in get_privkey_format should be wrapped in a try block, the AssertionError should be caught and a ValueError should be raised instead.


Impact:
I have not considered the impact of such a change nor possible regressions.

NamecoindClient ssl 'module' object has no attribute '_create_unverified_context'

Ubuntu 14.04
python 2.7.8
pybitcoin==0.8.2

>>> from pybitcoin.rpc import NamecoindClient
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/pybitcoin/rpc/__init__.py", line 14, in <module>
    from .namecoind_client import NamecoindClient
  File "/usr/local/lib/python2.7/dist-packages/pybitcoin/rpc/namecoind_client.py", line 20, in <module>
    ssl._create_default_https_context = ssl._create_unverified_context
AttributeError: 'module' object has no attribute '_create_unverified_context'

How to install?

hello, I am trying to install this, so I can
from pybitcoin import BitcoinPrivateKey

I am on Mac. Can someone tell me how to install it? thanks

From private key to public key -> BTC address

BTC address: '1DcKRUKGKt5bwi3mtFNNEuufp6DFxEBR9C'
Private Key: 'fb8c80c0d5af5c14e3b19265bf4c1fef00a457933b2022d145694a541549acaf'

I have a private key and I want to get the BTC address, this is what I do:

from pybitcoin import BitcoinPrivateKey
private_key = BitcoinPrivateKey('fb8c80c0d5af5c14e3b19265bf4c1fef00a457933b2022d145694a541549acaf')
private_key.public_key().address()

output: '1DBkszCUoFuXEJE1ynbteVLYZcuUjjKChS'

what I am doing wrong?

Import error

When I run

python unit_tests.py I got the following error:

Traceback (most recent call last): File "unit_tests.py", line 38, in <module> from settings import BITCOIND_RPC_PASSWORD, BITCOIND_RPC_USERNAME, \ ImportError: cannot import name BITCOIND_RPC_PASSWORD

I looked into the scripts and it seems fine, how to fix this error? Thank you.

get_unspents should return an empty list for valid addresses with no transactions

get_unspents("19SbDasdasdNEkwRqnBAv7Ewumy7XcCau9Wp4BH9")

Expected behavior:
result: [ ]

Actual behavior:
result: Exception('Invalid response from blockchain.info.')

Reson:
blockchain.info returns non-JSON response "No free outputs to spend" if the address is valid but with no unspents. The file "blockchain_info.py" (at lines 49 to 53) doesn't check for non-JSON responses but blatantly returns error if it cannot parse JSON content.

Proposed fix:
at line 50:
if r.content == "No free outputs to spend": return [ ]

Python 3 support

Python 3.5.2 (default, Jul 17 2016, 00:00:00) 
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pybitcoin import LitecoinPrivateKey
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<...>/site-packages/pybitcoin/__init__.py", line 10, in <module>
    import services
ImportError: No module named 'services'

See: https://www.python.org/dev/peps/pep-0328/#rationale-for-absolute-imports

Move blockchain-facing logic to virtualchain

In an effort to better wrangle Blockstack's packages, especially in light of interfacing with multiple blockchains, I propose doing the following:

  • make blockstack-virtualchain the package you install to:
    • read and write transactions
    • connect to specific blockchains
    • query blockchain state
  • make keylib the package you install to:
    • create blockchain keys and addresses

blockstack-virtualchain would also subsume blockstack-utxo.

compressed public, private and wif keys

i need to compressed keys for bitcoin and i can not find any method in the documentation to get compressed key from pybitcoin. anyone jst help me, urgent

Option to use urandom in `def random_secret_exponent`

Is it safe to use /dev/urandom in random_secrect_exponent? It provides much more data than /dev/random. The problem is I need to generate 50 wallets at one time and /dev/random is too slow for that.
I can make pull request that adds new option to BitcoinPrivateKey constructor to allow to use /dev/urandom instead of default /dev/random.

Generate bitcoin address from secret exponent?

Hi, i have an issue generating a bitcoin address with custom secret exponent, i tried with keypair = BitcoinKeypair.secret_exponent("1")
or
x = 1
keypair = BitcoinKeypair.secret_exponent(x)

i got the following error TypeError: unbound method secret_exponent() must be called with BitcoinKeypair instance as first argument (got str instance instead)

Anyone can help me please?

Thank you

Why do differently public key between pybitcoin and Qt wallet ?

FeathercoinPrivateKey('e2ee135cc175081810bbaa603df551f657c8e8a37aca1321883fc588022f95d6').public_key().to_hex()
the result: 04edb297ba63c35998ec23cfca60666bb4d0d1c3e810b93d2d20c94e3a129774407b719ecf902de8a20c6d99ed0ad0d8c5af178640fdcb0c5dee26c41d39306998
This length is 130.

CPubKey vchPubKey;
pwalletMain->GetPubKey(keyID, vchPubKey)
LogPrintf("addressbookpage vchPubKey=%s\n", HexStr(vchPubKey).c_str());
the result:
02edb297ba63c35998ec23cfca60666bb4d0d1c3e810b93d2d20c94e3a12977440
This length is 65.

secp256k1 tell me , PUBLIC_KEY_SIZE = 65
Why your public key size is 130 ? How to make it with Qt wallet code ?

TypeError: Can't convert 'bytes' object to str implicitly

I installed this on in the latest python for windows. I installed the coinkit and characters modules. I then attempted to utilize the simple walkthroughs in the readme and they throw an error on almost every method. Here is an example of the type of errors I am getting:

>>> from coinkit import NamecoinKeypair
>>> keypair = NamecoinKeypair()
>>> keypair.private_key()
b'0f1a40850d0e53164314111b24161d2dc4a90d843fcaa85944af54d64162b2ca'
>>> keypair.publickey()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'NamecoinKeypair' object has no attribute 'publickey'
>>> keypair.public_key()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\yousir\Desktop\coinkit-master\coinkit\keypair.py", line 102, in
 public_key
    return binascii.hexlify(self._bin_public_key())
  File "C:\Users\yousir\Desktop\coinkit-master\coinkit\keypair.py", line 82, in
_bin_public_key
    return '\x04' + self._ecdsa_public_key.to_string()
TypeError: Can't convert 'bytes' object to str implicitly

Can't make private key with integer input

This does not work:

i = int('0140faf3bac00007fb24bfb2c9cd55dd15de5b892c06317c6cacedbd6a25f802', 16)
key = BitcoinPrivateKey(private_key=i)

The is_int function from utilitybelt only checks for isinstance(value, int) it should instead check for isinstance(value, (int, long))

"services" not found

>>> from pybitcoin import BitcoinPrivateKey
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/alex/.local/lib/python3.6/site-packages/pybitcoin/__init__.py", line 10, in <module>
    import services
ModuleNotFoundError: No module named 'services'
>>> from pybitcoin import BitcoinPrivateKey
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/alex/.local/lib/python3.6/site-packages/pybitcoin/__init__.py", line 10, in <module>
    import services
ModuleNotFoundError: No module named 'services'

serialize_sign_and_broadcast only signs the first input

in serialize_sign_and_broadcast() in transactions/network.py, sign_transaction() is only called on the first input (index 0):

def serialize_sign_and_broadcast(inputs, outputs, private_key,
                                 blockchain_client=BlockchainInfoClient()):
    # extract the private key object
    private_key_obj = get_private_key_obj(private_key)
    # serialize the transaction
    unsigned_tx = serialize_transaction(inputs, outputs)
    # sign the unsigned transaction with the private key
    signed_tx = sign_transaction(unsigned_tx, 0, private_key_obj.to_hex())
    # dispatch the signed transction to the network
    response = broadcast_transaction(signed_tx, blockchain_client)
    # return the response
    return response

therefore transactions that require multiple inputs become invalid

Import errors

Encountered the pubkey bug and had to upgrade, got a couple of import errors.

In keypair.py: from .hash160 import bin_hash160

In network.py: from ..services import blockchain_info, blockcypher_com, chain_com

No module named characters.charset

When I import a coinkit lib, i have found this issue ...
(from pip install coinkit in debian 7)

Traceback (most recent call last):
File "bbb.py", line 8, in
from lib.wallet import Wallet
File "/home/mat/_/_/***.py", line 1, in
from coinkit import BitcoinKeypair
File "/usr/local/lib/python2.7/dist-packages/coinkit/init.py", line 12, in
from .b58check import b58check_encode, b58check_decode, b58check_unpack,
File "/usr/local/lib/python2.7/dist-packages/coinkit/b58check.py", line 14, in
from characters.charset import change_charset
ImportError: No module named characters.charset

What else ? :)

No free outputs to spend

Hi,

I am using BitcoinKeypair to generated address for new users in my bitcoin exchange ( https://github.com/pinhopro/bitex )

but when I try to get information from the new address created I get this message from blockchain:

"No free outputs to spend"

here my code:

$ cat test.py
from coinkit.keypair import BitcoinKeypair

keypair = BitcoinKeypair()

print keypair.address()

$ python2.7 test.py
1Dw8sfTPJRf389sfD4ejqs5uQVCNWJU7aw

$ curl http://blockchain.info/unspent?address=1Dw8sfTPJRf389sfD4ejqs5uQVCNWJU7aw

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.