Coder Social home page Coder Social logo

blocksmith's Introduction

blocksmith

The goal of this library is to generate private keys and create Bitcoin and Ethereum wallet addresses from them.

pip install blocksmith

Usage

Generate a private key

import blocksmith

kg = blocksmith.KeyGenerator()
kg.seed_input('Truly random string. I rolled a dice and got 4.')
key = kg.generate_key()
print(key)
# 7077da4a47f6c85a21fe6c6cf1285c0fa06915871744ab1e5a5b741027884d00

Create Bitcoin wallet from a private key

import blocksmith

key = '7077da4a47f6c85a21fe6c6cf1285c0fa06915871744ab1e5a5b741027884d00'

address = blocksmith.BitcoinWallet.generate_address(key)
print(address)
# 1JUP2bjfVexDif2m5fgyjHFrV9FE494REN

Create Ethereum wallet from a private key

import blocksmith

key = '7077da4a47f6c85a21fe6c6cf1285c0fa06915871744ab1e5a5b741027884d00'

address = blocksmith.EthereumWallet.generate_address(key)
print(address)
# 0x1269645a46a3e86c1a3c3de8447092d90f6f04ed

checksum_address = blocksmith.EthereumWallet.checksum_address(address)
print(checksum_address)
# 0x1269645a46A3e86c1a3C3De8447092D90f6F04ED

blocksmith's People

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

blocksmith's Issues

No module named secrets

Hello, this code looks interesting and potentially useful, however upon installing in python 2.7 on linux -- Ubuntu 18.1 there's the error No module names secrets. There an issue in line 1 of init.py - from.generator import KeyGenerator and line 3 of generator.py for import secrets.

Note that there were no errors during installation. It's just the above issues after trying to 'import blocksmith'.

write me i need your help

write to me in the mail please, there are several private keys, about 100 pieces. How do I get addresses from them?
using your program

ModuleNotFoundError: No module named 'Crypto'

import blocksmith
Traceback (most recent call last):
File "", line 1, in
File "C:\Python\Python36\lib\site-packages\blocksmith_init_.py", line 3, in
from .ethereum import EthereumWallet
File "C:\Python\Python36\lib\site-packages\blocksmith\ethereum.py", line 3, in
from Crypto.Hash import keccak
ModuleNotFoundError: No module named 'Crypto'

SOLUTION (on windows)
changed in libraries folder name crypto to Crypto

Keccak implementations missing when installed from pip

I installed blocksmith using pip. The following issue arises on trying to import blocksmith in the python3 console using Spyder.

line 3 - ethereum.py

from Crypto.Hash import keccak

ImportError: cannot import name 'keccak'

mismatch

hi
when i import private key to blockchain i receive different wallet address which i make by code why?
for example
private key is 5b9fa534aee8f01b8df4242bfd157e920e2b0e7cbd79afa541446aa426223b68
made by code
wallet is 1PsUFe4kVUJixGEmA69fpWpBKdh2SZdwcY
made by code

but after import to blockchain wallet address is
17BB2XwbhjUc8SYMSvvEkf2UWzpZuZFYvM

Bitcoin pri key to address problem?

i dont think bitcoin prikey to address dont true work

Because

i import in blockchain wallet private key
i see another address

But this code generate another addresd

How to generate the private keys that begin with "L" or "K"

https://bitkeys.work/?page=0
I wanted to generate the private keys like above which begin with "L" or "K"
Then my code is like this:

`kg = blocksmith.KeyGenerator()

kg.seed_input('35hK24tcLEWcgNA4JxpvbkNkoAcDGqQPsP') // the parameter is a bitcoin address

key = kg.generate_key()

print("key is: ", key)`

The output is:
key is: 0787aa5c4ab37dea0e87073cbc901d8b27d2e861f833673157878c019484e3bd
It doesn't begin with "L" or "K", can you help please? thanks a lot

'randbits'

AttributeError: 'module' object has no attribute 'randbits'

kg = blocksmith.KeyGenerator()                                File "/usr/local/lib/python2.7/dist-packages/blocksmith/generator.py", line 13, in __init__
self.__init_pool()

File "/usr/local/lib/python2.7/dist-packages/blocksmith/generator.py", line 33, in __init_pool
random_byte = secrets.randbits(8)
AttributeError: 'module' object has no attribute 'randbits'

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.