Package: bip-utils
BIP Utility LibraryIntroductionThis package allows generating mnemonics, seeds, private/public keys and addresses for different types of cryptocurrencies. In particular:Mnemonic and seed generation as defined byBIP-0039Private key encryption/decryption as defined byBIP-0038Keys derivation as defined by:BIP-0032SLIP-0010BIP32-Ed25519 (Khovratovich/Law)Derivation of a hierarchy of keys as defined by:BIP-0044BIP-0049(Bitcoin Segwit)BIP-0084(Bitcoin Native Segwit)BIP-0086(Bitcoin Taproot)CIP-1852Mnemonic and seed generation forSubstrate(Polkadot/Kusama ecosystem)Keys derivation forSubstrate(Polkadot/Kusama ecosystem, same of Polkadot-JS)Keys and addresses generation for Cardano (Byron-Legacy, Byron-Icarus and Shelley, same of Ledger and AdaLite/Yoroi wallets)Mnemonic and seed generation for MoneroKeys and addresses/subaddresses generation for Monero (same of official Monero wallet)Mnemonic and seed generation for Algorand (Algorand 25-word mnemonic)Mnemonic and seed generation like Electrum wallet (v1 and v2)Keys derivation like Electrum wallet (v1 and v2)Generation of keys from a passphrase chosen by the user ("brainwallet")Other implemented functionalities:Parse BIP-0032 derivation pathsParse Substrate derivation pathsExtended key serialization as defined bySLIP-0032Encode/Decode addresses for all the supported coinsEncode/DecodeWIFEncode/Decodebase58andbase58 moneroEncode/Decodess58Encode/Decodebech32andbech32mEncode/DecodeBitcoin Cash bech32Get token account addresses for SPL tokens (i.e. Solana tokens)Package dependencies:cbor2for CBOR encoding/decodingcrcmodfor CRC computationpycryptodomefor cryptographic functionscoincurvefor secp256k1 curveecdsafor nist256p1 and secp256k1 curvesed25519-blake2bfor ed25519-blake2b curvepynaclfor ed25519 curvepy-sr25519-bindingsfor sr25519 curvePlease note that, for the py-sr25519-bindings library, Rust is required to be installed.Supported coinsSupported BIP coins:Akash NetworkAlgorandAptosArbitrumAvalanche (all the 3 chains)AxelarBand ProtocolBinance ChainBinance Smart ChainBitcoin (and related test net)Bitcoin Cash (and related test net)Bitcoin Cash Simple Ledger Protocol (and related test net)BitcoinSV (and related test net)Cardano (Byron-Legacy, Byron-Icarus and Shelley)CeloCertikCosmosDash (and related test net)Dogecoin (and related test net)eCash (and related test net)Elrond (MultiversX)EOSErgo (and related test net)EthereumEthereum ClassicFantom OperaFilecoinFetch.aiHarmony One (Ethereum and Cosmos addresses)Huobi Heco ChainIRIS NetworkKavaKusama (based on BIP44 and ed25519 SLIP-0010, like TrustWallet, it won't generate the same addresses of Polkadot-JS)Litecoin (and related test net)MetisMonero (based on BIP44 and secp256k1 or ed25519 SLIP-0010, it won't generate the same addresses of the official wallets, but it supports subaddresses generation)NanoNear ProtocolNEOOKEx Chain (Ethereum and Cosmos addresses)OntologyOptimismOsmosisPi NetworkPolkadot (based on BIP44 and ed25519 SLIP-0010, like TrustWallet, it won't generate the same addresses of Polkadot-JS)PolygonRippleSecret NetworkSolanaStafi (Cosmos)StellarSui (only ed25519)TerraTezosTheta NetworkTronVeChainVergeZcash (and related test net)ZilliqaSupported Substrate coins:AcalaBifrostChainxEdgewareKaruraKusamaMoonbeamMoonriverPhala NetworkPlasm NetworkSoraStafiPolkadotGeneric Substrate coinFor what regards Monero, it's also possible to generate the same addresses of the official wallets without using BIP44 derivation.Clearly, for those coins that support Smart Contracts (e.g. Ethereum, Tron, ...), the generated keys and addresses are valid for all the related tokens.Install the packageFor the secp256k1 curve, it's possible to use either thecoincurveor theecdsalibrary.coincurveis much faster since it's a Python wrapper to the secp256k1 C library, whileecdsais a pure Python implementation.By defaultcoincurvewill be used, but it's possible to disable it when installing.To install the package:Default installation (coincurvewill be used for secp256k1)Usingpip, from this directory (local):pip install .Usingpip, from PyPI:pip install bip_utilsAlternative installation (ecdsawill be used for secp256k1)Usingsetuptools:python setup.py install --coincurve=0Usingpip, from this directory (local):pip install . --install-option="--coincurve=0"Usingpip, from PyPI:pip install bip_utils --install-option="--coincurve=0"NOTES:if you are using an Apple M1, please make sure to updatecoincurveto version 17.0.0in case of problems when building theed25519_blake2blibrary, you can try one of the prebuilt wheelshereTest and CoverageInstall develop dependencies:pip install -r requirements-dev.txtTo run tests:python -m unittest discoverTo run tests with coverage:coverage run -m unittest discover
coverage reportTo run code analysis, just execute theanalyze_codescript.Modules descriptionBIP-0039Algorand mnemonicElectrum mnemonicMonero mnemonicBIP-0038BIP-0032BIP-0044BrainwalletCardanoElectrumMoneroSubstrateUtility librariesDocumentationThe library documentation is available atbip-utils.readthedocs.io.Code examplesFor some complete code examples (from mnemonic to keys generation), refer to theexamplesfolder.Buy me a coffeeYou know, I'm italian and I love drinking coffee (especially while coding 😃). So, if you'd like to buy me one:BTC:bc1qq4r9cglwzd6f2hzxvdkucmdejvr9h8me5hy0k8ERC20/BEP20:0xf84e4898E5E10bf1fBe9ffA3EEC845e82e364b5BThank you very much for your support.LicenseThis software is available under the MIT license.