Skip to main content

Bitcoin Address

v.0.1.4

Bitcoin Wallet Address Generator

This is a simple Bitcoin non-deterministic wallet address generator coded in Python 3. It generates a Private Key in different formats (hex, wif and compressed wif) and corresponding Public Addresses, raw, P2WPKH addresses starting with prefix 1, P2SH addresses starting with prefix 3 as part of Segwit soft fork and Bech32 addresses with prefix bc1 P2WPKH and P2WSH.

Installation

pip install bitcoinaddress

Usage

Example 1 - Mainnet
from bitcoinaddress import Wallet

wallet = Wallet()
print(wallet)
Output:
Private Key HEX: 03902e4f09664bc177fe4e090dcd9906b432b50f15fb6151984475c1c75c35b6
Private Key WIF: 5HqrbgkWPqBy6dvCE7FoUiMuiCfFPRdtRsyi6NuCM2np8qBZxq5
Private Key WIF compressed: KwLdv6T2jmhQbswnYrcL9KZHerTpVyjozp1JNjfP5QuD3GchCwCc 

Public Key: 04c5389a31ce6149c28ba20d14db8540b2319e5a65000a2919fbf7a6296e7840b53f883a9483fb7f2b43f3eacd857c904d1b70ecc168571b64d8f1ab82b57eea88 
Public Key compressed: 02c5389a31ce6149c28ba20d14db8540b2319e5a65000a2919fbf7a6296e7840b5

Public Address 1: 1Bu6YxH64nfvhdDsYNEP8PftoBMqgusdPS   
Public Address 1 compressed: 18i5PtPisxbGiGGEviW7HPcnfNPmcsscwH   
Public Address 3: 38dRrGx5YbrnRWuWcJv5i2XHjYUnHE2wvv  
Public Address bc1 P2WPKH: bc1qdveuf0egtfdnd2fnsp0lzfukn2e58czf8323ky6xt8ydew4ecfcqv3ettx    
Public Address bc1 P2WSH: bc1q2jxe5azr6zmhk3258av7ul6cqtu4eu4mps8f4p  
Example 2 - Testnet
from bitcoinaddress import Wallet

wallet = Wallet(testnet=True)
print(wallet)
Output:
Private Key HEX: 064f8f0bebfa2f65db003b56bc911535614f2764799bc89091398c1aed82e884
Private Key WIF: 91dhN38UTmqGtd3zG1GnDdnyivAP5LnWJQyyj7V7pqthirHAj4X
Private Key WIF compressed: cMny9rPzDAt58r8BjECeamPwN1eQSAKrKrrVNsd78AoCjcWxuVym 

Public Key: 04f7a01e30388dea9673db8cdb48b985441db785382efbcecc05abac079a6304818a907f886b0d0518e345a0288a6f1e09072f2b11d4ccb75bc67ec6c71dfef800 
Public Key compressed: 02f7a01e30388dea9673db8cdb48b985441db785382efbcecc05abac079a630481

Public Address 1: mwdHSyBBHMbcy8rogvzssvDrGyffRo3amQ   
Public Address 1 compressed: n4VzeGfAyZGR7xCXiKmABvnKXojTFJrmKH   
Public Address 3: 2MtJ3jPSD2AYgbF25fq9cm1aUCPhSmWUMcJ  
Public Address bc1 P2WPKH: tb1qp53qkcsth8ffuvr00cnlg5hde03aszzeq7y0layklhd4nwkxzejs99tlh3    
Public Address bc1 P2WSH: tb1qlsw8qqe2aa2avzn9t9nsfjy8kwwgarwcfvfqlh
Example 3 - Import Private Key
from bitcoinaddress import Wallet

wallet = Wallet('5HqrbgkWPqBy6dvCE7FoUiMuiCfFPRdtRsyi6NuCM2np8qBZxq5')
print(wallet)
Output:
Private Key HEX: 03902e4f09664bc177fe4e090dcd9906b432b50f15fb6151984475c1c75c35b6
Private Key WIF: 5HqrbgkWPqBy6dvCE7FoUiMuiCfFPRdtRsyi6NuCM2np8qBZxq5
Private Key WIF compressed: KwLdv6T2jmhQbswnYrcL9KZHerTpVyjozp1JNjfP5QuD3GchCwCc 

Public Key: 04c5389a31ce6149c28ba20d14db8540b2319e5a65000a2919fbf7a6296e7840b53f883a9483fb7f2b43f3eacd857c904d1b70ecc168571b64d8f1ab82b57eea88 
Public Key compressed: 02c5389a31ce6149c28ba20d14db8540b2319e5a65000a2919fbf7a6296e7840b5

Public Address 1: 1Bu6YxH64nfvhdDsYNEP8PftoBMqgusdPS   
Public Address 1 compressed: 18i5PtPisxbGiGGEviW7HPcnfNPmcsscwH   
Public Address 3: 38dRrGx5YbrnRWuWcJv5i2XHjYUnHE2wvv  
Public Address bc1 P2WPKH: bc1qdveuf0egtfdnd2fnsp0lzfukn2e58czf8323ky6xt8ydew4ecfcqv3ettx    
Public Address bc1 P2WSH: bc1q2jxe5azr6zmhk3258av7ul6cqtu4eu4mps8f4p
Example 4 - Check attributes
from bitcoinaddress import Wallet

wallet = Wallet()
print(wallet.key.__dict__)
print(wallet.key.__dict__['mainnet'].__dict__)
print(wallet.key.__dict__['testnet'].__dict__)
print(wallet.address.__dict__)
print(wallet.address.__dict__['mainnet'].__dict__)
print(wallet.address.__dict__['testnet'].__dict__)

License and other

This software is distributed under the terms of the MIT License. See the file 'LICENSE' in the root directory of the present distribution, or http://opensource.org/licenses/MIT.

Bech32 address scripts source from https://github.com/sipa/bech32/tree/master/ref/python

Metadata

Release files for bitcoinaddress 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bitcoinaddress 0.1.4
File Size Uploaded Provenance Actions
bitcoinaddress-0.1.4.tar.gz 9.1 kB Without provenance Details for bitcoinaddress-0.1.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for bitcoinaddress 0.1.4
File Interpreter ABI Platform Actions
bitcoinaddress-0.1.4-py3-none-any.whl Python 3 none any Details for bitcoinaddress-0.1.4-py3-none-any.whl

Total release size: 18.9 kB

Release files / bitcoinaddress-0.1.4.tar.gz

Download URL bitcoinaddress-0.1.4.tar.gz
Size 9.1 kB
Tags Source
SHA-256 checksum
How to use checksums
ea06077f9993f934261f637eba1b265ff862f13f484604c6e91304ed492bb1f3
BLAKE2b-256 checksum
How to use checksums
899f7abf182e147a0eb817fe3cfdbe54a9789d41bcacb60684f827b13a8e52d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.9.1

Release files / bitcoinaddress-0.1.4-py3-none-any.whl

Download URL bitcoinaddress-0.1.4-py3-none-any.whl
Size 9.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
753c217d12fe189deb7ed818403ce901536cc9cea928d6f18a4010bc28a7165b
BLAKE2b-256 checksum
How to use checksums
fc42565f1d835faa3bfa2c1b16ee77e0b0fc21044f29c47727609b33d31cc649
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.1.3 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.9.1

Security for bitcoinaddress 0.1.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page