GithubHelp home page GithubHelp logo

vkobel / ethereum-generate-wallet Goto Github PK

View Code? Open in Web Editor NEW
265.0 15.0 117.0 757 KB

Scripts collection to generate ECDSA keypairs and derive their Ethereum address

Home Page: https://kobl.one/blog/create-full-ethereum-keypair-and-address/

License: MIT License

Python 31.75% Shell 68.25%
ethereum ecdsa-key-pair blockchain-wallet ethereum-address python bash

ethereum-generate-wallet's Introduction

Ethereum wallet generator

Simple script collection, currently in bash and python format, to generate a complete offline Ethereum wallet by creating an ECDSA keypair and derive its Ethereum address.

You can read my article about it here: https://kobl.one/blog/create-full-ethereum-keypair-and-address/

IMPORTANT The python version of this script has been updated to support mixed-case checksum address encoding through EIP55.

Python dependencies

You can also use the included requirements.txt file to install them

pip install -r requirements.txt

Bash dependencies

Compiled, statically linked versions of the keccak-256sum executable are available in the lib folder of this repo for i386 and x86_64.

Importing private key to geth

You can use the generated private key to import in to geth (https://github.com/ethereum/go-ethereum).

# First save the private hexadecimal key to a file
echo eff415edb6331f4f67bdb7f1ecc639da9bcc0550b100bb275c7b5b21ce3a7804 > key
# Then use account import feature of geth (here importing in the 'testnet' directory)
./go-ethereum/build/bin/geth --datadir ~/.ethereum/testnet account import key

Note that geth will ask you immediately to choose a passphrase to protect the newly imported key.

Example

./ethereum-wallet-generator.py
Private key: 981679905857953c9a21e1807aab1b897a395ea0c5c96b32794ccb999a3cd781
Public key:  7454f003941bba7c5e16d8c9fce19104b2f51486e00d47f39e6eb0aea6f1c6f80cad2d239c8b4b1bf903e41960920f735fda4fcc4422aa815416b7d0df62f8a5 
Address:     0x5fe3062B24033113fbf52b2b75882890D7d8CA54
./ethereum-wallet-generator.sh
Private key: 9442b4b82c8011530f3a363cc87a4ea91efd53552faab2e63fd352db9367bb24
Public key:  3f538de115393e2a8851b4c19f686b6bb245213c3823e69336583f1d72c53d20831ea0574900b31d833932b3e8e71b4e99d574c6480890d60153fc2dccbc96d6
Address:     0x083c41ea13af6c2d5aaddf6e73142eb9a7b00183

ethereum-generate-wallet's People

Contributors

reiven avatar vkobel 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

ethereum-generate-wallet's Issues

some private key is not 64 characters but 62

I had generate 1000,000 eth pairs use this programming.
but there are 3842 private keys is not 64 characters but 62.
eg:

0x19964796cab7941894e3409ced0074e5b6d107a2 | a7b7b90430f5446cafbb0ae097309f4ef0f0873cce6082f85fc45801dd9dc1

0xd922d726ea723906533d6fd3a7bd765e5c7a7f11 | faa75fc866bd681411fea4a196ea338cd3d87e63e422cad3fb7a3ed5d5988a

0x17c95e15b5e48ebcff2c746f690711725296aaa8 | c5596380030a9633308183b4ffa6aade654bbbba60d0d2b35462d62fdccee3

REST API : Return Address and Private Key

Thanks for the reference. I am trying to generate the address and the private key through a REST API Call using your code. But the address is showing the same as the input. can you please review my code. is that correct?

from ecdsa import SigningKey, SECP256k1
import sha3

PRIVATE_KEY = 'private_key'
PUBLIC_KEY = 'public_key'
ADDRESS = 'address'

def generate_user_burn_address(request_args):
    addr_str = request_args['addr_str'];
    keccak = sha3.keccak_256()
    out = ''
    addr = addr_str.lower().replace('0x', '')
    keccak.update(addr.encode('ascii'))
    hash_addr = keccak.hexdigest()
    for i, c in enumerate(addr):
        if int(hash_addr[i], 16) >= 8:
            out += c.upper()
        else:
            out += c
    address = '0x' + out
    priv = SigningKey.generate(curve=SECP256k1)
    pub = priv.get_verifying_key().to_string()
    private_key = priv.to_string().hex()
    public_key = pub.hex()
    return {PRIVATE_KEY: private_key, ADDRESS: address}

Thanks,
Raja K

hex() cannot be used on an string variable

Whenever I run this, I get an error while printing the keys
"AttributeError: 'str' object has no attribute 'hex'"

I was able to fix this by changing
"to_string().hex()" to "to_string().encode('hex')

wonder if there is anything that I missed, or is this just something that needs to be fixed.
python 2.7.12 if it matters

Dependencies

Hi!

I'm trying to use your python script, but the sha3 module looks like do not have the keccak_256() module. I've created a new python3 virtualenv, installed sha3 and ecdsa (maybe it will be a good idea to include a requirements.txt in your repo, i can to that if its for you) with the following version:

ecdsa==0.13
sha3==0.2.1

How can i make the script work?

Thanks

EIP55 support

It seems that some wallet addresses generated by this tool do not support EIP55. It may cause unnecessary troubles while developers are transferring ethers to the new wallet address in Geth. I suggest add EIP55 support in this tool.

some private key is not 64 characters but 62

I had generate 1000,000 eth pairs use this programming.
but there are 3842 private keys is not 64 characters but 62.
eg:

0x19964796cab7941894e3409ced0074e5b6d107a2 | a7b7b90430f5446cafbb0ae097309f4ef0f0873cce6082f85fc45801dd9dc1

0xd922d726ea723906533d6fd3a7bd765e5c7a7f11 | faa75fc866bd681411fea4a196ea338cd3d87e63e422cad3fb7a3ed5d5988a

0x17c95e15b5e48ebcff2c746f690711725296aaa8 | c5596380030a9633308183b4ffa6aade654bbbba60d0d2b35462d62fdccee3

Python error: no attribute 'keccak_256'

I run this:

pip install -r requirements.txt

And I get this:

Requirement already satisfied: ecdsa in /usr/local/lib/python2.7/dist-packages (from -r requirements.txt (line 1))
Requirement already satisfied: pysha3 in /usr/local/lib/python2.7/dist-packages (from -r requirements.txt (line 2))

But I get an error when I run it:

./ethereum-wallet-generator.py

Traceback (most recent call last):
File "./ethereum-wallet-generator.py", line 9, in
keccak = sha3.keccak_256()
AttributeError: 'module' object has no attribute 'keccak_256'

Missing keccak-256sum

Hey,

I'm getting this error:

./ethereum-wallet-generator.sh: 12: ./ethereum-wallet-generator.sh: keccak-256sum: not found

But I've already done pip install requirements.txt

newest debian x64 running

Missing LICENSE.md

I am currently using your bash script and am looking to include it in a larger project that is AGPL. In order to do that I need to know what license this code is under. Would you be willing to add a license for this repo?

https://choosealicense.com/

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.