From f88d78c82c1465351beb79e049c2a311668a1541 Mon Sep 17 00:00:00 2001 From: Bobby Newport Date: Wed, 25 Feb 2026 15:31:58 +1100 Subject: [PATCH 01/66] add ton class, ton mnemonic and ton address classes --- bip_utils/__init__.py | 381 ++++-------------- bip_utils/addr/__init__.py | 61 +-- bip_utils/addr/ton_addr.py | 78 ++++ bip_utils/bip/conf/bip44/bip44_coins.py | 1 + bip_utils/bip/conf/bip44/bip44_conf.py | 73 +--- bip_utils/coin_conf/coins_conf.py | 9 + bip_utils/slip/slip44/slip44.py | 1 + bip_utils/ton/__init__.py | 1 + bip_utils/ton/address/__init__.py | 1 + bip_utils/ton/address/ton_address_encoder.py | 166 ++++++++ bip_utils/ton/mnemonic/__init__.py | 4 + bip_utils/ton/mnemonic/ton_mnemonic.py | 57 +++ .../ton/mnemonic/ton_mnemonic_generator.py | 93 +++++ .../ton/mnemonic/ton_mnemonic_validator.py | 65 +++ bip_utils/ton/mnemonic/ton_seed_generator.py | 70 ++++ bip_utils/ton/ton.py | 84 ++++ requirements.txt | 1 + 17 files changed, 737 insertions(+), 409 deletions(-) create mode 100644 bip_utils/addr/ton_addr.py create mode 100644 bip_utils/ton/__init__.py create mode 100644 bip_utils/ton/address/__init__.py create mode 100644 bip_utils/ton/address/ton_address_encoder.py create mode 100644 bip_utils/ton/mnemonic/__init__.py create mode 100644 bip_utils/ton/mnemonic/ton_mnemonic.py create mode 100644 bip_utils/ton/mnemonic/ton_mnemonic_generator.py create mode 100644 bip_utils/ton/mnemonic/ton_mnemonic_validator.py create mode 100644 bip_utils/ton/mnemonic/ton_seed_generator.py create mode 100644 bip_utils/ton/ton.py diff --git a/bip_utils/__init__.py b/bip_utils/__init__.py index db3e642e..38c5b8ef 100644 --- a/bip_utils/__init__.py +++ b/bip_utils/__init__.py @@ -3,208 +3,55 @@ # Address decoding/encoding from bip_utils.addr import ( - AdaByronAddrDecoder, - AdaByronAddrTypes, - AdaByronIcarusAddr, - AdaByronIcarusAddrEncoder, - AdaByronLegacyAddr, - AdaByronLegacyAddrEncoder, - AdaShelleyAddr, - AdaShelleyAddrDecoder, - AdaShelleyAddrEncoder, - AdaShelleyAddrNetworkTags, - AdaShelleyRewardAddr, - AdaShelleyRewardAddrDecoder, - AdaShelleyRewardAddrEncoder, - AdaShelleyStakingAddr, - AdaShelleyStakingAddrDecoder, - AdaShelleyStakingAddrEncoder, - AlgoAddr, - AlgoAddrDecoder, - AlgoAddrEncoder, - AptosAddr, - AptosAddrDecoder, - AptosAddrEncoder, - AtomAddr, - AtomAddrDecoder, - AtomAddrEncoder, - AvaxPChainAddr, - AvaxPChainAddrDecoder, - AvaxPChainAddrEncoder, - AvaxXChainAddr, - AvaxXChainAddrDecoder, - AvaxXChainAddrEncoder, - BchAddrConverter, - BchP2PKHAddr, - BchP2PKHAddrDecoder, - BchP2PKHAddrEncoder, - BchP2SHAddr, - BchP2SHAddrDecoder, - BchP2SHAddrEncoder, - EgldAddr, - EgldAddrDecoder, - EgldAddrEncoder, - EosAddr, - EosAddrDecoder, - EosAddrEncoder, - ErgoNetworkTypes, - ErgoP2PKHAddr, - ErgoP2PKHAddrDecoder, - ErgoP2PKHAddrEncoder, - EthAddr, - EthAddrDecoder, - EthAddrEncoder, - FilSecp256k1Addr, - FilSecp256k1AddrDecoder, - FilSecp256k1AddrEncoder, - IcxAddr, - IcxAddrDecoder, - IcxAddrEncoder, - InjAddr, - InjAddrDecoder, - InjAddrEncoder, - MvrkAddr, - MvrkAddrDecoder, - MvrkAddrEncoder, - MvrkAddrPrefixes, - NanoAddr, - NanoAddrDecoder, - NanoAddrEncoder, - NearAddr, - NearAddrDecoder, - NearAddrEncoder, - NeoAddr, - NeoAddrDecoder, - NeoAddrEncoder, - NeoLegacyAddr, - NeoLegacyAddrDecoder, - NeoLegacyAddrEncoder, - NeoN3Addr, - NeoN3AddrDecoder, - NeoN3AddrEncoder, - NimAddr, - NimAddrDecoder, - NimAddrEncoder, - OkexAddr, - OkexAddrDecoder, - OkexAddrEncoder, - OneAddr, - OneAddrDecoder, - OneAddrEncoder, - P2PKHAddr, - P2PKHAddrDecoder, - P2PKHAddrEncoder, - P2PKHPubKeyModes, - P2SHAddr, - P2SHAddrDecoder, - P2SHAddrEncoder, - P2TRAddr, - P2TRAddrDecoder, - P2TRAddrEncoder, - P2WPKHAddr, - P2WPKHAddrDecoder, - P2WPKHAddrEncoder, - SolAddr, - SolAddrDecoder, - SolAddrEncoder, - SubstrateEd25519Addr, - SubstrateEd25519AddrDecoder, - SubstrateEd25519AddrEncoder, - SubstrateSr25519Addr, - SubstrateSr25519AddrDecoder, - SubstrateSr25519AddrEncoder, - SuiAddr, - SuiAddrDecoder, - SuiAddrEncoder, - TrxAddr, - TrxAddrDecoder, - TrxAddrEncoder, - XlmAddr, - XlmAddrDecoder, - XlmAddrEncoder, - XlmAddrTypes, - XmrAddr, - XmrAddrDecoder, - XmrAddrEncoder, - XmrIntegratedAddr, - XmrIntegratedAddrDecoder, - XmrIntegratedAddrEncoder, - XrpAddr, - XrpAddrDecoder, - XrpAddrEncoder, - XtzAddr, - XtzAddrDecoder, - XtzAddrEncoder, - XtzAddrPrefixes, - ZilAddr, - ZilAddrDecoder, - ZilAddrEncoder, + AdaByronAddrDecoder, AdaByronAddrTypes, AdaByronIcarusAddr, AdaByronIcarusAddrEncoder, AdaByronLegacyAddr, + AdaByronLegacyAddrEncoder, AdaShelleyAddr, AdaShelleyAddrDecoder, AdaShelleyAddrEncoder, AdaShelleyAddrNetworkTags, + AdaShelleyRewardAddr, AdaShelleyRewardAddrDecoder, AdaShelleyRewardAddrEncoder, AdaShelleyStakingAddr, + AdaShelleyStakingAddrDecoder, AdaShelleyStakingAddrEncoder, AlgoAddr, AlgoAddrDecoder, AlgoAddrEncoder, AptosAddr, + AptosAddrDecoder, AptosAddrEncoder, AtomAddr, AtomAddrDecoder, AtomAddrEncoder, AvaxPChainAddr, + AvaxPChainAddrDecoder, AvaxPChainAddrEncoder, AvaxXChainAddr, AvaxXChainAddrDecoder, AvaxXChainAddrEncoder, + BchAddrConverter, BchP2PKHAddr, BchP2PKHAddrDecoder, BchP2PKHAddrEncoder, BchP2SHAddr, BchP2SHAddrDecoder, + BchP2SHAddrEncoder, EgldAddr, EgldAddrDecoder, EgldAddrEncoder, EosAddr, EosAddrDecoder, EosAddrEncoder, + ErgoNetworkTypes, ErgoP2PKHAddr, ErgoP2PKHAddrDecoder, ErgoP2PKHAddrEncoder, EthAddr, EthAddrDecoder, + EthAddrEncoder, FilSecp256k1Addr, FilSecp256k1AddrDecoder, FilSecp256k1AddrEncoder, IcxAddr, IcxAddrDecoder, + IcxAddrEncoder, InjAddr, InjAddrDecoder, InjAddrEncoder, MvrkAddr, MvrkAddrDecoder, MvrkAddrEncoder, + MvrkAddrPrefixes, NanoAddr, NanoAddrDecoder, NanoAddrEncoder, NearAddr, NearAddrDecoder, NearAddrEncoder, NeoAddr, + NeoAddrDecoder, NeoAddrEncoder, NeoLegacyAddr, NeoLegacyAddrDecoder, NeoLegacyAddrEncoder, NeoN3Addr, + NeoN3AddrDecoder, NeoN3AddrEncoder, NimAddr, NimAddrDecoder, NimAddrEncoder, OkexAddr, OkexAddrDecoder, + OkexAddrEncoder, OneAddr, OneAddrDecoder, OneAddrEncoder, P2PKHAddr, P2PKHAddrDecoder, P2PKHAddrEncoder, + P2PKHPubKeyModes, P2SHAddr, P2SHAddrDecoder, P2SHAddrEncoder, P2TRAddr, P2TRAddrDecoder, P2TRAddrEncoder, + P2WPKHAddr, P2WPKHAddrDecoder, P2WPKHAddrEncoder, SolAddr, SolAddrDecoder, SolAddrEncoder, SubstrateEd25519Addr, + SubstrateEd25519AddrDecoder, SubstrateEd25519AddrEncoder, SubstrateSr25519Addr, SubstrateSr25519AddrDecoder, + SubstrateSr25519AddrEncoder, SuiAddr, SuiAddrDecoder, SuiAddrEncoder, TrxAddr, TrxAddrDecoder, TrxAddrEncoder, + XlmAddr, XlmAddrDecoder, XlmAddrEncoder, XlmAddrTypes, XmrAddr, XmrAddrDecoder, XmrAddrEncoder, XmrIntegratedAddr, + XmrIntegratedAddrDecoder, XmrIntegratedAddrEncoder, XrpAddr, XrpAddrDecoder, XrpAddrEncoder, XtzAddr, + XtzAddrDecoder, XtzAddrEncoder, XtzAddrPrefixes, ZilAddr, ZilAddrDecoder, ZilAddrEncoder ) # Algorand mnemonic from bip_utils.algorand.mnemonic import ( - AlgorandEntropyBitLen, - AlgorandEntropyGenerator, - AlgorandLanguages, - AlgorandMnemonic, - AlgorandMnemonicDecoder, - AlgorandMnemonicEncoder, - AlgorandMnemonicGenerator, - AlgorandMnemonicValidator, - AlgorandSeedGenerator, - AlgorandWordsNum, + AlgorandEntropyBitLen, AlgorandEntropyGenerator, AlgorandLanguages, AlgorandMnemonic, AlgorandMnemonicDecoder, + AlgorandMnemonicEncoder, AlgorandMnemonicGenerator, AlgorandMnemonicValidator, AlgorandSeedGenerator, + AlgorandWordsNum ) # Base58 from bip_utils.base58 import ( - Base58Alphabets, - Base58ChecksumError, - Base58Decoder, - Base58Encoder, - Base58XmrDecoder, - Base58XmrEncoder, + Base58Alphabets, Base58ChecksumError, Base58Decoder, Base58Encoder, Base58XmrDecoder, Base58XmrEncoder ) # Bech32 from bip_utils.bech32 import ( - BchBech32Decoder, - BchBech32Encoder, - Bech32ChecksumError, - Bech32Decoder, - Bech32Encoder, - SegwitBech32Decoder, - SegwitBech32Encoder, + BchBech32Decoder, BchBech32Encoder, Bech32ChecksumError, Bech32Decoder, Bech32Encoder, SegwitBech32Decoder, + SegwitBech32Encoder ) # BIP32 from bip_utils.bip.bip32 import ( - Bip32ChainCode, - Bip32Depth, - Bip32DeserializedKey, - Bip32Ed25519Blake2bSlip, - Bip32Ed25519Kholaw, - Bip32Ed25519Slip, - Bip32FingerPrint, - Bip32KeyData, - Bip32KeyDeserializer, - Bip32KeyError, - Bip32KeyIndex, - Bip32KeyNetVersions, - Bip32KholawEd25519, - Bip32Nist256p1, - Bip32Path, - Bip32PathError, - Bip32PathParser, - Bip32PrivateKey, - Bip32PrivateKeySerializer, - Bip32PublicKey, - Bip32PublicKeySerializer, - Bip32Secp256k1, - Bip32Slip10Ed25519, - Bip32Slip10Ed25519Blake2b, - Bip32Slip10Nist256p1, - Bip32Slip10Secp256k1, - Bip32Utils, + Bip32ChainCode, Bip32Depth, Bip32DeserializedKey, Bip32Ed25519Blake2bSlip, Bip32Ed25519Kholaw, Bip32Ed25519Slip, + Bip32FingerPrint, Bip32KeyData, Bip32KeyDeserializer, Bip32KeyError, Bip32KeyIndex, Bip32KeyNetVersions, + Bip32KholawEd25519, Bip32Nist256p1, Bip32Path, Bip32PathError, Bip32PathParser, Bip32PrivateKey, + Bip32PrivateKeySerializer, Bip32PublicKey, Bip32PublicKeySerializer, Bip32Secp256k1, Bip32Slip10Ed25519, + Bip32Slip10Ed25519Blake2b, Bip32Slip10Nist256p1, Bip32Slip10Secp256k1, Bip32Utils ) # BIP38 @@ -212,16 +59,8 @@ # BIP39 from bip_utils.bip.bip39 import ( - Bip39EntropyBitLen, - Bip39EntropyGenerator, - Bip39Languages, - Bip39Mnemonic, - Bip39MnemonicDecoder, - Bip39MnemonicEncoder, - Bip39MnemonicGenerator, - Bip39MnemonicValidator, - Bip39SeedGenerator, - Bip39WordsNum, + Bip39EntropyBitLen, Bip39EntropyGenerator, Bip39Languages, Bip39Mnemonic, Bip39MnemonicDecoder, + Bip39MnemonicEncoder, Bip39MnemonicGenerator, Bip39MnemonicValidator, Bip39SeedGenerator, Bip39WordsNum ) from bip_utils.bip.bip44 import Bip44 @@ -253,39 +92,12 @@ # ECC from bip_utils.ecc import ( - Ed25519, - Ed25519Blake2b, - Ed25519Blake2bPoint, - Ed25519Blake2bPrivateKey, - Ed25519Blake2bPublicKey, - Ed25519Kholaw, - Ed25519KholawPoint, - Ed25519KholawPrivateKey, - Ed25519KholawPublicKey, - Ed25519Monero, - Ed25519MoneroPoint, - Ed25519MoneroPrivateKey, - Ed25519MoneroPublicKey, - Ed25519Point, - Ed25519PrivateKey, - Ed25519PublicKey, - EllipticCurveGetter, - EllipticCurveTypes, - IPoint, - IPrivateKey, - IPublicKey, - Nist256p1, - Nist256p1Point, - Nist256p1PrivateKey, - Nist256p1PublicKey, - Secp256k1, - Secp256k1Point, - Secp256k1PrivateKey, - Secp256k1PublicKey, - Sr25519, - Sr25519Point, - Sr25519PrivateKey, - Sr25519PublicKey, + Ed25519, Ed25519Blake2b, Ed25519Blake2bPoint, Ed25519Blake2bPrivateKey, Ed25519Blake2bPublicKey, Ed25519Kholaw, + Ed25519KholawPoint, Ed25519KholawPrivateKey, Ed25519KholawPublicKey, Ed25519Monero, Ed25519MoneroPoint, + Ed25519MoneroPrivateKey, Ed25519MoneroPublicKey, Ed25519Point, Ed25519PrivateKey, Ed25519PublicKey, + EllipticCurveGetter, EllipticCurveTypes, IPoint, IPrivateKey, IPublicKey, Nist256p1, Nist256p1Point, + Nist256p1PrivateKey, Nist256p1PublicKey, Secp256k1, Secp256k1Point, Secp256k1PrivateKey, Secp256k1PublicKey, + Sr25519, Sr25519Point, Sr25519PrivateKey, Sr25519PublicKey ) # Electrum wallet @@ -293,29 +105,14 @@ # Electrum mnemonic from bip_utils.electrum.mnemonic_v1 import ( - ElectrumV1EntropyBitLen, - ElectrumV1EntropyGenerator, - ElectrumV1Languages, - ElectrumV1Mnemonic, - ElectrumV1MnemonicDecoder, - ElectrumV1MnemonicEncoder, - ElectrumV1MnemonicGenerator, - ElectrumV1MnemonicValidator, - ElectrumV1SeedGenerator, - ElectrumV1WordsNum, + ElectrumV1EntropyBitLen, ElectrumV1EntropyGenerator, ElectrumV1Languages, ElectrumV1Mnemonic, + ElectrumV1MnemonicDecoder, ElectrumV1MnemonicEncoder, ElectrumV1MnemonicGenerator, ElectrumV1MnemonicValidator, + ElectrumV1SeedGenerator, ElectrumV1WordsNum ) from bip_utils.electrum.mnemonic_v2 import ( - ElectrumV2EntropyBitLen, - ElectrumV2EntropyGenerator, - ElectrumV2Languages, - ElectrumV2Mnemonic, - ElectrumV2MnemonicDecoder, - ElectrumV2MnemonicEncoder, - ElectrumV2MnemonicGenerator, - ElectrumV2MnemonicTypes, - ElectrumV2MnemonicValidator, - ElectrumV2SeedGenerator, - ElectrumV2WordsNum, + ElectrumV2EntropyBitLen, ElectrumV2EntropyGenerator, ElectrumV2Languages, ElectrumV2Mnemonic, + ElectrumV2MnemonicDecoder, ElectrumV2MnemonicEncoder, ElectrumV2MnemonicGenerator, ElectrumV2MnemonicTypes, + ElectrumV2MnemonicValidator, ElectrumV2SeedGenerator, ElectrumV2WordsNum ) # Monero @@ -326,26 +123,14 @@ # Monero mnemonic from bip_utils.monero.mnemonic import ( - MoneroEntropyBitLen, - MoneroEntropyGenerator, - MoneroLanguages, - MoneroMnemonic, - MoneroMnemonicDecoder, - MoneroMnemonicEncoder, - MoneroMnemonicGenerator, - MoneroMnemonicNoChecksumEncoder, - MoneroMnemonicValidator, - MoneroMnemonicWithChecksumEncoder, - MoneroSeedGenerator, - MoneroWordsNum, + MoneroEntropyBitLen, MoneroEntropyGenerator, MoneroLanguages, MoneroMnemonic, MoneroMnemonicDecoder, + MoneroMnemonicEncoder, MoneroMnemonicGenerator, MoneroMnemonicNoChecksumEncoder, MoneroMnemonicValidator, + MoneroMnemonicWithChecksumEncoder, MoneroSeedGenerator, MoneroWordsNum ) # SLIP32 from bip_utils.slip.slip32 import ( - Slip32DeserializedKey, - Slip32KeyDeserializer, - Slip32PrivateKeySerializer, - Slip32PublicKeySerializer, + Slip32DeserializedKey, Slip32KeyDeserializer, Slip32PrivateKeySerializer, Slip32PublicKeySerializer ) # Solana @@ -356,14 +141,8 @@ # Substrate from bip_utils.substrate import ( - Substrate, - SubstrateKeyError, - SubstratePath, - SubstratePathElem, - SubstratePathError, - SubstratePathParser, - SubstratePrivateKey, - SubstratePublicKey, + Substrate, SubstrateKeyError, SubstratePath, SubstratePathElem, SubstratePathError, SubstratePathParser, + SubstratePrivateKey, SubstratePublicKey ) # Substrate configuration @@ -374,51 +153,31 @@ # Substrate SCALE from bip_utils.substrate.scale import ( - SubstrateScaleBytesEncoder, - SubstrateScaleCUintEncoder, - SubstrateScaleU8Encoder, - SubstrateScaleU16Encoder, - SubstrateScaleU32Encoder, - SubstrateScaleU64Encoder, - SubstrateScaleU128Encoder, - SubstrateScaleU256Encoder, + SubstrateScaleBytesEncoder, SubstrateScaleCUintEncoder, SubstrateScaleU8Encoder, SubstrateScaleU16Encoder, + SubstrateScaleU32Encoder, SubstrateScaleU64Encoder, SubstrateScaleU128Encoder, SubstrateScaleU256Encoder ) # Utils from bip_utils.utils.crypto import ( - AesEcbDecrypter, - AesEcbEncrypter, - Blake2b, - Blake2b160, - Blake2b224, - Blake2b256, - ChaCha20Poly1305, - Crc32, - DoubleSha256, - Hash160, - HmacSha256, - HmacSha512, - Kekkak256, - Pbkdf2HmacSha512, - Ripemd160, - Scrypt, - Sha3_256, - Sha256, - Sha512, - Sha512_256, - XModemCrc, + AesEcbDecrypter, AesEcbEncrypter, Blake2b, Blake2b160, Blake2b224, Blake2b256, ChaCha20Poly1305, Crc32, + DoubleSha256, Hash160, HmacSha256, HmacSha512, Kekkak256, Pbkdf2HmacSha512, Ripemd160, Scrypt, Sha3_256, Sha256, + Sha512, Sha512_256, XModemCrc ) from bip_utils.utils.misc import ( - AlgoUtils, - Base32Decoder, - Base32Encoder, - BitUtils, - BytesUtils, - DataBytes, - IntegerUtils, - StringUtils, + AlgoUtils, Base32Decoder, Base32Encoder, BitUtils, BytesUtils, DataBytes, IntegerUtils, StringUtils ) from bip_utils.utils.mnemonic import MnemonicChecksumError # WIF from bip_utils.wif import WifDecoder, WifEncoder, WifPubKeyModes + +# TON + +from bip_utils.ton.mnemonic import ( + TonMnemonic, TonLanguages, TonSeedGenerator, TonMnemonicValidator, TonMnemonicGenerator +) +from bip_utils.ton.address.ton_address_encoder import TonAddressEncoder +from bip_utils.ton.ton import Ton + + + \ No newline at end of file diff --git a/bip_utils/addr/__init__.py b/bip_utils/addr/__init__.py index 39f67a6f..21ab7298 100644 --- a/bip_utils/addr/__init__.py +++ b/bip_utils/addr/__init__.py @@ -1,33 +1,18 @@ from bip_utils.addr.ada_byron_addr import ( - AdaByronAddrDecoder, - AdaByronAddrTypes, - AdaByronIcarusAddr, - AdaByronIcarusAddrEncoder, - AdaByronLegacyAddr, - AdaByronLegacyAddrEncoder, + AdaByronAddrDecoder, AdaByronAddrTypes, AdaByronIcarusAddr, AdaByronIcarusAddrEncoder, AdaByronLegacyAddr, + AdaByronLegacyAddrEncoder ) from bip_utils.addr.ada_shelley_addr import ( - AdaShelleyAddr, - AdaShelleyAddrDecoder, - AdaShelleyAddrEncoder, - AdaShelleyAddrNetworkTags, - AdaShelleyRewardAddr, - AdaShelleyRewardAddrDecoder, - AdaShelleyRewardAddrEncoder, - AdaShelleyStakingAddr, - AdaShelleyStakingAddrDecoder, - AdaShelleyStakingAddrEncoder, + AdaShelleyAddr, AdaShelleyAddrDecoder, AdaShelleyAddrEncoder, AdaShelleyAddrNetworkTags, AdaShelleyRewardAddr, + AdaShelleyRewardAddrDecoder, AdaShelleyRewardAddrEncoder, AdaShelleyStakingAddr, AdaShelleyStakingAddrDecoder, + AdaShelleyStakingAddrEncoder ) from bip_utils.addr.algo_addr import AlgoAddr, AlgoAddrDecoder, AlgoAddrEncoder from bip_utils.addr.aptos_addr import AptosAddr, AptosAddrDecoder, AptosAddrEncoder from bip_utils.addr.atom_addr import AtomAddr, AtomAddrDecoder, AtomAddrEncoder from bip_utils.addr.avax_addr import ( - AvaxPChainAddr, - AvaxPChainAddrDecoder, - AvaxPChainAddrEncoder, - AvaxXChainAddr, - AvaxXChainAddrDecoder, - AvaxXChainAddrEncoder, + AvaxPChainAddr, AvaxPChainAddrDecoder, AvaxPChainAddrEncoder, AvaxXChainAddr, AvaxXChainAddrDecoder, + AvaxXChainAddrEncoder ) from bip_utils.addr.bch_addr_converter import BchAddrConverter from bip_utils.addr.egld_addr import EgldAddr, EgldAddrDecoder, EgldAddrEncoder @@ -48,44 +33,26 @@ from bip_utils.addr.okex_addr import OkexAddr, OkexAddrDecoder, OkexAddrEncoder from bip_utils.addr.one_addr import OneAddr, OneAddrDecoder, OneAddrEncoder from bip_utils.addr.P2PKH_addr import ( - BchP2PKHAddr, - BchP2PKHAddrDecoder, - BchP2PKHAddrEncoder, - P2PKHAddr, - P2PKHAddrDecoder, - P2PKHAddrEncoder, - P2PKHPubKeyModes, + BchP2PKHAddr, BchP2PKHAddrDecoder, BchP2PKHAddrEncoder, P2PKHAddr, P2PKHAddrDecoder, P2PKHAddrEncoder, + P2PKHPubKeyModes ) from bip_utils.addr.P2SH_addr import ( - BchP2SHAddr, - BchP2SHAddrDecoder, - BchP2SHAddrEncoder, - P2SHAddr, - P2SHAddrDecoder, - P2SHAddrEncoder, + BchP2SHAddr, BchP2SHAddrDecoder, BchP2SHAddrEncoder, P2SHAddr, P2SHAddrDecoder, P2SHAddrEncoder ) from bip_utils.addr.P2TR_addr import P2TRAddr, P2TRAddrDecoder, P2TRAddrEncoder from bip_utils.addr.P2WPKH_addr import P2WPKHAddr, P2WPKHAddrDecoder, P2WPKHAddrEncoder from bip_utils.addr.sol_addr import SolAddr, SolAddrDecoder, SolAddrEncoder from bip_utils.addr.substrate_addr import ( - SubstrateEd25519Addr, - SubstrateEd25519AddrDecoder, - SubstrateEd25519AddrEncoder, - SubstrateSr25519Addr, - SubstrateSr25519AddrDecoder, - SubstrateSr25519AddrEncoder, + SubstrateEd25519Addr, SubstrateEd25519AddrDecoder, SubstrateEd25519AddrEncoder, SubstrateSr25519Addr, + SubstrateSr25519AddrDecoder, SubstrateSr25519AddrEncoder ) from bip_utils.addr.sui_addr import SuiAddr, SuiAddrDecoder, SuiAddrEncoder from bip_utils.addr.trx_addr import TrxAddr, TrxAddrDecoder, TrxAddrEncoder from bip_utils.addr.xlm_addr import XlmAddr, XlmAddrDecoder, XlmAddrEncoder, XlmAddrTypes from bip_utils.addr.xmr_addr import ( - XmrAddr, - XmrAddrDecoder, - XmrAddrEncoder, - XmrIntegratedAddr, - XmrIntegratedAddrDecoder, - XmrIntegratedAddrEncoder, + XmrAddr, XmrAddrDecoder, XmrAddrEncoder, XmrIntegratedAddr, XmrIntegratedAddrDecoder, XmrIntegratedAddrEncoder ) from bip_utils.addr.xrp_addr import XrpAddr, XrpAddrDecoder, XrpAddrEncoder from bip_utils.addr.xtz_addr import XtzAddr, XtzAddrDecoder, XtzAddrEncoder, XtzAddrPrefixes from bip_utils.addr.zil_addr import ZilAddr, ZilAddrDecoder, ZilAddrEncoder +from bip_utils.addr.ton_addr import TonAddrEncoder \ No newline at end of file diff --git a/bip_utils/addr/ton_addr.py b/bip_utils/addr/ton_addr.py new file mode 100644 index 00000000..0e3437b9 --- /dev/null +++ b/bip_utils/addr/ton_addr.py @@ -0,0 +1,78 @@ +# Copyright (c) 2021 Emanuele Bellocchia +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +"""Module for Tron address encoding following the rest of the modules.""" + +# Imports +from typing import Any, Union + +from bip_utils.addr.addr_key_validator import AddrKeyValidator +from bip_utils.addr.iaddr_encoder import IAddrEncoder + +from bip_utils.ecc import IPublicKey + +from bip_utils.ton.address.ton_address_encoder import TonAddressEncoder +from bip_utils.utils.misc import BytesUtils +from bip_utils.ecc.ed25519.ed25519_keys import Ed25519KeysConst + + +class TonAddrEncoder(IAddrEncoder): + """ + Ton address encoder class. + It allows the Ton address encoding. + """ + + @staticmethod + def EncodeKey(pub_key: Union[bytes, IPublicKey], + **kwargs: Any) -> str: + """ + Encode a public key to Ton address. + + Args: + pub_key (bytes or IPublicKey): Public key bytes or object + **kwargs : Not used + + Returns: + str: Address string + + Raised: + ValueError: If the public key is not valid + TypeError: If the public key is not ed25519, version is not valid or is_bounceable is not a boolean + """ + pub_key_obj = AddrKeyValidator.ValidateAndGetEd25519Key(pub_key) + pub_key_bytes = pub_key_obj.RawCompressed().ToBytes() + # Remove the 0x00 prefix if present + if (len(pub_key_bytes) == Ed25519KeysConst.PUB_KEY_BYTE_LEN + len(Ed25519KeysConst.PUB_KEY_PREFIX) + and pub_key_bytes[0] == BytesUtils.ToInteger(Ed25519KeysConst.PUB_KEY_PREFIX)): + pub_key_bytes = pub_key_bytes[1:] + + # Get and check address version. Default is v4, which is what is current employed in trust and ledger. + version = kwargs.get("version", "v4") + + # Version check is done in TonAddressEncoder, which will raise a ValueError if the version is not valid. We can skip it here to avoid code duplication. + is_bounceable = kwargs.get("is_bounceable", False) + if not isinstance(is_bounceable, bool): + raise TypeError("is_bounceable must be a boolean") + # Add prefix and encode + return TonAddressEncoder( pub_key_bytes, version=version, is_bounceable=is_bounceable).encode() + + +# Deprecated: only for compatibility, Encoder class shall be used instead +TonAddr = TonAddrEncoder diff --git a/bip_utils/bip/conf/bip44/bip44_coins.py b/bip_utils/bip/conf/bip44/bip44_coins.py index 286f3a3f..56794ee2 100644 --- a/bip_utils/bip/conf/bip44/bip44_coins.py +++ b/bip_utils/bip/conf/bip44/bip44_coins.py @@ -109,6 +109,7 @@ class Bip44Coins(BipCoins): TERRA = auto() TEZOS = auto() THETA = auto() + TON = auto() TRON = auto() VECHAIN = auto() VERGE = auto() diff --git a/bip_utils/bip/conf/bip44/bip44_conf.py b/bip_utils/bip/conf/bip44/bip44_conf.py index a98a5082..ce6efd1d 100644 --- a/bip_utils/bip/conf/bip44/bip44_conf.py +++ b/bip_utils/bip/conf/bip44/bip44_conf.py @@ -22,61 +22,20 @@ # Imports from bip_utils.addr import ( - AdaByronIcarusAddrEncoder, - AlgoAddrEncoder, - AptosAddrEncoder, - AtomAddrEncoder, - AvaxPChainAddrEncoder, - AvaxXChainAddrEncoder, - BchP2PKHAddrEncoder, - EgldAddrEncoder, - EosAddrEncoder, - ErgoNetworkTypes, - ErgoP2PKHAddrEncoder, - EthAddrEncoder, - FilSecp256k1AddrEncoder, - IcxAddrEncoder, - InjAddrEncoder, - MvrkAddrEncoder, - MvrkAddrPrefixes, - NanoAddrEncoder, - NearAddrEncoder, - NeoLegacyAddrEncoder, - NeoN3AddrEncoder, - NimAddrEncoder, - OkexAddrEncoder, - OneAddrEncoder, - P2PKHAddrEncoder, - SolAddrEncoder, - SubstrateEd25519AddrEncoder, - SuiAddrEncoder, - TrxAddrEncoder, - XlmAddrEncoder, - XlmAddrTypes, - XmrAddrEncoder, - XrpAddrEncoder, - XtzAddrEncoder, - XtzAddrPrefixes, - ZilAddrEncoder, + AdaByronIcarusAddrEncoder, AlgoAddrEncoder, AptosAddrEncoder, AtomAddrEncoder, AvaxPChainAddrEncoder, + AvaxXChainAddrEncoder, BchP2PKHAddrEncoder, EgldAddrEncoder, EosAddrEncoder, ErgoNetworkTypes, ErgoP2PKHAddrEncoder, + EthAddrEncoder, FilSecp256k1AddrEncoder, IcxAddrEncoder, InjAddrEncoder, MvrkAddrEncoder, MvrkAddrPrefixes, + NanoAddrEncoder, NearAddrEncoder, NeoLegacyAddrEncoder, NeoN3AddrEncoder, NimAddrEncoder, OkexAddrEncoder, + OneAddrEncoder, P2PKHAddrEncoder, SolAddrEncoder, SubstrateEd25519AddrEncoder, SuiAddrEncoder, TonAddrEncoder, TrxAddrEncoder, + XlmAddrEncoder, XlmAddrTypes, XmrAddrEncoder, XrpAddrEncoder, XtzAddrEncoder, XtzAddrPrefixes, ZilAddrEncoder ) from bip_utils.bip.bip32 import ( - Bip32Const, - Bip32KeyNetVersions, - Bip32KholawEd25519, - Bip32Slip10Ed25519, - Bip32Slip10Ed25519Blake2b, - Bip32Slip10Nist256p1, - Bip32Slip10Secp256k1, + Bip32Const, Bip32KeyNetVersions, Bip32KholawEd25519, Bip32Slip10Ed25519, Bip32Slip10Ed25519Blake2b, + Bip32Slip10Nist256p1, Bip32Slip10Secp256k1 ) from bip_utils.bip.conf.common import ( - DER_PATH_HARDENED_FULL, - DER_PATH_HARDENED_MID, - DER_PATH_HARDENED_SHORT, - DER_PATH_NON_HARDENED_FULL, - BipBitcoinCashConf, - BipCoinConf, - BipCoinFctCallsConf, - BipLitecoinConf, + DER_PATH_HARDENED_FULL, DER_PATH_HARDENED_MID, DER_PATH_HARDENED_SHORT, DER_PATH_NON_HARDENED_FULL, + BipBitcoinCashConf, BipCoinConf, BipCoinFctCallsConf, BipLitecoinConf ) from bip_utils.cardano.bip32.cardano_icarus_bip32 import CardanoIcarusBip32 from bip_utils.coin_conf import CoinsConf @@ -1340,6 +1299,18 @@ class Bip44Conf: addr_cls=EthAddrEncoder, addr_params={}, ) + # Configuration for Ton + Ton: BipCoinConf = BipCoinConf( + coin_names=CoinsConf.Ton.CoinNames(), + coin_idx=Slip44.TON, + is_testnet=False, + def_path=DER_PATH_HARDENED_FULL, + key_net_ver=_BIP44_BTC_KEY_NET_VER_MAIN, + wif_net_ver=None, + bip32_cls=Bip32Slip10Ed25519, + addr_cls=TonAddrEncoder, + addr_params={"version": CoinsConf.Ton.ParamByKey("version"), "is_bounceable": CoinsConf.Ton.ParamByKey("is_bounceable")}, + ) # Configuration for Tron Tron: BipCoinConf = BipCoinConf( diff --git a/bip_utils/coin_conf/coins_conf.py b/bip_utils/coin_conf/coins_conf.py index f53ca99d..f650a694 100644 --- a/bip_utils/coin_conf/coins_conf.py +++ b/bip_utils/coin_conf/coins_conf.py @@ -850,6 +850,15 @@ class CoinsConf: params={}, ) + # Configuration for Tron + Ton: CoinConf = CoinConf( + coin_name=CoinNames("The Open Network", "TON"), + params={ + "version": "v4", + "is_bounceable": False, + }, + ) + # Configuration for Tron Tron: CoinConf = CoinConf( coin_name=CoinNames("Tron", "TRX"), diff --git a/bip_utils/slip/slip44/slip44.py b/bip_utils/slip/slip44/slip44.py index d32f0e87..e733c1d6 100644 --- a/bip_utils/slip/slip44/slip44.py +++ b/bip_utils/slip/slip44/slip44.py @@ -50,6 +50,7 @@ class Slip44: NANO: int = 165 EOS: int = 194 TRON: int = 195 + TON: int = 607 BITCOIN_SV: int = 236 NIMIQ: int = 242 ALGORAND: int = 283 diff --git a/bip_utils/ton/__init__.py b/bip_utils/ton/__init__.py new file mode 100644 index 00000000..6691b4fa --- /dev/null +++ b/bip_utils/ton/__init__.py @@ -0,0 +1 @@ +from bip_utils.ton.ton import Ton diff --git a/bip_utils/ton/address/__init__.py b/bip_utils/ton/address/__init__.py new file mode 100644 index 00000000..c261438d --- /dev/null +++ b/bip_utils/ton/address/__init__.py @@ -0,0 +1 @@ +from bip_utils.ton.address.ton_address_encoder import TonAddressEncoder \ No newline at end of file diff --git a/bip_utils/ton/address/ton_address_encoder.py b/bip_utils/ton/address/ton_address_encoder.py new file mode 100644 index 00000000..9a518884 --- /dev/null +++ b/bip_utils/ton/address/ton_address_encoder.py @@ -0,0 +1,166 @@ + + +import base64 +from enum import StrEnum, unique +from pytoniq_core import Cell, begin_cell, Address +from typing import List + +wallet_versions_serialisation = { + "v5r1": 0 + } + + +@unique +class TonAddressVerions(StrEnum): + """Enumerative for TON address versions.""" + + V5R1 = "v5r1" + V4 = "v4" + V3R2 = "v3r2" + V3R1 = "v3r1" + + +class TonAddressConst: + """Class container for TON address constants.""" + + # Accepted addrsess versions + TON_ADDRESS_VERSIONS: List[TonAddressVerions] = [ + TonAddressVerions.V5R1, + TonAddressVerions.V4, + TonAddressVerions.V3R2, + TonAddressVerions.V3R1 + ] + + +class TonAddressEncoder: + """ + TON address encoder class. + See for source: + https://github.com/ton-org/ton/blob/main/src/wallets/v5r1/WalletContractV5R1.ts + https://github.com/ton-org/ton/blob/main/src/wallets/v4/WalletContractV4.ts + https://github.com/ton-org/ton/blob/main/src/wallets/v3/r2.ts + https://github.com/ton-org/ton/blob/main/src/wallets/v3/r1.ts + """ + + def __init__(self, public_key, version="v5r1", is_bounceable=False): + if version not in TonAddressConst.TON_ADDRESS_VERSIONS: + raise ValueError(f"Version ({version}) is not valid. Supported versions are: {', '.join(TonAddressConst.TON_ADDRESS_VERSIONS)}") + self.public_key = public_key + self.is_bounceable = is_bounceable + self.version = version + + def v5r1Address(self): + + wallet_details = { + "workchain": 0, + "walletVersion": "v5r1", + "subwalletNumber": 0, + "networkGlobalId": -239 + } + + + code = Cell.one_from_boc("b5ee9c7241021401000281000114ff00f4a413f4bcf2c80b01020120020d020148030402dcd020d749c120915b8f6320d70b1f2082106578746ebd21821073696e74bdb0925f03e082106578746eba8eb48020d72101d074d721fa4030fa44f828fa443058bd915be0ed44d0810141d721f4058307f40e6fa1319130e18040d721707fdb3ce03120d749810280b99130e070e2100f020120050c020120060902016e07080019adce76a2684020eb90eb85ffc00019af1df6a2684010eb90eb858fc00201480a0b0017b325fb51341c75c875c2c7e00011b262fb513435c280200019be5f0f6a2684080a0eb90fa02c0102f20e011e20d70b1f82107369676ebaf2e08a7f0f01e68ef0eda2edfb218308d722028308d723208020d721d31fd31fd31fed44d0d200d31f20d31fd3ffd70a000af90140ccf9109a28945f0adb31e1f2c087df02b35007b0f2d0845125baf2e0855036baf2e086f823bbf2d0882292f800de01a47fc8ca00cb1f01cf16c9ed542092f80fde70db3cd81003f6eda2edfb02f404216e926c218e4c0221d73930709421c700b38e2d01d72820761e436c20d749c008f2e09320d74ac002f2e09320d71d06c712c2005230b0f2d089d74cd7393001a4e86c128407bbf2e093d74ac000f2e093ed55e2d20001c000915be0ebd72c08142091709601d72c081c12e25210b1e30f20d74a111213009601fa4001fa44f828fa443058baf2e091ed44d0810141d718f405049d7fc8ca0040048307f453f2e08b8e14038307f45bf2e08c22d70a00216e01b3b0f2d090e2c85003cf1612f400c9ed54007230d72c08248e2d21f2e092d200ed44d0d2005113baf2d08f54503091319c01810140d721d70a00f2e08ee2c8ca0058cf16c9ed5493f2c08de20010935bdb31e1d74cd0b4d6c35e") + + context = begin_cell() .store_uint(1, 1)\ + .store_int(wallet_details["workchain"] , 8)\ + .store_uint(wallet_versions_serialisation[wallet_details["walletVersion"]], 8)\ + .store_uint(wallet_details["subwalletNumber"], 15).end_cell().begin_parse().load_int(32) + + data = begin_cell().store_uint(1,1)\ + .store_uint(0, 32)\ + .store_int(wallet_details["networkGlobalId"] ^ context, 32)\ + .store_bytes(self.public_key)\ + .store_bit(0) \ + .end_cell() + + + hash_ = begin_cell().store_bit(False).store_bit(False).store_maybe_ref(code)\ + .store_maybe_ref(data)\ + .store_dict(None)\ + .end_cell().hash + + add = Address((wallet_details["workchain"], hash_)) + return add.to_str(is_bounceable=self.is_bounceable) + + def v4Address(self): + + wallet_details = {"workchain": 0} + + wallet_id = 698983191 + wallet_details["workchain"] + + code = Cell.one_from_boc(base64.b64decode("te6ccgECFAEAAtQAART/APSkE/S88sgLAQIBIAIDAgFIBAUE+PKDCNcYINMf0x/THwL4I7vyZO1E0NMf0x/T//QE0VFDuvKhUVG68qIF+QFUEGT5EPKj+AAkpMjLH1JAyx9SMMv/UhD0AMntVPgPAdMHIcAAn2xRkyDXSpbTB9QC+wDoMOAhwAHjACHAAuMAAcADkTDjDQOkyMsfEssfy/8QERITAubQAdDTAyFxsJJfBOAi10nBIJJfBOAC0x8hghBwbHVnvSKCEGRzdHK9sJJfBeAD+kAwIPpEAcjKB8v/ydDtRNCBAUDXIfQEMFyBAQj0Cm+hMbOSXwfgBdM/yCWCEHBsdWe6kjgw4w0DghBkc3RyupJfBuMNBgcCASAICQB4AfoA9AQw+CdvIjBQCqEhvvLgUIIQcGx1Z4MesXCAGFAEywUmzxZY+gIZ9ADLaRfLH1Jgyz8gyYBA+wAGAIpQBIEBCPRZMO1E0IEBQNcgyAHPFvQAye1UAXKwjiOCEGRzdHKDHrFwgBhQBcsFUAPPFiP6AhPLassfyz/JgED7AJJfA+ICASAKCwBZvSQrb2omhAgKBrkPoCGEcNQICEekk30pkQzmkD6f+YN4EoAbeBAUiYcVnzGEAgFYDA0AEbjJftRNDXCx+AA9sp37UTQgQFA1yH0BDACyMoHy//J0AGBAQj0Cm+hMYAIBIA4PABmtznaiaEAga5Drhf/AABmvHfaiaEAQa5DrhY/AAG7SB/oA1NQi+QAFyMoHFcv/ydB3dIAYyMsFywIizxZQBfoCFMtrEszMyXP7AMhAFIEBCPRR8qcCAHCBAQjXGPoA0z/IVCBHgQEI9FHyp4IQbm90ZXB0gBjIywXLAlAGzxZQBPoCFMtqEssfyz/Jc/sAAgBsgQEI1xj6ANM/MFIkgQEI9Fnyp4IQZHN0cnB0gBjIywXLAlAFzxZQA/oCE8tqyx8Syz/Jc/sAAAr0AMntVA==")) + + + data = begin_cell()\ + .store_uint(0, 32)\ + .store_uint(wallet_id, 32)\ + .store_bytes(self.public_key)\ + .store_bit(0) \ + .end_cell() + + + hash_ = begin_cell().store_bit(False).store_bit(False).store_maybe_ref(code)\ + .store_maybe_ref(data)\ + .store_dict(None)\ + .end_cell().hash + + add = Address((wallet_details["workchain"], hash_)) + return add.to_str(is_bounceable=self.is_bounceable) + + + def v3r2Address(self): + + wallet_details = {"workchain": 0} + + wallet_id = 698983191 + wallet_details["workchain"] + + code = Cell.one_from_boc(base64.b64decode("te6cckEBAQEAcQAA3v8AIN0gggFMl7ohggEznLqxn3Gw7UTQ0x/THzHXC//jBOCk8mCDCNcYINMf0x/TH/gjE7vyY+1E0NMf0x/T/9FRMrryoVFEuvKiBPkBVBBV+RDyo/gAkyDXSpbTB9QC+wDo0QGkyMsfyx/L/8ntVBC9ba0=")) + + + data = begin_cell()\ + .store_uint(0, 32)\ + .store_uint(wallet_id, 32)\ + .store_bytes(self.public_key)\ + .end_cell() + + + hash_ = begin_cell().store_bit(False).store_bit(False).store_maybe_ref(code)\ + .store_maybe_ref(data)\ + .store_dict(None)\ + .end_cell().hash + + add = Address((wallet_details["workchain"], hash_)) + return add.to_str(is_bounceable=self.is_bounceable) + + def v3r1Address(self): + wallet_details = {"workchain": 0} + + wallet_id = 698983191 + wallet_details["workchain"] + + code = Cell.one_from_boc(base64.b64decode("te6cckEBAQEAYgAAwP8AIN0gggFMl7qXMO1E0NcLH+Ck8mCDCNcYINMf0x/TH/gjE7vyY+1E0NMf0x/T/9FRMrryoVFEuvKiBPkBVBBV+RDyo/gAkyDXSpbTB9QC+wDo0QGkyMsfyx/L/8ntVD++buA=")) + + + data = begin_cell()\ + .store_uint(0, 32)\ + .store_uint(wallet_id, 32)\ + .store_bytes(self.public_key)\ + .end_cell() + + + hash_ = begin_cell().store_bit(False).store_bit(False).store_maybe_ref(code)\ + .store_maybe_ref(data)\ + .store_dict(None)\ + .end_cell().hash + + add = Address((wallet_details["workchain"], hash_)) + return add.to_str(is_bounceable=self.is_bounceable) + + def encode(self): + if self.version == "v5r1": + return self.v5r1Address() + elif self.version == "v4": + return self.v4Address() + elif self.version == "v3r2": + return self.v3r2Address() + else: + return self.v3r1Address() \ No newline at end of file diff --git a/bip_utils/ton/mnemonic/__init__.py b/bip_utils/ton/mnemonic/__init__.py new file mode 100644 index 00000000..91da3b1b --- /dev/null +++ b/bip_utils/ton/mnemonic/__init__.py @@ -0,0 +1,4 @@ +from bip_utils.ton.mnemonic.ton_mnemonic import TonLanguages, TonMnemonic, TonWordsNum +from bip_utils.ton.mnemonic.ton_mnemonic_validator import TonMnemonicValidator +from bip_utils.ton.mnemonic.ton_mnemonic_generator import TonMnemonicGenerator +from bip_utils.ton.mnemonic.ton_seed_generator import TonSeedGenerator diff --git a/bip_utils/ton/mnemonic/ton_mnemonic.py b/bip_utils/ton/mnemonic/ton_mnemonic.py new file mode 100644 index 00000000..3f5b5523 --- /dev/null +++ b/bip_utils/ton/mnemonic/ton_mnemonic.py @@ -0,0 +1,57 @@ +# Copyright (c) 2021 Emanuele Bellocchia +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +"""Module for Algorand mnemonic.""" + +# Imports +from enum import IntEnum, unique +from typing import List + +from bip_utils.bip.bip39 import Bip39Languages, Bip39Mnemonic +from bip_utils.utils.mnemonic import MnemonicLanguages + + +@unique +class TonWordsNum(IntEnum): + """Enumerative for TON words number.""" + + WORDS_NUM_12 = 12 + WORDS_NUM_24 = 24 + + +@unique +class TonLanguages(MnemonicLanguages): + """Enumerative for TON languages.""" + + ENGLISH = Bip39Languages.ENGLISH + + +class TonMnemonicConst: + """Class container for TON mnemonic constants.""" + + # Accepted mnemonic word numbers + MNEMONIC_WORD_NUM: List[TonWordsNum] = [ + TonWordsNum.WORDS_NUM_12, + TonWordsNum.WORDS_NUM_24, + ] + + +class TonMnemonic(Bip39Mnemonic): + """TON mnemonic class.""" diff --git a/bip_utils/ton/mnemonic/ton_mnemonic_generator.py b/bip_utils/ton/mnemonic/ton_mnemonic_generator.py new file mode 100644 index 00000000..c617c508 --- /dev/null +++ b/bip_utils/ton/mnemonic/ton_mnemonic_generator.py @@ -0,0 +1,93 @@ +# Copyright (c) 2021 Emanuele Bellocchia +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +"""Module for Algorand mnemonic generation.""" + +# Imports +from typing import Dict, Optional, Union + +from bip_utils.bip.bip39.bip39_mnemonic import Bip39Languages + +from bip_utils.ton.mnemonic.ton_mnemonic import TonWordsNum +from bip_utils.utils.mnemonic import Mnemonic +import secrets +from bip_utils.bip.bip39.bip39_mnemonic import Bip39MnemonicConst +from bip_utils.ton.mnemonic.ton_mnemonic_validator import TonMnemonicValidator +from bip_utils.ton.mnemonic.ton_mnemonic import TonMnemonicConst +from bip_utils.bip.bip39.bip39_mnemonic_utils import Bip39WordsListGetter + + +class TonMnemonicGenerator: + """ + TON mnemonic generator class. + It generates 12 or 24-words mnemonic in according to TON wallets. + """ + + + def __init__(self) -> None: + """ + Construct class. + """ + + + def FromWordsNumber(self, + words_num: Optional[Union[int, TonWordsNum]] = 24, passphrase: Optional[str] = "") -> Mnemonic: + """ + Generate mnemonic with the specified words. + See https://github.com/ton-org/ton-crypto/blob/master/src/mnemonic/mnemonic.ts + + Args: + words_num (int or TonWordsNum): Number of words (12 or 24) + passphrase (str, optional): Passphrase. Default is empty string. + + Returns: + Mnemonic object: Generated mnemonic + + Raises: + ValueError: If words number is not valid + """ + ton_mnemonic_validator = TonMnemonicValidator() + while True: + + # Check words number + if words_num not in TonMnemonicConst. MNEMONIC_WORD_NUM: + raise ValueError(f"Words number for mnemonic ({words_num}) is not valid") + + # Get word list + words_list = Bip39WordsListGetter().GetByLanguage(Bip39Languages.ENGLISH) + + + # Generate mnemonic + + mnemonic_array = [] + + for i in range(words_num): + idx = secrets.randbelow(Bip39MnemonicConst.WORDS_LIST_NUM) + mnemonic_array.append(words_list.GetWordAtIdx(idx)) + + mnemonic = " ".join(mnemonic_array) + + # If derived mnemonic is not valid continue loop and generate another one, otherwise break loop and return it + if not ton_mnemonic_validator.IsValid(mnemonic, passphrase): + continue + break + + return mnemonic + diff --git a/bip_utils/ton/mnemonic/ton_mnemonic_validator.py b/bip_utils/ton/mnemonic/ton_mnemonic_validator.py new file mode 100644 index 00000000..6c7f9cb3 --- /dev/null +++ b/bip_utils/ton/mnemonic/ton_mnemonic_validator.py @@ -0,0 +1,65 @@ +# Copyright (c) 2021 Emanuele Bellocchia +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +"""Module for Algorand mnemonic validation.""" + +# Imports +from typing import Optional + + +from bip_utils.bip.bip39.bip39_mnemonic import Bip39Languages +from bip_utils.utils.crypto.hmac import HmacSha512 +from bip_utils.utils.crypto.pbkdf2 import Pbkdf2HmacSha512 +from bip_utils.bip.bip39.bip39_mnemonic_utils import Bip39WordsListGetter + +class TonMnemonicValidator: + """ + TON mnemonic validator class. + It validates a mnemonic phrase. + See https://github.com/ton-org/ton-crypto/blob/master/src/mnemonic/mnemonic.ts + """ + + def __init__(self): + """ + Construct class. + """ + + + def IsValid(self, mnemonic: str, passphrase: Optional[str] = "") -> bool: + entropy = HmacSha512().QuickDigest(mnemonic, passphrase) + mnemonic_array = mnemonic.split(" ") + words_list = Bip39WordsListGetter().GetByLanguage(Bip39Languages.ENGLISH) + for word in mnemonic_array: + try: + words_list.GetWordIdx(word) + except ValueError: + return False + if passphrase != "": + seed = Pbkdf2HmacSha512().DeriveKey(entropy, "TON fast seed version", 1, 64) + return seed[0] == 1 + else: + seed = Pbkdf2HmacSha512().DeriveKey(entropy, "TON seed version", 390, 64) + return seed[0] == 0 + + + + + + \ No newline at end of file diff --git a/bip_utils/ton/mnemonic/ton_seed_generator.py b/bip_utils/ton/mnemonic/ton_seed_generator.py new file mode 100644 index 00000000..7003b8a0 --- /dev/null +++ b/bip_utils/ton/mnemonic/ton_seed_generator.py @@ -0,0 +1,70 @@ +# Copyright (c) 2021 Emanuele Bellocchia +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +"""Module for Algorand mnemonic seed generation.""" + +# Imports +from symtable import Class +from typing import Optional, Union + +from bip_utils.utils.mnemonic import Mnemonic +from bip_utils.utils.crypto.hmac import HmacSha512 +from bip_utils.utils.crypto.pbkdf2 import Pbkdf2HmacSha512 + + +class TonSeedGenerator: + """ + TON seed generator class. + It generates the seed from a mnemonic. + """ + + m_entropy_bytes: bytes + + def __init__(self, + mnemonic: Union[str, Mnemonic], + ) -> None: + """ + Construct class. + + Args: + mnemonic (str or Mnemonic object) : Mnemonic + + Raises: + ValueError: If the mnemonic is not valid + """ + self.mnemonic = mnemonic if isinstance(mnemonic, str) else mnemonic.ToStr() + + + + def Generate(self, passphrase: Optional[str] = "") -> bytes: + """ + Generate seed. The seed is the PBKDF2-HMAC-SHA512 of the entropy bytes. + See https://github.com/ton-org/ton-crypto/blob/master/src/mnemonic/mnemonic.ts + + Returns: + bytes: Generated seed + """ + self.entropy_bytes = HmacSha512().QuickDigest(self.mnemonic, passphrase) + + seed = Pbkdf2HmacSha512().DeriveKey(self.entropy_bytes, "TON default seed", 100000, 64) + + return seed + + \ No newline at end of file diff --git a/bip_utils/ton/ton.py b/bip_utils/ton/ton.py new file mode 100644 index 00000000..d5364759 --- /dev/null +++ b/bip_utils/ton/ton.py @@ -0,0 +1,84 @@ +# Copyright (c) 2022 Emanuele Bellocchia +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +"""Module containing utility classes for Ton keys derivation.""" + +# Imports +from __future__ import annotations + +from typing import Optional + + +from bip_utils.ecc.ed25519.ed25519_keys import Ed25519PrivateKey +from bip_utils.ton.address.ton_address_encoder import TonAddressEncoder + +class Ton: + + + def __init__(self): + """ + Construct class. + """ + + def FromSeed(self, seed_bytes: bytes): + """ + Construct class from seed bytes. + + Args: + seed_bytes (bytes): Seed bytes + + Returns: + ElectrumV2Base object: ElectrumV2Base object + """ + self.private_key = Ed25519PrivateKey.FromBytes(seed_bytes[:32]).UnderlyingObject() + return self + + + + def GetPublicKey(self) -> bytes: + """ + Get public key from seed. The public key is the last 32 bytes of the seed. + + Returns: + Ed25519PublicKey: Generated public key + """ + return self.private_key.verify_key.encode() + + def GetPrivateKey(self) -> bytes: + """ + Get private key from seed. + + Returns: + Ed25519PrivateKey: Generated private key + """ + return self.private_key.encode() + + def GetAddress(self, version: Optional[str] = "v5r1", is_bounceable: Optional[bool] = False) -> str: + """ + Get address + + Returns: + str: Generated address + """ + + public_key = self.ToPublicKey() + + address = TonAddressEncoder(public_key, version=version, is_bounceable=is_bounceable).encode() + return address diff --git a/requirements.txt b/requirements.txt index fee8534c..5cc7b144 100644 --- a/requirements.txt +++ b/requirements.txt @@ -16,3 +16,4 @@ py-sr25519-bindings>=0.1.4,<2.0.0; python_version == '3.10' py-sr25519-bindings>=0.2.0,<2.0.0; python_version >= '3.11' py-sr25519-bindings>=0.2.2,<2.0.0; python_version >= '3.13' typing_extensions>=3.7.2; python_version == '3.7' +pytoniq_core \ No newline at end of file From 1cff35bf27dcdf6b2ebeafcdf6df9b5dd35e3e27 Mon Sep 17 00:00:00 2001 From: Bobby Newport Date: Wed, 25 Feb 2026 15:35:29 +1100 Subject: [PATCH 02/66] update bip44 conf getter --- bip_utils/bip/conf/bip44/bip44_conf_getter.py | 1 + 1 file changed, 1 insertion(+) diff --git a/bip_utils/bip/conf/bip44/bip44_conf_getter.py b/bip_utils/bip/conf/bip44/bip44_conf_getter.py index 6b89d414..d17f33ae 100644 --- a/bip_utils/bip/conf/bip44/bip44_conf_getter.py +++ b/bip_utils/bip/conf/bip44/bip44_conf_getter.py @@ -121,6 +121,7 @@ class Bip44ConfGetterConst: Bip44Coins.TERRA: Bip44Conf.Terra, Bip44Coins.TEZOS: Bip44Conf.Tezos, Bip44Coins.THETA: Bip44Conf.Theta, + Bip44Coins.TON: Bip44Conf.Ton, Bip44Coins.TRON: Bip44Conf.Tron, Bip44Coins.VECHAIN: Bip44Conf.VeChain, Bip44Coins.VERGE: Bip44Conf.Verge, From 7377153c090c16cbdba6a4f2ac4b8bdadf13a9f7 Mon Sep 17 00:00:00 2001 From: Bobby Newport Date: Wed, 25 Feb 2026 15:56:54 +1100 Subject: [PATCH 03/66] add ton examples --- bip_utils/ton/ton.py | 2 +- examples/ton.py | 62 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 examples/ton.py diff --git a/bip_utils/ton/ton.py b/bip_utils/ton/ton.py index d5364759..4df529ec 100644 --- a/bip_utils/ton/ton.py +++ b/bip_utils/ton/ton.py @@ -78,7 +78,7 @@ def GetAddress(self, version: Optional[str] = "v5r1", is_bounceable: Optional[bo str: Generated address """ - public_key = self.ToPublicKey() + public_key = self.GetPublicKey() address = TonAddressEncoder(public_key, version=version, is_bounceable=is_bounceable).encode() return address diff --git a/examples/ton.py b/examples/ton.py new file mode 100644 index 00000000..525766cd --- /dev/null +++ b/examples/ton.py @@ -0,0 +1,62 @@ +from bip_utils import TonSeedGenerator, TonMnemonicGenerator, TonMnemonicValidator, Ton + +# Generate mnemonic for Ton wallets such as Tonkeeper + +mnemonic = TonMnemonicGenerator().FromWordsNumber(24) +print(f"Mnemonic: {mnemonic}") + +# Validate mnemonic +is_valid = TonMnemonicValidator().IsValid(mnemonic) +print(f"Is the mnemonic valid? {is_valid}") + +# Generate seed and address from memonic + +seed = TonSeedGenerator(mnemonic).Generate() + +# Default address type is v5r1 +addr = Ton().FromSeed(seed).GetAddress() +print(f"V5R1 Address: {addr}") + +# Generate v4r1 address +addr_v4 = Ton().FromSeed(seed).GetAddress("v4") +print(f"V4R1 Address: {addr_v4}") + + +# Generate addresses based on bip44 such as Trustwallet or Ledger + +from bip_utils import Bip32Ed25519Slip, Bip39SeedGenerator, Bip44, Bip44Coins, Bip44ConfGetter + + +# Mnemonic +mnemonic = "bachelor neither fall observe flee give sniff rebel access maximum property beach" +# Generate seed from mnemonic +seed_bytes = Bip39SeedGenerator(mnemonic).Generate() + +coin_type = Bip44Coins.TON + +seed_bytes = Bip39SeedGenerator(mnemonic).Generate() + +# Get address using the Trustwallet derivation path +bip44_mst= Bip44.FromSeed(seed_bytes, coin_type) +bip44_acc= bip44_mst.Purpose().Coin().Account(0) +addr = bip44_acc.PublicKey().ToAddress() +print(f"Address using Trustwallet derivation path: {addr}") + +# Ledger uses a non-standard derivation path, so we need to use Bip32 directly + +# Get coin index from configuration +coin_idx = Bip44ConfGetter.GetConfig(coin_type).CoinIndex() +# Account index +account_idx = 0 +derivation_path = f"m/44'/{coin_idx}'/0'/0'/{account_idx}'/0'" +print(derivation_path) +# Derive the standard BIP44 path using secp256k1 +bip32_ctx = Bip32Ed25519Slip.FromSeed(seed_bytes).DerivePath(derivation_path) +priv_key_bytes = bip32_ctx.PrivateKey().Raw().ToBytes() + + +bip44_ctx = Bip44.FromPrivateKey(priv_key_bytes, coin_type) + +addr = bip44_ctx.PublicKey().ToAddress() + +print(f"Address for Ledger: {addr}") From 4cc5197052e9a6f003cd8e863b00558b2c97299f Mon Sep 17 00:00:00 2001 From: Bobby Newport Date: Wed, 25 Feb 2026 15:57:54 +1100 Subject: [PATCH 04/66] update ton example --- examples/ton.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/ton.py b/examples/ton.py index 525766cd..9cf6d48f 100644 --- a/examples/ton.py +++ b/examples/ton.py @@ -17,9 +17,9 @@ addr = Ton().FromSeed(seed).GetAddress() print(f"V5R1 Address: {addr}") -# Generate v4r1 address +# Generate v4 address addr_v4 = Ton().FromSeed(seed).GetAddress("v4") -print(f"V4R1 Address: {addr_v4}") +print(f"V4 Address: {addr_v4}") # Generate addresses based on bip44 such as Trustwallet or Ledger @@ -59,4 +59,4 @@ addr = bip44_ctx.PublicKey().ToAddress() -print(f"Address for Ledger: {addr}") +print(f"Address using Ledger derivation path: {addr}") From 607a30d59ce00106543f37d7f8ab1098fc3faaef Mon Sep 17 00:00:00 2001 From: Bobby Newport Date: Wed, 25 Feb 2026 16:28:20 +1100 Subject: [PATCH 05/66] Clarify return types in method docstrings Update docstring to clarify return type of GetPrivateKey and GetPublicKey methods. --- bip_utils/ton/ton.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bip_utils/ton/ton.py b/bip_utils/ton/ton.py index 4df529ec..64ebd969 100644 --- a/bip_utils/ton/ton.py +++ b/bip_utils/ton/ton.py @@ -45,7 +45,7 @@ def FromSeed(self, seed_bytes: bytes): seed_bytes (bytes): Seed bytes Returns: - ElectrumV2Base object: ElectrumV2Base object + Private key """ self.private_key = Ed25519PrivateKey.FromBytes(seed_bytes[:32]).UnderlyingObject() return self @@ -54,7 +54,7 @@ def FromSeed(self, seed_bytes: bytes): def GetPublicKey(self) -> bytes: """ - Get public key from seed. The public key is the last 32 bytes of the seed. + Get public key from seed. Returns: Ed25519PublicKey: Generated public key From ce842cb1b9475a1808544d1fed88f8cbb00603ea Mon Sep 17 00:00:00 2001 From: Bobby Newport Date: Wed, 25 Feb 2026 16:31:49 +1100 Subject: [PATCH 06/66] Remove duplicate seed_bytes generation Removed duplicate seed_bytes generation. --- examples/ton.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/examples/ton.py b/examples/ton.py index 9cf6d48f..c2d0e9d1 100644 --- a/examples/ton.py +++ b/examples/ton.py @@ -34,8 +34,6 @@ coin_type = Bip44Coins.TON -seed_bytes = Bip39SeedGenerator(mnemonic).Generate() - # Get address using the Trustwallet derivation path bip44_mst= Bip44.FromSeed(seed_bytes, coin_type) bip44_acc= bip44_mst.Purpose().Coin().Account(0) From 7aaad37d20889a1ed05132fa70d3da665cef7255 Mon Sep 17 00:00:00 2001 From: Bobby Newport Date: Wed, 25 Feb 2026 16:32:37 +1100 Subject: [PATCH 07/66] Refactor BIP44 path derivation and remove print Removed print statement for derivation path and added BIP32 derivation. --- examples/ton.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/ton.py b/examples/ton.py index c2d0e9d1..8578f249 100644 --- a/examples/ton.py +++ b/examples/ton.py @@ -47,8 +47,7 @@ # Account index account_idx = 0 derivation_path = f"m/44'/{coin_idx}'/0'/0'/{account_idx}'/0'" -print(derivation_path) -# Derive the standard BIP44 path using secp256k1 + bip32_ctx = Bip32Ed25519Slip.FromSeed(seed_bytes).DerivePath(derivation_path) priv_key_bytes = bip32_ctx.PrivateKey().Raw().ToBytes() From e17a2f223bd8b7e05856ec4ace41f8708fd0e286 Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Wed, 25 Feb 2026 22:53:57 +0100 Subject: [PATCH 08/66] Run automatic ruff fix --- bip_utils/__init__.py | 390 +++++++++++++++--- bip_utils/addr/__init__.py | 62 ++- bip_utils/addr/ton_addr.py | 6 +- bip_utils/bip/conf/bip44/bip44_conf.py | 62 ++- bip_utils/ton/address/__init__.py | 2 +- bip_utils/ton/address/ton_address_encoder.py | 66 +-- bip_utils/ton/mnemonic/__init__.py | 2 +- .../ton/mnemonic/ton_mnemonic_generator.py | 25 +- .../ton/mnemonic/ton_mnemonic_validator.py | 13 +- bip_utils/ton/mnemonic/ton_seed_generator.py | 8 +- bip_utils/ton/ton.py | 14 +- 11 files changed, 487 insertions(+), 163 deletions(-) diff --git a/bip_utils/__init__.py b/bip_utils/__init__.py index 38c5b8ef..8ed649d2 100644 --- a/bip_utils/__init__.py +++ b/bip_utils/__init__.py @@ -3,55 +3,208 @@ # Address decoding/encoding from bip_utils.addr import ( - AdaByronAddrDecoder, AdaByronAddrTypes, AdaByronIcarusAddr, AdaByronIcarusAddrEncoder, AdaByronLegacyAddr, - AdaByronLegacyAddrEncoder, AdaShelleyAddr, AdaShelleyAddrDecoder, AdaShelleyAddrEncoder, AdaShelleyAddrNetworkTags, - AdaShelleyRewardAddr, AdaShelleyRewardAddrDecoder, AdaShelleyRewardAddrEncoder, AdaShelleyStakingAddr, - AdaShelleyStakingAddrDecoder, AdaShelleyStakingAddrEncoder, AlgoAddr, AlgoAddrDecoder, AlgoAddrEncoder, AptosAddr, - AptosAddrDecoder, AptosAddrEncoder, AtomAddr, AtomAddrDecoder, AtomAddrEncoder, AvaxPChainAddr, - AvaxPChainAddrDecoder, AvaxPChainAddrEncoder, AvaxXChainAddr, AvaxXChainAddrDecoder, AvaxXChainAddrEncoder, - BchAddrConverter, BchP2PKHAddr, BchP2PKHAddrDecoder, BchP2PKHAddrEncoder, BchP2SHAddr, BchP2SHAddrDecoder, - BchP2SHAddrEncoder, EgldAddr, EgldAddrDecoder, EgldAddrEncoder, EosAddr, EosAddrDecoder, EosAddrEncoder, - ErgoNetworkTypes, ErgoP2PKHAddr, ErgoP2PKHAddrDecoder, ErgoP2PKHAddrEncoder, EthAddr, EthAddrDecoder, - EthAddrEncoder, FilSecp256k1Addr, FilSecp256k1AddrDecoder, FilSecp256k1AddrEncoder, IcxAddr, IcxAddrDecoder, - IcxAddrEncoder, InjAddr, InjAddrDecoder, InjAddrEncoder, MvrkAddr, MvrkAddrDecoder, MvrkAddrEncoder, - MvrkAddrPrefixes, NanoAddr, NanoAddrDecoder, NanoAddrEncoder, NearAddr, NearAddrDecoder, NearAddrEncoder, NeoAddr, - NeoAddrDecoder, NeoAddrEncoder, NeoLegacyAddr, NeoLegacyAddrDecoder, NeoLegacyAddrEncoder, NeoN3Addr, - NeoN3AddrDecoder, NeoN3AddrEncoder, NimAddr, NimAddrDecoder, NimAddrEncoder, OkexAddr, OkexAddrDecoder, - OkexAddrEncoder, OneAddr, OneAddrDecoder, OneAddrEncoder, P2PKHAddr, P2PKHAddrDecoder, P2PKHAddrEncoder, - P2PKHPubKeyModes, P2SHAddr, P2SHAddrDecoder, P2SHAddrEncoder, P2TRAddr, P2TRAddrDecoder, P2TRAddrEncoder, - P2WPKHAddr, P2WPKHAddrDecoder, P2WPKHAddrEncoder, SolAddr, SolAddrDecoder, SolAddrEncoder, SubstrateEd25519Addr, - SubstrateEd25519AddrDecoder, SubstrateEd25519AddrEncoder, SubstrateSr25519Addr, SubstrateSr25519AddrDecoder, - SubstrateSr25519AddrEncoder, SuiAddr, SuiAddrDecoder, SuiAddrEncoder, TrxAddr, TrxAddrDecoder, TrxAddrEncoder, - XlmAddr, XlmAddrDecoder, XlmAddrEncoder, XlmAddrTypes, XmrAddr, XmrAddrDecoder, XmrAddrEncoder, XmrIntegratedAddr, - XmrIntegratedAddrDecoder, XmrIntegratedAddrEncoder, XrpAddr, XrpAddrDecoder, XrpAddrEncoder, XtzAddr, - XtzAddrDecoder, XtzAddrEncoder, XtzAddrPrefixes, ZilAddr, ZilAddrDecoder, ZilAddrEncoder + AdaByronAddrDecoder, + AdaByronAddrTypes, + AdaByronIcarusAddr, + AdaByronIcarusAddrEncoder, + AdaByronLegacyAddr, + AdaByronLegacyAddrEncoder, + AdaShelleyAddr, + AdaShelleyAddrDecoder, + AdaShelleyAddrEncoder, + AdaShelleyAddrNetworkTags, + AdaShelleyRewardAddr, + AdaShelleyRewardAddrDecoder, + AdaShelleyRewardAddrEncoder, + AdaShelleyStakingAddr, + AdaShelleyStakingAddrDecoder, + AdaShelleyStakingAddrEncoder, + AlgoAddr, + AlgoAddrDecoder, + AlgoAddrEncoder, + AptosAddr, + AptosAddrDecoder, + AptosAddrEncoder, + AtomAddr, + AtomAddrDecoder, + AtomAddrEncoder, + AvaxPChainAddr, + AvaxPChainAddrDecoder, + AvaxPChainAddrEncoder, + AvaxXChainAddr, + AvaxXChainAddrDecoder, + AvaxXChainAddrEncoder, + BchAddrConverter, + BchP2PKHAddr, + BchP2PKHAddrDecoder, + BchP2PKHAddrEncoder, + BchP2SHAddr, + BchP2SHAddrDecoder, + BchP2SHAddrEncoder, + EgldAddr, + EgldAddrDecoder, + EgldAddrEncoder, + EosAddr, + EosAddrDecoder, + EosAddrEncoder, + ErgoNetworkTypes, + ErgoP2PKHAddr, + ErgoP2PKHAddrDecoder, + ErgoP2PKHAddrEncoder, + EthAddr, + EthAddrDecoder, + EthAddrEncoder, + FilSecp256k1Addr, + FilSecp256k1AddrDecoder, + FilSecp256k1AddrEncoder, + IcxAddr, + IcxAddrDecoder, + IcxAddrEncoder, + InjAddr, + InjAddrDecoder, + InjAddrEncoder, + MvrkAddr, + MvrkAddrDecoder, + MvrkAddrEncoder, + MvrkAddrPrefixes, + NanoAddr, + NanoAddrDecoder, + NanoAddrEncoder, + NearAddr, + NearAddrDecoder, + NearAddrEncoder, + NeoAddr, + NeoAddrDecoder, + NeoAddrEncoder, + NeoLegacyAddr, + NeoLegacyAddrDecoder, + NeoLegacyAddrEncoder, + NeoN3Addr, + NeoN3AddrDecoder, + NeoN3AddrEncoder, + NimAddr, + NimAddrDecoder, + NimAddrEncoder, + OkexAddr, + OkexAddrDecoder, + OkexAddrEncoder, + OneAddr, + OneAddrDecoder, + OneAddrEncoder, + P2PKHAddr, + P2PKHAddrDecoder, + P2PKHAddrEncoder, + P2PKHPubKeyModes, + P2SHAddr, + P2SHAddrDecoder, + P2SHAddrEncoder, + P2TRAddr, + P2TRAddrDecoder, + P2TRAddrEncoder, + P2WPKHAddr, + P2WPKHAddrDecoder, + P2WPKHAddrEncoder, + SolAddr, + SolAddrDecoder, + SolAddrEncoder, + SubstrateEd25519Addr, + SubstrateEd25519AddrDecoder, + SubstrateEd25519AddrEncoder, + SubstrateSr25519Addr, + SubstrateSr25519AddrDecoder, + SubstrateSr25519AddrEncoder, + SuiAddr, + SuiAddrDecoder, + SuiAddrEncoder, + TrxAddr, + TrxAddrDecoder, + TrxAddrEncoder, + XlmAddr, + XlmAddrDecoder, + XlmAddrEncoder, + XlmAddrTypes, + XmrAddr, + XmrAddrDecoder, + XmrAddrEncoder, + XmrIntegratedAddr, + XmrIntegratedAddrDecoder, + XmrIntegratedAddrEncoder, + XrpAddr, + XrpAddrDecoder, + XrpAddrEncoder, + XtzAddr, + XtzAddrDecoder, + XtzAddrEncoder, + XtzAddrPrefixes, + ZilAddr, + ZilAddrDecoder, + ZilAddrEncoder, ) # Algorand mnemonic from bip_utils.algorand.mnemonic import ( - AlgorandEntropyBitLen, AlgorandEntropyGenerator, AlgorandLanguages, AlgorandMnemonic, AlgorandMnemonicDecoder, - AlgorandMnemonicEncoder, AlgorandMnemonicGenerator, AlgorandMnemonicValidator, AlgorandSeedGenerator, - AlgorandWordsNum + AlgorandEntropyBitLen, + AlgorandEntropyGenerator, + AlgorandLanguages, + AlgorandMnemonic, + AlgorandMnemonicDecoder, + AlgorandMnemonicEncoder, + AlgorandMnemonicGenerator, + AlgorandMnemonicValidator, + AlgorandSeedGenerator, + AlgorandWordsNum, ) # Base58 from bip_utils.base58 import ( - Base58Alphabets, Base58ChecksumError, Base58Decoder, Base58Encoder, Base58XmrDecoder, Base58XmrEncoder + Base58Alphabets, + Base58ChecksumError, + Base58Decoder, + Base58Encoder, + Base58XmrDecoder, + Base58XmrEncoder, ) # Bech32 from bip_utils.bech32 import ( - BchBech32Decoder, BchBech32Encoder, Bech32ChecksumError, Bech32Decoder, Bech32Encoder, SegwitBech32Decoder, - SegwitBech32Encoder + BchBech32Decoder, + BchBech32Encoder, + Bech32ChecksumError, + Bech32Decoder, + Bech32Encoder, + SegwitBech32Decoder, + SegwitBech32Encoder, ) # BIP32 from bip_utils.bip.bip32 import ( - Bip32ChainCode, Bip32Depth, Bip32DeserializedKey, Bip32Ed25519Blake2bSlip, Bip32Ed25519Kholaw, Bip32Ed25519Slip, - Bip32FingerPrint, Bip32KeyData, Bip32KeyDeserializer, Bip32KeyError, Bip32KeyIndex, Bip32KeyNetVersions, - Bip32KholawEd25519, Bip32Nist256p1, Bip32Path, Bip32PathError, Bip32PathParser, Bip32PrivateKey, - Bip32PrivateKeySerializer, Bip32PublicKey, Bip32PublicKeySerializer, Bip32Secp256k1, Bip32Slip10Ed25519, - Bip32Slip10Ed25519Blake2b, Bip32Slip10Nist256p1, Bip32Slip10Secp256k1, Bip32Utils + Bip32ChainCode, + Bip32Depth, + Bip32DeserializedKey, + Bip32Ed25519Blake2bSlip, + Bip32Ed25519Kholaw, + Bip32Ed25519Slip, + Bip32FingerPrint, + Bip32KeyData, + Bip32KeyDeserializer, + Bip32KeyError, + Bip32KeyIndex, + Bip32KeyNetVersions, + Bip32KholawEd25519, + Bip32Nist256p1, + Bip32Path, + Bip32PathError, + Bip32PathParser, + Bip32PrivateKey, + Bip32PrivateKeySerializer, + Bip32PublicKey, + Bip32PublicKeySerializer, + Bip32Secp256k1, + Bip32Slip10Ed25519, + Bip32Slip10Ed25519Blake2b, + Bip32Slip10Nist256p1, + Bip32Slip10Secp256k1, + Bip32Utils, ) # BIP38 @@ -59,8 +212,16 @@ # BIP39 from bip_utils.bip.bip39 import ( - Bip39EntropyBitLen, Bip39EntropyGenerator, Bip39Languages, Bip39Mnemonic, Bip39MnemonicDecoder, - Bip39MnemonicEncoder, Bip39MnemonicGenerator, Bip39MnemonicValidator, Bip39SeedGenerator, Bip39WordsNum + Bip39EntropyBitLen, + Bip39EntropyGenerator, + Bip39Languages, + Bip39Mnemonic, + Bip39MnemonicDecoder, + Bip39MnemonicEncoder, + Bip39MnemonicGenerator, + Bip39MnemonicValidator, + Bip39SeedGenerator, + Bip39WordsNum, ) from bip_utils.bip.bip44 import Bip44 @@ -92,12 +253,39 @@ # ECC from bip_utils.ecc import ( - Ed25519, Ed25519Blake2b, Ed25519Blake2bPoint, Ed25519Blake2bPrivateKey, Ed25519Blake2bPublicKey, Ed25519Kholaw, - Ed25519KholawPoint, Ed25519KholawPrivateKey, Ed25519KholawPublicKey, Ed25519Monero, Ed25519MoneroPoint, - Ed25519MoneroPrivateKey, Ed25519MoneroPublicKey, Ed25519Point, Ed25519PrivateKey, Ed25519PublicKey, - EllipticCurveGetter, EllipticCurveTypes, IPoint, IPrivateKey, IPublicKey, Nist256p1, Nist256p1Point, - Nist256p1PrivateKey, Nist256p1PublicKey, Secp256k1, Secp256k1Point, Secp256k1PrivateKey, Secp256k1PublicKey, - Sr25519, Sr25519Point, Sr25519PrivateKey, Sr25519PublicKey + Ed25519, + Ed25519Blake2b, + Ed25519Blake2bPoint, + Ed25519Blake2bPrivateKey, + Ed25519Blake2bPublicKey, + Ed25519Kholaw, + Ed25519KholawPoint, + Ed25519KholawPrivateKey, + Ed25519KholawPublicKey, + Ed25519Monero, + Ed25519MoneroPoint, + Ed25519MoneroPrivateKey, + Ed25519MoneroPublicKey, + Ed25519Point, + Ed25519PrivateKey, + Ed25519PublicKey, + EllipticCurveGetter, + EllipticCurveTypes, + IPoint, + IPrivateKey, + IPublicKey, + Nist256p1, + Nist256p1Point, + Nist256p1PrivateKey, + Nist256p1PublicKey, + Secp256k1, + Secp256k1Point, + Secp256k1PrivateKey, + Secp256k1PublicKey, + Sr25519, + Sr25519Point, + Sr25519PrivateKey, + Sr25519PublicKey, ) # Electrum wallet @@ -105,14 +293,29 @@ # Electrum mnemonic from bip_utils.electrum.mnemonic_v1 import ( - ElectrumV1EntropyBitLen, ElectrumV1EntropyGenerator, ElectrumV1Languages, ElectrumV1Mnemonic, - ElectrumV1MnemonicDecoder, ElectrumV1MnemonicEncoder, ElectrumV1MnemonicGenerator, ElectrumV1MnemonicValidator, - ElectrumV1SeedGenerator, ElectrumV1WordsNum + ElectrumV1EntropyBitLen, + ElectrumV1EntropyGenerator, + ElectrumV1Languages, + ElectrumV1Mnemonic, + ElectrumV1MnemonicDecoder, + ElectrumV1MnemonicEncoder, + ElectrumV1MnemonicGenerator, + ElectrumV1MnemonicValidator, + ElectrumV1SeedGenerator, + ElectrumV1WordsNum, ) from bip_utils.electrum.mnemonic_v2 import ( - ElectrumV2EntropyBitLen, ElectrumV2EntropyGenerator, ElectrumV2Languages, ElectrumV2Mnemonic, - ElectrumV2MnemonicDecoder, ElectrumV2MnemonicEncoder, ElectrumV2MnemonicGenerator, ElectrumV2MnemonicTypes, - ElectrumV2MnemonicValidator, ElectrumV2SeedGenerator, ElectrumV2WordsNum + ElectrumV2EntropyBitLen, + ElectrumV2EntropyGenerator, + ElectrumV2Languages, + ElectrumV2Mnemonic, + ElectrumV2MnemonicDecoder, + ElectrumV2MnemonicEncoder, + ElectrumV2MnemonicGenerator, + ElectrumV2MnemonicTypes, + ElectrumV2MnemonicValidator, + ElectrumV2SeedGenerator, + ElectrumV2WordsNum, ) # Monero @@ -123,14 +326,26 @@ # Monero mnemonic from bip_utils.monero.mnemonic import ( - MoneroEntropyBitLen, MoneroEntropyGenerator, MoneroLanguages, MoneroMnemonic, MoneroMnemonicDecoder, - MoneroMnemonicEncoder, MoneroMnemonicGenerator, MoneroMnemonicNoChecksumEncoder, MoneroMnemonicValidator, - MoneroMnemonicWithChecksumEncoder, MoneroSeedGenerator, MoneroWordsNum + MoneroEntropyBitLen, + MoneroEntropyGenerator, + MoneroLanguages, + MoneroMnemonic, + MoneroMnemonicDecoder, + MoneroMnemonicEncoder, + MoneroMnemonicGenerator, + MoneroMnemonicNoChecksumEncoder, + MoneroMnemonicValidator, + MoneroMnemonicWithChecksumEncoder, + MoneroSeedGenerator, + MoneroWordsNum, ) # SLIP32 from bip_utils.slip.slip32 import ( - Slip32DeserializedKey, Slip32KeyDeserializer, Slip32PrivateKeySerializer, Slip32PublicKeySerializer + Slip32DeserializedKey, + Slip32KeyDeserializer, + Slip32PrivateKeySerializer, + Slip32PublicKeySerializer, ) # Solana @@ -141,8 +356,14 @@ # Substrate from bip_utils.substrate import ( - Substrate, SubstrateKeyError, SubstratePath, SubstratePathElem, SubstratePathError, SubstratePathParser, - SubstratePrivateKey, SubstratePublicKey + Substrate, + SubstrateKeyError, + SubstratePath, + SubstratePathElem, + SubstratePathError, + SubstratePathParser, + SubstratePrivateKey, + SubstratePublicKey, ) # Substrate configuration @@ -153,31 +374,64 @@ # Substrate SCALE from bip_utils.substrate.scale import ( - SubstrateScaleBytesEncoder, SubstrateScaleCUintEncoder, SubstrateScaleU8Encoder, SubstrateScaleU16Encoder, - SubstrateScaleU32Encoder, SubstrateScaleU64Encoder, SubstrateScaleU128Encoder, SubstrateScaleU256Encoder + SubstrateScaleBytesEncoder, + SubstrateScaleCUintEncoder, + SubstrateScaleU8Encoder, + SubstrateScaleU16Encoder, + SubstrateScaleU32Encoder, + SubstrateScaleU64Encoder, + SubstrateScaleU128Encoder, + SubstrateScaleU256Encoder, ) +from bip_utils.ton.address.ton_address_encoder import TonAddressEncoder + +# TON +from bip_utils.ton.mnemonic import ( + TonLanguages, + TonMnemonic, + TonMnemonicGenerator, + TonMnemonicValidator, + TonSeedGenerator, +) +from bip_utils.ton.ton import Ton # Utils from bip_utils.utils.crypto import ( - AesEcbDecrypter, AesEcbEncrypter, Blake2b, Blake2b160, Blake2b224, Blake2b256, ChaCha20Poly1305, Crc32, - DoubleSha256, Hash160, HmacSha256, HmacSha512, Kekkak256, Pbkdf2HmacSha512, Ripemd160, Scrypt, Sha3_256, Sha256, - Sha512, Sha512_256, XModemCrc + AesEcbDecrypter, + AesEcbEncrypter, + Blake2b, + Blake2b160, + Blake2b224, + Blake2b256, + ChaCha20Poly1305, + Crc32, + DoubleSha256, + Hash160, + HmacSha256, + HmacSha512, + Kekkak256, + Pbkdf2HmacSha512, + Ripemd160, + Scrypt, + Sha3_256, + Sha256, + Sha512, + Sha512_256, + XModemCrc, ) from bip_utils.utils.misc import ( - AlgoUtils, Base32Decoder, Base32Encoder, BitUtils, BytesUtils, DataBytes, IntegerUtils, StringUtils + AlgoUtils, + Base32Decoder, + Base32Encoder, + BitUtils, + BytesUtils, + DataBytes, + IntegerUtils, + StringUtils, ) from bip_utils.utils.mnemonic import MnemonicChecksumError # WIF from bip_utils.wif import WifDecoder, WifEncoder, WifPubKeyModes -# TON - -from bip_utils.ton.mnemonic import ( - TonMnemonic, TonLanguages, TonSeedGenerator, TonMnemonicValidator, TonMnemonicGenerator -) -from bip_utils.ton.address.ton_address_encoder import TonAddressEncoder -from bip_utils.ton.ton import Ton - - \ No newline at end of file diff --git a/bip_utils/addr/__init__.py b/bip_utils/addr/__init__.py index 21ab7298..9f92f9cc 100644 --- a/bip_utils/addr/__init__.py +++ b/bip_utils/addr/__init__.py @@ -1,18 +1,33 @@ from bip_utils.addr.ada_byron_addr import ( - AdaByronAddrDecoder, AdaByronAddrTypes, AdaByronIcarusAddr, AdaByronIcarusAddrEncoder, AdaByronLegacyAddr, - AdaByronLegacyAddrEncoder + AdaByronAddrDecoder, + AdaByronAddrTypes, + AdaByronIcarusAddr, + AdaByronIcarusAddrEncoder, + AdaByronLegacyAddr, + AdaByronLegacyAddrEncoder, ) from bip_utils.addr.ada_shelley_addr import ( - AdaShelleyAddr, AdaShelleyAddrDecoder, AdaShelleyAddrEncoder, AdaShelleyAddrNetworkTags, AdaShelleyRewardAddr, - AdaShelleyRewardAddrDecoder, AdaShelleyRewardAddrEncoder, AdaShelleyStakingAddr, AdaShelleyStakingAddrDecoder, - AdaShelleyStakingAddrEncoder + AdaShelleyAddr, + AdaShelleyAddrDecoder, + AdaShelleyAddrEncoder, + AdaShelleyAddrNetworkTags, + AdaShelleyRewardAddr, + AdaShelleyRewardAddrDecoder, + AdaShelleyRewardAddrEncoder, + AdaShelleyStakingAddr, + AdaShelleyStakingAddrDecoder, + AdaShelleyStakingAddrEncoder, ) from bip_utils.addr.algo_addr import AlgoAddr, AlgoAddrDecoder, AlgoAddrEncoder from bip_utils.addr.aptos_addr import AptosAddr, AptosAddrDecoder, AptosAddrEncoder from bip_utils.addr.atom_addr import AtomAddr, AtomAddrDecoder, AtomAddrEncoder from bip_utils.addr.avax_addr import ( - AvaxPChainAddr, AvaxPChainAddrDecoder, AvaxPChainAddrEncoder, AvaxXChainAddr, AvaxXChainAddrDecoder, - AvaxXChainAddrEncoder + AvaxPChainAddr, + AvaxPChainAddrDecoder, + AvaxPChainAddrEncoder, + AvaxXChainAddr, + AvaxXChainAddrDecoder, + AvaxXChainAddrEncoder, ) from bip_utils.addr.bch_addr_converter import BchAddrConverter from bip_utils.addr.egld_addr import EgldAddr, EgldAddrDecoder, EgldAddrEncoder @@ -33,26 +48,45 @@ from bip_utils.addr.okex_addr import OkexAddr, OkexAddrDecoder, OkexAddrEncoder from bip_utils.addr.one_addr import OneAddr, OneAddrDecoder, OneAddrEncoder from bip_utils.addr.P2PKH_addr import ( - BchP2PKHAddr, BchP2PKHAddrDecoder, BchP2PKHAddrEncoder, P2PKHAddr, P2PKHAddrDecoder, P2PKHAddrEncoder, - P2PKHPubKeyModes + BchP2PKHAddr, + BchP2PKHAddrDecoder, + BchP2PKHAddrEncoder, + P2PKHAddr, + P2PKHAddrDecoder, + P2PKHAddrEncoder, + P2PKHPubKeyModes, ) from bip_utils.addr.P2SH_addr import ( - BchP2SHAddr, BchP2SHAddrDecoder, BchP2SHAddrEncoder, P2SHAddr, P2SHAddrDecoder, P2SHAddrEncoder + BchP2SHAddr, + BchP2SHAddrDecoder, + BchP2SHAddrEncoder, + P2SHAddr, + P2SHAddrDecoder, + P2SHAddrEncoder, ) from bip_utils.addr.P2TR_addr import P2TRAddr, P2TRAddrDecoder, P2TRAddrEncoder from bip_utils.addr.P2WPKH_addr import P2WPKHAddr, P2WPKHAddrDecoder, P2WPKHAddrEncoder from bip_utils.addr.sol_addr import SolAddr, SolAddrDecoder, SolAddrEncoder from bip_utils.addr.substrate_addr import ( - SubstrateEd25519Addr, SubstrateEd25519AddrDecoder, SubstrateEd25519AddrEncoder, SubstrateSr25519Addr, - SubstrateSr25519AddrDecoder, SubstrateSr25519AddrEncoder + SubstrateEd25519Addr, + SubstrateEd25519AddrDecoder, + SubstrateEd25519AddrEncoder, + SubstrateSr25519Addr, + SubstrateSr25519AddrDecoder, + SubstrateSr25519AddrEncoder, ) from bip_utils.addr.sui_addr import SuiAddr, SuiAddrDecoder, SuiAddrEncoder +from bip_utils.addr.ton_addr import TonAddrEncoder from bip_utils.addr.trx_addr import TrxAddr, TrxAddrDecoder, TrxAddrEncoder from bip_utils.addr.xlm_addr import XlmAddr, XlmAddrDecoder, XlmAddrEncoder, XlmAddrTypes from bip_utils.addr.xmr_addr import ( - XmrAddr, XmrAddrDecoder, XmrAddrEncoder, XmrIntegratedAddr, XmrIntegratedAddrDecoder, XmrIntegratedAddrEncoder + XmrAddr, + XmrAddrDecoder, + XmrAddrEncoder, + XmrIntegratedAddr, + XmrIntegratedAddrDecoder, + XmrIntegratedAddrEncoder, ) from bip_utils.addr.xrp_addr import XrpAddr, XrpAddrDecoder, XrpAddrEncoder from bip_utils.addr.xtz_addr import XtzAddr, XtzAddrDecoder, XtzAddrEncoder, XtzAddrPrefixes from bip_utils.addr.zil_addr import ZilAddr, ZilAddrDecoder, ZilAddrEncoder -from bip_utils.addr.ton_addr import TonAddrEncoder \ No newline at end of file diff --git a/bip_utils/addr/ton_addr.py b/bip_utils/addr/ton_addr.py index 0e3437b9..1c1f98f0 100644 --- a/bip_utils/addr/ton_addr.py +++ b/bip_utils/addr/ton_addr.py @@ -25,12 +25,10 @@ from bip_utils.addr.addr_key_validator import AddrKeyValidator from bip_utils.addr.iaddr_encoder import IAddrEncoder - from bip_utils.ecc import IPublicKey - +from bip_utils.ecc.ed25519.ed25519_keys import Ed25519KeysConst from bip_utils.ton.address.ton_address_encoder import TonAddressEncoder from bip_utils.utils.misc import BytesUtils -from bip_utils.ecc.ed25519.ed25519_keys import Ed25519KeysConst class TonAddrEncoder(IAddrEncoder): @@ -63,7 +61,7 @@ def EncodeKey(pub_key: Union[bytes, IPublicKey], and pub_key_bytes[0] == BytesUtils.ToInteger(Ed25519KeysConst.PUB_KEY_PREFIX)): pub_key_bytes = pub_key_bytes[1:] - # Get and check address version. Default is v4, which is what is current employed in trust and ledger. + # Get and check address version. Default is v4, which is what is current employed in trust and ledger. version = kwargs.get("version", "v4") # Version check is done in TonAddressEncoder, which will raise a ValueError if the version is not valid. We can skip it here to avoid code duplication. diff --git a/bip_utils/bip/conf/bip44/bip44_conf.py b/bip_utils/bip/conf/bip44/bip44_conf.py index ce6efd1d..e3b41f59 100644 --- a/bip_utils/bip/conf/bip44/bip44_conf.py +++ b/bip_utils/bip/conf/bip44/bip44_conf.py @@ -22,20 +22,62 @@ # Imports from bip_utils.addr import ( - AdaByronIcarusAddrEncoder, AlgoAddrEncoder, AptosAddrEncoder, AtomAddrEncoder, AvaxPChainAddrEncoder, - AvaxXChainAddrEncoder, BchP2PKHAddrEncoder, EgldAddrEncoder, EosAddrEncoder, ErgoNetworkTypes, ErgoP2PKHAddrEncoder, - EthAddrEncoder, FilSecp256k1AddrEncoder, IcxAddrEncoder, InjAddrEncoder, MvrkAddrEncoder, MvrkAddrPrefixes, - NanoAddrEncoder, NearAddrEncoder, NeoLegacyAddrEncoder, NeoN3AddrEncoder, NimAddrEncoder, OkexAddrEncoder, - OneAddrEncoder, P2PKHAddrEncoder, SolAddrEncoder, SubstrateEd25519AddrEncoder, SuiAddrEncoder, TonAddrEncoder, TrxAddrEncoder, - XlmAddrEncoder, XlmAddrTypes, XmrAddrEncoder, XrpAddrEncoder, XtzAddrEncoder, XtzAddrPrefixes, ZilAddrEncoder + AdaByronIcarusAddrEncoder, + AlgoAddrEncoder, + AptosAddrEncoder, + AtomAddrEncoder, + AvaxPChainAddrEncoder, + AvaxXChainAddrEncoder, + BchP2PKHAddrEncoder, + EgldAddrEncoder, + EosAddrEncoder, + ErgoNetworkTypes, + ErgoP2PKHAddrEncoder, + EthAddrEncoder, + FilSecp256k1AddrEncoder, + IcxAddrEncoder, + InjAddrEncoder, + MvrkAddrEncoder, + MvrkAddrPrefixes, + NanoAddrEncoder, + NearAddrEncoder, + NeoLegacyAddrEncoder, + NeoN3AddrEncoder, + NimAddrEncoder, + OkexAddrEncoder, + OneAddrEncoder, + P2PKHAddrEncoder, + SolAddrEncoder, + SubstrateEd25519AddrEncoder, + SuiAddrEncoder, + TonAddrEncoder, + TrxAddrEncoder, + XlmAddrEncoder, + XlmAddrTypes, + XmrAddrEncoder, + XrpAddrEncoder, + XtzAddrEncoder, + XtzAddrPrefixes, + ZilAddrEncoder, ) from bip_utils.bip.bip32 import ( - Bip32Const, Bip32KeyNetVersions, Bip32KholawEd25519, Bip32Slip10Ed25519, Bip32Slip10Ed25519Blake2b, - Bip32Slip10Nist256p1, Bip32Slip10Secp256k1 + Bip32Const, + Bip32KeyNetVersions, + Bip32KholawEd25519, + Bip32Slip10Ed25519, + Bip32Slip10Ed25519Blake2b, + Bip32Slip10Nist256p1, + Bip32Slip10Secp256k1, ) from bip_utils.bip.conf.common import ( - DER_PATH_HARDENED_FULL, DER_PATH_HARDENED_MID, DER_PATH_HARDENED_SHORT, DER_PATH_NON_HARDENED_FULL, - BipBitcoinCashConf, BipCoinConf, BipCoinFctCallsConf, BipLitecoinConf + DER_PATH_HARDENED_FULL, + DER_PATH_HARDENED_MID, + DER_PATH_HARDENED_SHORT, + DER_PATH_NON_HARDENED_FULL, + BipBitcoinCashConf, + BipCoinConf, + BipCoinFctCallsConf, + BipLitecoinConf, ) from bip_utils.cardano.bip32.cardano_icarus_bip32 import CardanoIcarusBip32 from bip_utils.coin_conf import CoinsConf diff --git a/bip_utils/ton/address/__init__.py b/bip_utils/ton/address/__init__.py index c261438d..aa07d829 100644 --- a/bip_utils/ton/address/__init__.py +++ b/bip_utils/ton/address/__init__.py @@ -1 +1 @@ -from bip_utils.ton.address.ton_address_encoder import TonAddressEncoder \ No newline at end of file +from bip_utils.ton.address.ton_address_encoder import TonAddressEncoder diff --git a/bip_utils/ton/address/ton_address_encoder.py b/bip_utils/ton/address/ton_address_encoder.py index 9a518884..b845e4e6 100644 --- a/bip_utils/ton/address/ton_address_encoder.py +++ b/bip_utils/ton/address/ton_address_encoder.py @@ -2,9 +2,11 @@ import base64 from enum import StrEnum, unique -from pytoniq_core import Cell, begin_cell, Address from typing import List +from pytoniq_core import Address, Cell, begin_cell + + wallet_versions_serialisation = { "v5r1": 0 } @@ -25,7 +27,7 @@ class TonAddressConst: # Accepted addrsess versions TON_ADDRESS_VERSIONS: List[TonAddressVerions] = [ - TonAddressVerions.V5R1, + TonAddressVerions.V5R1, TonAddressVerions.V4, TonAddressVerions.V3R2, TonAddressVerions.V3R1 @@ -40,8 +42,8 @@ class TonAddressEncoder: https://github.com/ton-org/ton/blob/main/src/wallets/v4/WalletContractV4.ts https://github.com/ton-org/ton/blob/main/src/wallets/v3/r2.ts https://github.com/ton-org/ton/blob/main/src/wallets/v3/r1.ts - """ - + """ + def __init__(self, public_key, version="v5r1", is_bounceable=False): if version not in TonAddressConst.TON_ADDRESS_VERSIONS: raise ValueError(f"Version ({version}) is not valid. Supported versions are: {', '.join(TonAddressConst.TON_ADDRESS_VERSIONS)}") @@ -50,85 +52,85 @@ def __init__(self, public_key, version="v5r1", is_bounceable=False): self.version = version def v5r1Address(self): - + wallet_details = { "workchain": 0, "walletVersion": "v5r1", "subwalletNumber": 0, "networkGlobalId": -239 } - - + + code = Cell.one_from_boc("b5ee9c7241021401000281000114ff00f4a413f4bcf2c80b01020120020d020148030402dcd020d749c120915b8f6320d70b1f2082106578746ebd21821073696e74bdb0925f03e082106578746eba8eb48020d72101d074d721fa4030fa44f828fa443058bd915be0ed44d0810141d721f4058307f40e6fa1319130e18040d721707fdb3ce03120d749810280b99130e070e2100f020120050c020120060902016e07080019adce76a2684020eb90eb85ffc00019af1df6a2684010eb90eb858fc00201480a0b0017b325fb51341c75c875c2c7e00011b262fb513435c280200019be5f0f6a2684080a0eb90fa02c0102f20e011e20d70b1f82107369676ebaf2e08a7f0f01e68ef0eda2edfb218308d722028308d723208020d721d31fd31fd31fed44d0d200d31f20d31fd3ffd70a000af90140ccf9109a28945f0adb31e1f2c087df02b35007b0f2d0845125baf2e0855036baf2e086f823bbf2d0882292f800de01a47fc8ca00cb1f01cf16c9ed542092f80fde70db3cd81003f6eda2edfb02f404216e926c218e4c0221d73930709421c700b38e2d01d72820761e436c20d749c008f2e09320d74ac002f2e09320d71d06c712c2005230b0f2d089d74cd7393001a4e86c128407bbf2e093d74ac000f2e093ed55e2d20001c000915be0ebd72c08142091709601d72c081c12e25210b1e30f20d74a111213009601fa4001fa44f828fa443058baf2e091ed44d0810141d718f405049d7fc8ca0040048307f453f2e08b8e14038307f45bf2e08c22d70a00216e01b3b0f2d090e2c85003cf1612f400c9ed54007230d72c08248e2d21f2e092d200ed44d0d2005113baf2d08f54503091319c01810140d721d70a00f2e08ee2c8ca0058cf16c9ed5493f2c08de20010935bdb31e1d74cd0b4d6c35e") - + context = begin_cell() .store_uint(1, 1)\ .store_int(wallet_details["workchain"] , 8)\ .store_uint(wallet_versions_serialisation[wallet_details["walletVersion"]], 8)\ .store_uint(wallet_details["subwalletNumber"], 15).end_cell().begin_parse().load_int(32) - + data = begin_cell().store_uint(1,1)\ .store_uint(0, 32)\ .store_int(wallet_details["networkGlobalId"] ^ context, 32)\ .store_bytes(self.public_key)\ .store_bit(0) \ .end_cell() - - + + hash_ = begin_cell().store_bit(False).store_bit(False).store_maybe_ref(code)\ .store_maybe_ref(data)\ .store_dict(None)\ .end_cell().hash - + add = Address((wallet_details["workchain"], hash_)) return add.to_str(is_bounceable=self.is_bounceable) def v4Address(self): - + wallet_details = {"workchain": 0} - + wallet_id = 698983191 + wallet_details["workchain"] code = Cell.one_from_boc(base64.b64decode("te6ccgECFAEAAtQAART/APSkE/S88sgLAQIBIAIDAgFIBAUE+PKDCNcYINMf0x/THwL4I7vyZO1E0NMf0x/T//QE0VFDuvKhUVG68qIF+QFUEGT5EPKj+AAkpMjLH1JAyx9SMMv/UhD0AMntVPgPAdMHIcAAn2xRkyDXSpbTB9QC+wDoMOAhwAHjACHAAuMAAcADkTDjDQOkyMsfEssfy/8QERITAubQAdDTAyFxsJJfBOAi10nBIJJfBOAC0x8hghBwbHVnvSKCEGRzdHK9sJJfBeAD+kAwIPpEAcjKB8v/ydDtRNCBAUDXIfQEMFyBAQj0Cm+hMbOSXwfgBdM/yCWCEHBsdWe6kjgw4w0DghBkc3RyupJfBuMNBgcCASAICQB4AfoA9AQw+CdvIjBQCqEhvvLgUIIQcGx1Z4MesXCAGFAEywUmzxZY+gIZ9ADLaRfLH1Jgyz8gyYBA+wAGAIpQBIEBCPRZMO1E0IEBQNcgyAHPFvQAye1UAXKwjiOCEGRzdHKDHrFwgBhQBcsFUAPPFiP6AhPLassfyz/JgED7AJJfA+ICASAKCwBZvSQrb2omhAgKBrkPoCGEcNQICEekk30pkQzmkD6f+YN4EoAbeBAUiYcVnzGEAgFYDA0AEbjJftRNDXCx+AA9sp37UTQgQFA1yH0BDACyMoHy//J0AGBAQj0Cm+hMYAIBIA4PABmtznaiaEAga5Drhf/AABmvHfaiaEAQa5DrhY/AAG7SB/oA1NQi+QAFyMoHFcv/ydB3dIAYyMsFywIizxZQBfoCFMtrEszMyXP7AMhAFIEBCPRR8qcCAHCBAQjXGPoA0z/IVCBHgQEI9FHyp4IQbm90ZXB0gBjIywXLAlAGzxZQBPoCFMtqEssfyz/Jc/sAAgBsgQEI1xj6ANM/MFIkgQEI9Fnyp4IQZHN0cnB0gBjIywXLAlAFzxZQA/oCE8tqyx8Syz/Jc/sAAAr0AMntVA==")) - - + + data = begin_cell()\ .store_uint(0, 32)\ .store_uint(wallet_id, 32)\ .store_bytes(self.public_key)\ .store_bit(0) \ .end_cell() - - + + hash_ = begin_cell().store_bit(False).store_bit(False).store_maybe_ref(code)\ .store_maybe_ref(data)\ .store_dict(None)\ .end_cell().hash - + add = Address((wallet_details["workchain"], hash_)) return add.to_str(is_bounceable=self.is_bounceable) def v3r2Address(self): - + wallet_details = {"workchain": 0} wallet_id = 698983191 + wallet_details["workchain"] code = Cell.one_from_boc(base64.b64decode("te6cckEBAQEAcQAA3v8AIN0gggFMl7ohggEznLqxn3Gw7UTQ0x/THzHXC//jBOCk8mCDCNcYINMf0x/TH/gjE7vyY+1E0NMf0x/T/9FRMrryoVFEuvKiBPkBVBBV+RDyo/gAkyDXSpbTB9QC+wDo0QGkyMsfyx/L/8ntVBC9ba0=")) - - + + data = begin_cell()\ .store_uint(0, 32)\ .store_uint(wallet_id, 32)\ .store_bytes(self.public_key)\ .end_cell() - - + + hash_ = begin_cell().store_bit(False).store_bit(False).store_maybe_ref(code)\ .store_maybe_ref(data)\ .store_dict(None)\ .end_cell().hash - + add = Address((wallet_details["workchain"], hash_)) return add.to_str(is_bounceable=self.is_bounceable) @@ -138,23 +140,23 @@ def v3r1Address(self): wallet_id = 698983191 + wallet_details["workchain"] code = Cell.one_from_boc(base64.b64decode("te6cckEBAQEAYgAAwP8AIN0gggFMl7qXMO1E0NcLH+Ck8mCDCNcYINMf0x/TH/gjE7vyY+1E0NMf0x/T/9FRMrryoVFEuvKiBPkBVBBV+RDyo/gAkyDXSpbTB9QC+wDo0QGkyMsfyx/L/8ntVD++buA=")) - - + + data = begin_cell()\ .store_uint(0, 32)\ .store_uint(wallet_id, 32)\ .store_bytes(self.public_key)\ .end_cell() - - + + hash_ = begin_cell().store_bit(False).store_bit(False).store_maybe_ref(code)\ .store_maybe_ref(data)\ .store_dict(None)\ .end_cell().hash - + add = Address((wallet_details["workchain"], hash_)) return add.to_str(is_bounceable=self.is_bounceable) - + def encode(self): if self.version == "v5r1": return self.v5r1Address() @@ -163,4 +165,4 @@ def encode(self): elif self.version == "v3r2": return self.v3r2Address() else: - return self.v3r1Address() \ No newline at end of file + return self.v3r1Address() diff --git a/bip_utils/ton/mnemonic/__init__.py b/bip_utils/ton/mnemonic/__init__.py index 91da3b1b..f99d691c 100644 --- a/bip_utils/ton/mnemonic/__init__.py +++ b/bip_utils/ton/mnemonic/__init__.py @@ -1,4 +1,4 @@ from bip_utils.ton.mnemonic.ton_mnemonic import TonLanguages, TonMnemonic, TonWordsNum -from bip_utils.ton.mnemonic.ton_mnemonic_validator import TonMnemonicValidator from bip_utils.ton.mnemonic.ton_mnemonic_generator import TonMnemonicGenerator +from bip_utils.ton.mnemonic.ton_mnemonic_validator import TonMnemonicValidator from bip_utils.ton.mnemonic.ton_seed_generator import TonSeedGenerator diff --git a/bip_utils/ton/mnemonic/ton_mnemonic_generator.py b/bip_utils/ton/mnemonic/ton_mnemonic_generator.py index c617c508..b7d47197 100644 --- a/bip_utils/ton/mnemonic/ton_mnemonic_generator.py +++ b/bip_utils/ton/mnemonic/ton_mnemonic_generator.py @@ -21,17 +21,14 @@ """Module for Algorand mnemonic generation.""" # Imports -from typing import Dict, Optional, Union - -from bip_utils.bip.bip39.bip39_mnemonic import Bip39Languages - -from bip_utils.ton.mnemonic.ton_mnemonic import TonWordsNum -from bip_utils.utils.mnemonic import Mnemonic import secrets -from bip_utils.bip.bip39.bip39_mnemonic import Bip39MnemonicConst -from bip_utils.ton.mnemonic.ton_mnemonic_validator import TonMnemonicValidator -from bip_utils.ton.mnemonic.ton_mnemonic import TonMnemonicConst +from typing import Optional, Union + +from bip_utils.bip.bip39.bip39_mnemonic import Bip39Languages, Bip39MnemonicConst from bip_utils.bip.bip39.bip39_mnemonic_utils import Bip39WordsListGetter +from bip_utils.ton.mnemonic.ton_mnemonic import TonMnemonicConst, TonWordsNum +from bip_utils.ton.mnemonic.ton_mnemonic_validator import TonMnemonicValidator +from bip_utils.utils.mnemonic import Mnemonic class TonMnemonicGenerator: @@ -45,7 +42,7 @@ def __init__(self) -> None: """ Construct class. """ - + def FromWordsNumber(self, words_num: Optional[Union[int, TonWordsNum]] = 24, passphrase: Optional[str] = "") -> Mnemonic: @@ -75,18 +72,18 @@ def FromWordsNumber(self, # Generate mnemonic - + mnemonic_array = [] for i in range(words_num): idx = secrets.randbelow(Bip39MnemonicConst.WORDS_LIST_NUM) mnemonic_array.append(words_list.GetWordAtIdx(idx)) - + mnemonic = " ".join(mnemonic_array) - + # If derived mnemonic is not valid continue loop and generate another one, otherwise break loop and return it if not ton_mnemonic_validator.IsValid(mnemonic, passphrase): - continue + continue break return mnemonic diff --git a/bip_utils/ton/mnemonic/ton_mnemonic_validator.py b/bip_utils/ton/mnemonic/ton_mnemonic_validator.py index 6c7f9cb3..74b36b5d 100644 --- a/bip_utils/ton/mnemonic/ton_mnemonic_validator.py +++ b/bip_utils/ton/mnemonic/ton_mnemonic_validator.py @@ -23,11 +23,11 @@ # Imports from typing import Optional - from bip_utils.bip.bip39.bip39_mnemonic import Bip39Languages +from bip_utils.bip.bip39.bip39_mnemonic_utils import Bip39WordsListGetter from bip_utils.utils.crypto.hmac import HmacSha512 from bip_utils.utils.crypto.pbkdf2 import Pbkdf2HmacSha512 -from bip_utils.bip.bip39.bip39_mnemonic_utils import Bip39WordsListGetter + class TonMnemonicValidator: """ @@ -49,7 +49,7 @@ def IsValid(self, mnemonic: str, passphrase: Optional[str] = "") -> bool: for word in mnemonic_array: try: words_list.GetWordIdx(word) - except ValueError: + except ValueError: return False if passphrase != "": seed = Pbkdf2HmacSha512().DeriveKey(entropy, "TON fast seed version", 1, 64) @@ -57,9 +57,8 @@ def IsValid(self, mnemonic: str, passphrase: Optional[str] = "") -> bool: else: seed = Pbkdf2HmacSha512().DeriveKey(entropy, "TON seed version", 390, 64) return seed[0] == 0 - - - - \ No newline at end of file + + + diff --git a/bip_utils/ton/mnemonic/ton_seed_generator.py b/bip_utils/ton/mnemonic/ton_seed_generator.py index 7003b8a0..dfb356da 100644 --- a/bip_utils/ton/mnemonic/ton_seed_generator.py +++ b/bip_utils/ton/mnemonic/ton_seed_generator.py @@ -21,12 +21,11 @@ """Module for Algorand mnemonic seed generation.""" # Imports -from symtable import Class from typing import Optional, Union -from bip_utils.utils.mnemonic import Mnemonic from bip_utils.utils.crypto.hmac import HmacSha512 from bip_utils.utils.crypto.pbkdf2 import Pbkdf2HmacSha512 +from bip_utils.utils.mnemonic import Mnemonic class TonSeedGenerator: @@ -50,7 +49,7 @@ def __init__(self, ValueError: If the mnemonic is not valid """ self.mnemonic = mnemonic if isinstance(mnemonic, str) else mnemonic.ToStr() - + def Generate(self, passphrase: Optional[str] = "") -> bytes: @@ -61,10 +60,9 @@ def Generate(self, passphrase: Optional[str] = "") -> bytes: Returns: bytes: Generated seed """ - self.entropy_bytes = HmacSha512().QuickDigest(self.mnemonic, passphrase) + self.entropy_bytes = HmacSha512().QuickDigest(self.mnemonic, passphrase) seed = Pbkdf2HmacSha512().DeriveKey(self.entropy_bytes, "TON default seed", 100000, 64) return seed - \ No newline at end of file diff --git a/bip_utils/ton/ton.py b/bip_utils/ton/ton.py index 64ebd969..90494eeb 100644 --- a/bip_utils/ton/ton.py +++ b/bip_utils/ton/ton.py @@ -24,13 +24,13 @@ from __future__ import annotations from typing import Optional - from bip_utils.ecc.ed25519.ed25519_keys import Ed25519PrivateKey from bip_utils.ton.address.ton_address_encoder import TonAddressEncoder + class Ton: - + def __init__(self): """ @@ -49,8 +49,8 @@ def FromSeed(self, seed_bytes: bytes): """ self.private_key = Ed25519PrivateKey.FromBytes(seed_bytes[:32]).UnderlyingObject() return self - - + + def GetPublicKey(self) -> bytes: """ @@ -60,7 +60,7 @@ def GetPublicKey(self) -> bytes: Ed25519PublicKey: Generated public key """ return self.private_key.verify_key.encode() - + def GetPrivateKey(self) -> bytes: """ Get private key from seed. @@ -69,7 +69,7 @@ def GetPrivateKey(self) -> bytes: Ed25519PrivateKey: Generated private key """ return self.private_key.encode() - + def GetAddress(self, version: Optional[str] = "v5r1", is_bounceable: Optional[bool] = False) -> str: """ Get address @@ -77,7 +77,7 @@ def GetAddress(self, version: Optional[str] = "v5r1", is_bounceable: Optional[bo Returns: str: Generated address """ - + public_key = self.GetPublicKey() address = TonAddressEncoder(public_key, version=version, is_bounceable=is_bounceable).encode() From 12e7b733474753b48bb1ebe6610a77fd1da2a8b9 Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Wed, 25 Feb 2026 23:52:18 +0100 Subject: [PATCH 09/66] Clean up TonSeedGenerator --- bip_utils/ton/mnemonic/ton_seed_generator.py | 39 +++++++++++++------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/bip_utils/ton/mnemonic/ton_seed_generator.py b/bip_utils/ton/mnemonic/ton_seed_generator.py index dfb356da..bac5a0d2 100644 --- a/bip_utils/ton/mnemonic/ton_seed_generator.py +++ b/bip_utils/ton/mnemonic/ton_seed_generator.py @@ -18,7 +18,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -"""Module for Algorand mnemonic seed generation.""" +"""Module for TON mnemonic seed generation.""" # Imports from typing import Optional, Union @@ -28,17 +28,27 @@ from bip_utils.utils.mnemonic import Mnemonic +class TonSeedGeneratorConst: + """Class container for TON seed generator constants.""" + + # Salt modifier for seed generation + SEED_SALT_MOD: str = "TON default seed" + # Seed length in bytes + SEED_LEN_BYTES: int = 64 + # PBKDF2 round for seed generation + SEED_PBKDF2_ROUNDS: int = 100000 + + class TonSeedGenerator: """ TON seed generator class. It generates the seed from a mnemonic. """ - m_entropy_bytes: bytes + m_mnemonic: Union[str, Mnemonic] def __init__(self, - mnemonic: Union[str, Mnemonic], - ) -> None: + mnemonic: Union[str, Mnemonic]) -> None: """ Construct class. @@ -48,21 +58,22 @@ def __init__(self, Raises: ValueError: If the mnemonic is not valid """ - self.mnemonic = mnemonic if isinstance(mnemonic, str) else mnemonic.ToStr() - - + self.m_mnemonic = mnemonic if isinstance(mnemonic, str) else mnemonic.ToStr() - def Generate(self, passphrase: Optional[str] = "") -> bytes: + def Generate(self, + passphrase: Optional[str] = "") -> bytes: """ Generate seed. The seed is the PBKDF2-HMAC-SHA512 of the entropy bytes. See https://github.com/ton-org/ton-crypto/blob/master/src/mnemonic/mnemonic.ts + Args: + passphrase (str, optional): Passphrase (empty by default) + Returns: bytes: Generated seed """ - self.entropy_bytes = HmacSha512().QuickDigest(self.mnemonic, passphrase) - - seed = Pbkdf2HmacSha512().DeriveKey(self.entropy_bytes, "TON default seed", 100000, 64) - - return seed - + entropy_bytes = HmacSha512().QuickDigest(self.m_mnemonic, passphrase) + return Pbkdf2HmacSha512().DeriveKey(entropy_bytes, + TonSeedGeneratorConst.SEED_SALT_MOD, + TonSeedGeneratorConst.SEED_PBKDF2_ROUNDS, + TonSeedGeneratorConst.SEED_LEN_BYTES) From 05a3eb7769af7bcc6a1a7a180360d70d3119bdb1 Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Thu, 26 Feb 2026 09:40:51 +0100 Subject: [PATCH 10/66] Remove useless Ton class --- bip_utils/ton/ton.py | 84 -------------------------------------------- 1 file changed, 84 deletions(-) delete mode 100644 bip_utils/ton/ton.py diff --git a/bip_utils/ton/ton.py b/bip_utils/ton/ton.py deleted file mode 100644 index 90494eeb..00000000 --- a/bip_utils/ton/ton.py +++ /dev/null @@ -1,84 +0,0 @@ -# Copyright (c) 2022 Emanuele Bellocchia -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -"""Module containing utility classes for Ton keys derivation.""" - -# Imports -from __future__ import annotations - -from typing import Optional - -from bip_utils.ecc.ed25519.ed25519_keys import Ed25519PrivateKey -from bip_utils.ton.address.ton_address_encoder import TonAddressEncoder - - -class Ton: - - - def __init__(self): - """ - Construct class. - """ - - def FromSeed(self, seed_bytes: bytes): - """ - Construct class from seed bytes. - - Args: - seed_bytes (bytes): Seed bytes - - Returns: - Private key - """ - self.private_key = Ed25519PrivateKey.FromBytes(seed_bytes[:32]).UnderlyingObject() - return self - - - - def GetPublicKey(self) -> bytes: - """ - Get public key from seed. - - Returns: - Ed25519PublicKey: Generated public key - """ - return self.private_key.verify_key.encode() - - def GetPrivateKey(self) -> bytes: - """ - Get private key from seed. - - Returns: - Ed25519PrivateKey: Generated private key - """ - return self.private_key.encode() - - def GetAddress(self, version: Optional[str] = "v5r1", is_bounceable: Optional[bool] = False) -> str: - """ - Get address - - Returns: - str: Generated address - """ - - public_key = self.GetPublicKey() - - address = TonAddressEncoder(public_key, version=version, is_bounceable=is_bounceable).encode() - return address From 58139f5bccf5fe24f8aa33f6e2015a207a9c20d6 Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Thu, 26 Feb 2026 09:40:53 +0100 Subject: [PATCH 11/66] Update __init__.py --- bip_utils/ton/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/bip_utils/ton/__init__.py b/bip_utils/ton/__init__.py index 6691b4fa..e69de29b 100644 --- a/bip_utils/ton/__init__.py +++ b/bip_utils/ton/__init__.py @@ -1 +0,0 @@ -from bip_utils.ton.ton import Ton From e383f302fb5c74e837a6528e259e1ef87e30f87f Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Thu, 26 Feb 2026 09:41:04 +0100 Subject: [PATCH 12/66] Clean up Ton mnemonic classes --- bip_utils/ton/mnemonic/ton_mnemonic.py | 2 +- .../ton/mnemonic/ton_mnemonic_generator.py | 65 +++++----- .../ton/mnemonic/ton_mnemonic_validator.py | 66 ++++++---- bip_utils/ton/mnemonic/ton_seed_generator.py | 44 +++---- bip_utils/ton/mnemonic/ton_seed_utils.py | 116 ++++++++++++++++++ 5 files changed, 215 insertions(+), 78 deletions(-) create mode 100644 bip_utils/ton/mnemonic/ton_seed_utils.py diff --git a/bip_utils/ton/mnemonic/ton_mnemonic.py b/bip_utils/ton/mnemonic/ton_mnemonic.py index 3f5b5523..8da8500d 100644 --- a/bip_utils/ton/mnemonic/ton_mnemonic.py +++ b/bip_utils/ton/mnemonic/ton_mnemonic.py @@ -18,7 +18,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -"""Module for Algorand mnemonic.""" +"""Module for TON mnemonic.""" # Imports from enum import IntEnum, unique diff --git a/bip_utils/ton/mnemonic/ton_mnemonic_generator.py b/bip_utils/ton/mnemonic/ton_mnemonic_generator.py index b7d47197..56e29250 100644 --- a/bip_utils/ton/mnemonic/ton_mnemonic_generator.py +++ b/bip_utils/ton/mnemonic/ton_mnemonic_generator.py @@ -18,15 +18,18 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -"""Module for Algorand mnemonic generation.""" +""" +Module for TON mnemonic generation. +Reference: https://github.com/ton-org/ton-crypto/blob/master/src/mnemonic/mnemonic.ts +""" # Imports import secrets -from typing import Optional, Union +from typing import Union -from bip_utils.bip.bip39.bip39_mnemonic import Bip39Languages, Bip39MnemonicConst +from bip_utils.bip.bip39.bip39_mnemonic import Bip39MnemonicConst from bip_utils.bip.bip39.bip39_mnemonic_utils import Bip39WordsListGetter -from bip_utils.ton.mnemonic.ton_mnemonic import TonMnemonicConst, TonWordsNum +from bip_utils.ton.mnemonic.ton_mnemonic import TonLanguages, TonMnemonic, TonMnemonicConst, TonWordsNum from bip_utils.ton.mnemonic.ton_mnemonic_validator import TonMnemonicValidator from bip_utils.utils.mnemonic import Mnemonic @@ -37,22 +40,33 @@ class TonMnemonicGenerator: It generates 12 or 24-words mnemonic in according to TON wallets. """ + m_lang: TonLanguages - def __init__(self) -> None: + def __init__(self, + lang: TonLanguages = TonLanguages.ENGLISH) -> None: """ Construct class. - """ + Args: + lang (TonLanguages, optional): Language (default: English) + + Raises: + TypeError: If the language is not a TonLanguages enum + ValueError: If language words list is not valid + """ + if not isinstance(lang, TonLanguages): + raise TypeError("Language is not an enumerative of TonLanguages") + self.m_lang = lang def FromWordsNumber(self, - words_num: Optional[Union[int, TonWordsNum]] = 24, passphrase: Optional[str] = "") -> Mnemonic: + words_num: Union[int, TonWordsNum] = TonWordsNum.WORDS_NUM_24, + passphrase: str = "") -> Mnemonic: """ Generate mnemonic with the specified words. - See https://github.com/ton-org/ton-crypto/blob/master/src/mnemonic/mnemonic.ts Args: - words_num (int or TonWordsNum): Number of words (12 or 24) - passphrase (str, optional): Passphrase. Default is empty string. + words_num (int or TonWordsNum, optional): Number of words (12 or 24 by default) + passphrase (str, optional): Passphrase (empty by default) Returns: Mnemonic object: Generated mnemonic @@ -60,31 +74,22 @@ def FromWordsNumber(self, Raises: ValueError: If words number is not valid """ - ton_mnemonic_validator = TonMnemonicValidator() - while True: - - # Check words number - if words_num not in TonMnemonicConst. MNEMONIC_WORD_NUM: - raise ValueError(f"Words number for mnemonic ({words_num}) is not valid") - - # Get word list - words_list = Bip39WordsListGetter().GetByLanguage(Bip39Languages.ENGLISH) - + # Check words number + if words_num not in TonMnemonicConst. MNEMONIC_WORD_NUM: + raise ValueError(f"Words number for mnemonic ({words_num}) is not valid") + mnemonic_validator = TonMnemonicValidator(self.m_lang) + words_list = Bip39WordsListGetter().GetByLanguage(self.m_lang.value) + while True: # Generate mnemonic - mnemonic_array = [] - - for i in range(words_num): + for _ in range(words_num): idx = secrets.randbelow(Bip39MnemonicConst.WORDS_LIST_NUM) mnemonic_array.append(words_list.GetWordAtIdx(idx)) - mnemonic = " ".join(mnemonic_array) - # If derived mnemonic is not valid continue loop and generate another one, otherwise break loop and return it - if not ton_mnemonic_validator.IsValid(mnemonic, passphrase): - continue - break - - return mnemonic + # Stop if generated mnemonic is valid + if mnemonic_validator.IsValid(mnemonic, passphrase): + break + return TonMnemonic(mnemonic_array) diff --git a/bip_utils/ton/mnemonic/ton_mnemonic_validator.py b/bip_utils/ton/mnemonic/ton_mnemonic_validator.py index 74b36b5d..2e658f63 100644 --- a/bip_utils/ton/mnemonic/ton_mnemonic_validator.py +++ b/bip_utils/ton/mnemonic/ton_mnemonic_validator.py @@ -18,47 +18,69 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -"""Module for Algorand mnemonic validation.""" +""" +Module for TON mnemonic validation. +Reference: https://github.com/ton-org/ton-crypto/blob/master/src/mnemonic/mnemonic.ts +""" # Imports -from typing import Optional +from typing import Union -from bip_utils.bip.bip39.bip39_mnemonic import Bip39Languages from bip_utils.bip.bip39.bip39_mnemonic_utils import Bip39WordsListGetter -from bip_utils.utils.crypto.hmac import HmacSha512 -from bip_utils.utils.crypto.pbkdf2 import Pbkdf2HmacSha512 +from bip_utils.ton.mnemonic.ton_mnemonic import TonLanguages, TonMnemonic +from bip_utils.ton.mnemonic.ton_seed_utils import TonSeedUtils +from bip_utils.utils.mnemonic.mnemonic import Mnemonic class TonMnemonicValidator: """ TON mnemonic validator class. It validates a mnemonic phrase. - See https://github.com/ton-org/ton-crypto/blob/master/src/mnemonic/mnemonic.ts """ - def __init__(self): + m_lang: TonLanguages + + def __init__(self, + lang: TonLanguages = TonLanguages.ENGLISH) -> None: """ Construct class. + + Args: + lang (TonLanguages, optional): Language (default: English) + + Raises: + TypeError: If the language is not a TonLanguages enum + ValueError: If language words list is not valid """ + if not isinstance(lang, TonLanguages): + raise TypeError("Language is not an enumerative of TonLanguages") + self.m_lang = lang + + def IsValid(self, + mnemonic: Union[str, Mnemonic], + passphrase: str = "") -> bool: + """ + Get if the specified mnemonic is valid. + + Args: + mnemonic (str or Mnemonic object): Mnemonic + passphrase (str, optional): Passphrase (empty by default) + Returns: + bool: True if valid, False otherwise + """ + mnemonic_obj = TonMnemonic.FromString(mnemonic) if isinstance(mnemonic, str) else mnemonic - def IsValid(self, mnemonic: str, passphrase: Optional[str] = "") -> bool: - entropy = HmacSha512().QuickDigest(mnemonic, passphrase) - mnemonic_array = mnemonic.split(" ") - words_list = Bip39WordsListGetter().GetByLanguage(Bip39Languages.ENGLISH) - for word in mnemonic_array: + # Check words + words_list = Bip39WordsListGetter().GetByLanguage(self.m_lang.value) + mnemonic_list = mnemonic_obj.ToList() + for word in mnemonic_list: try: words_list.GetWordIdx(word) except ValueError: return False + # Check seed + entropy_bytes = TonSeedUtils.GetEntropyBytes(mnemonic_obj.ToStr(), passphrase) if passphrase != "": - seed = Pbkdf2HmacSha512().DeriveKey(entropy, "TON fast seed version", 1, 64) - return seed[0] == 1 - else: - seed = Pbkdf2HmacSha512().DeriveKey(entropy, "TON seed version", 390, 64) - return seed[0] == 0 - - - - - + return TonSeedUtils.IsPasswordSeed(entropy_bytes) + return TonSeedUtils.IsBasicSeed(entropy_bytes) diff --git a/bip_utils/ton/mnemonic/ton_seed_generator.py b/bip_utils/ton/mnemonic/ton_seed_generator.py index bac5a0d2..a0cd2f5c 100644 --- a/bip_utils/ton/mnemonic/ton_seed_generator.py +++ b/bip_utils/ton/mnemonic/ton_seed_generator.py @@ -18,53 +18,50 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -"""Module for TON mnemonic seed generation.""" +""" +Module for TON mnemonic seed generation. +Reference: https://github.com/ton-org/ton-crypto/blob/master/src/mnemonic/mnemonic.ts +""" # Imports -from typing import Optional, Union +from typing import Union -from bip_utils.utils.crypto.hmac import HmacSha512 -from bip_utils.utils.crypto.pbkdf2 import Pbkdf2HmacSha512 +from bip_utils.ton.mnemonic.ton_mnemonic import TonLanguages +from bip_utils.ton.mnemonic.ton_mnemonic_validator import TonMnemonicValidator +from bip_utils.ton.mnemonic.ton_seed_utils import TonSeedUtils from bip_utils.utils.mnemonic import Mnemonic -class TonSeedGeneratorConst: - """Class container for TON seed generator constants.""" - - # Salt modifier for seed generation - SEED_SALT_MOD: str = "TON default seed" - # Seed length in bytes - SEED_LEN_BYTES: int = 64 - # PBKDF2 round for seed generation - SEED_PBKDF2_ROUNDS: int = 100000 - - class TonSeedGenerator: """ TON seed generator class. It generates the seed from a mnemonic. """ - m_mnemonic: Union[str, Mnemonic] + m_mnemonic: str def __init__(self, - mnemonic: Union[str, Mnemonic]) -> None: + mnemonic: Union[str, Mnemonic], + lang: TonLanguages = TonLanguages.ENGLISH) -> None: """ Construct class. Args: mnemonic (str or Mnemonic object) : Mnemonic + lang (TonLanguages, optional): Language (default: English) Raises: ValueError: If the mnemonic is not valid """ - self.m_mnemonic = mnemonic if isinstance(mnemonic, str) else mnemonic.ToStr() + mnemonic_str = mnemonic if isinstance(mnemonic, str) else mnemonic.ToStr() + if not TonMnemonicValidator(lang).IsValid(mnemonic_str): + raise ValueError(f"Invalid mnemonic {mnemonic_str}") + self.m_mnemonic = mnemonic_str def Generate(self, - passphrase: Optional[str] = "") -> bytes: + passphrase: str = "") -> bytes: """ Generate seed. The seed is the PBKDF2-HMAC-SHA512 of the entropy bytes. - See https://github.com/ton-org/ton-crypto/blob/master/src/mnemonic/mnemonic.ts Args: passphrase (str, optional): Passphrase (empty by default) @@ -72,8 +69,5 @@ def Generate(self, Returns: bytes: Generated seed """ - entropy_bytes = HmacSha512().QuickDigest(self.m_mnemonic, passphrase) - return Pbkdf2HmacSha512().DeriveKey(entropy_bytes, - TonSeedGeneratorConst.SEED_SALT_MOD, - TonSeedGeneratorConst.SEED_PBKDF2_ROUNDS, - TonSeedGeneratorConst.SEED_LEN_BYTES) + entropy_bytes = TonSeedUtils.GetEntropyBytes(self.m_mnemonic, passphrase) + return TonSeedUtils.GetDefaultSeed(entropy_bytes) diff --git a/bip_utils/ton/mnemonic/ton_seed_utils.py b/bip_utils/ton/mnemonic/ton_seed_utils.py new file mode 100644 index 00000000..2f932cf7 --- /dev/null +++ b/bip_utils/ton/mnemonic/ton_seed_utils.py @@ -0,0 +1,116 @@ +# Copyright (c) 2021 Emanuele Bellocchia +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +""" +Module for TON seed utilities. +Reference: https://github.com/ton-org/ton-crypto/blob/master/src/mnemonic/mnemonic.ts +""" + +# Imports +from bip_utils.utils.crypto.hmac import HmacSha512 +from bip_utils.utils.crypto.pbkdf2 import Pbkdf2HmacSha512 + + +class TonSeedUtilsConst: + """Class container for TON mnemonic validator constants.""" + + # Password seed + PASSWORD_SEED_SALT_MOD: str = "TON fast seed version" + PASSWORD_SEED_PBKDF2_ROUNDS: int = 1 + # Basic seed + BASIC_SEED_SALT_MOD: str = "TON seed version" + BASIC_SEED_PBKDF2_ROUNDS: int = 100000 // 256 + # Default seed + DEF_SEED_SALT_MOD: str = "TON default seed" + DEF_SEED_PBKDF2_ROUNDS: int = 100000 + # Seed length in bytes + SEED_LEN_BYTES: int = 64 + + +class TonSeedUtils: + """ + TON seed utilities class. + It provides some utility functions for the seed generation and validation. + """ + + @staticmethod + def GetEntropyBytes(mnemonic: str, + passphrase: str = "") -> bytes: + """ + Get entropy bytes from mnemonic and passphrase. + + Args: + mnemonic (str or Mnemonic object): Mnemonic + passphrase (str, optional): Passphrase (empty by default) + + Returns: + bytes: Entropy bytes + """ + return HmacSha512().QuickDigest(mnemonic, passphrase) + + @staticmethod + def GetDefaultSeed(entropy_bytes: bytes) -> bytes: + """ + Get the default seed from entropy bytes. + + Args: + entropy_bytes (bytes): Entropy bytes + + Returns: + bytes: Default seed bytes + """ + return Pbkdf2HmacSha512().DeriveKey(entropy_bytes, + TonSeedUtilsConst.DEF_SEED_SALT_MOD, + TonSeedUtilsConst.DEF_SEED_PBKDF2_ROUNDS, + TonSeedUtilsConst.SEED_LEN_BYTES) + + @staticmethod + def IsBasicSeed(entropy_bytes: bytes) -> bool: + """ + Get if the entropy bytes are for a basic seed. + + Args: + entropy_bytes (bytes): Entropy bytes to validate + + Returns: + bool: True if the entropy bytes are for a basic seed, False otherwise + """ + seed_bytes = Pbkdf2HmacSha512().DeriveKey(entropy_bytes, + TonSeedUtilsConst.BASIC_SEED_SALT_MOD, + TonSeedUtilsConst.BASIC_SEED_PBKDF2_ROUNDS, + TonSeedUtilsConst.SEED_LEN_BYTES) + return seed_bytes[0] == 0 + + @staticmethod + def IsPasswordSeed(entropy_bytes: bytes) -> bool: + """ + Get if the entropy bytes are for a password seed. + + Args: + entropy_bytes (bytes): Entropy bytes to validate + + Returns: + bool: True if the entropy bytes are for a password seed, False otherwise + """ + seed_bytes = Pbkdf2HmacSha512().DeriveKey(entropy_bytes, + TonSeedUtilsConst.PASSWORD_SEED_SALT_MOD, + TonSeedUtilsConst.PASSWORD_SEED_PBKDF2_ROUNDS, + TonSeedUtilsConst.SEED_LEN_BYTES) + return seed_bytes[0] == 1 From 24bd06cd555f383c2a517a34d99a77a5a3523935 Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Thu, 26 Feb 2026 09:41:59 +0100 Subject: [PATCH 13/66] Update ton.py --- examples/ton.py | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/examples/ton.py b/examples/ton.py index 8578f249..f6b8912a 100644 --- a/examples/ton.py +++ b/examples/ton.py @@ -1,7 +1,11 @@ -from bip_utils import TonSeedGenerator, TonMnemonicGenerator, TonMnemonicValidator, Ton +"""Example of mnemonic generation and key derivation for TON.""" -# Generate mnemonic for Ton wallets such as Tonkeeper +from bip_utils import ( + Bip32Ed25519Slip, Bip39SeedGenerator, Bip44, Bip44Coins, Bip44ConfGetter, + TonSeedGenerator, TonMnemonicGenerator, TonMnemonicValidator, Ton +) +# Generate mnemonic for Ton wallets (e.g. Tonkeeper) mnemonic = TonMnemonicGenerator().FromWordsNumber(24) print(f"Mnemonic: {mnemonic}") @@ -10,7 +14,6 @@ print(f"Is the mnemonic valid? {is_valid}") # Generate seed and address from memonic - seed = TonSeedGenerator(mnemonic).Generate() # Default address type is v5r1 @@ -22,10 +25,7 @@ print(f"V4 Address: {addr_v4}") -# Generate addresses based on bip44 such as Trustwallet or Ledger - -from bip_utils import Bip32Ed25519Slip, Bip39SeedGenerator, Bip44, Bip44Coins, Bip44ConfGetter - +# Generate addresses based on bip44 (e.g. Trustwallet or Ledger) # Mnemonic mnemonic = "bachelor neither fall observe flee give sniff rebel access maximum property beach" @@ -35,8 +35,8 @@ coin_type = Bip44Coins.TON # Get address using the Trustwallet derivation path -bip44_mst= Bip44.FromSeed(seed_bytes, coin_type) -bip44_acc= bip44_mst.Purpose().Coin().Account(0) +bip44_mst = Bip44.FromSeed(seed_bytes, coin_type) +bip44_acc = bip44_mst.Purpose().Coin().Account(0) addr = bip44_acc.PublicKey().ToAddress() print(f"Address using Trustwallet derivation path: {addr}") @@ -46,14 +46,11 @@ coin_idx = Bip44ConfGetter.GetConfig(coin_type).CoinIndex() # Account index account_idx = 0 -derivation_path = f"m/44'/{coin_idx}'/0'/0'/{account_idx}'/0'" +derivation_path = f"m/44'/{coin_idx}'/0'/0'/{account_idx}'/0'" bip32_ctx = Bip32Ed25519Slip.FromSeed(seed_bytes).DerivePath(derivation_path) priv_key_bytes = bip32_ctx.PrivateKey().Raw().ToBytes() - bip44_ctx = Bip44.FromPrivateKey(priv_key_bytes, coin_type) - addr = bip44_ctx.PublicKey().ToAddress() - print(f"Address using Ledger derivation path: {addr}") From 47ff699d2341490cc0110aec75fb7d5ec0f21c45 Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Thu, 26 Feb 2026 09:44:52 +0100 Subject: [PATCH 14/66] Update __init__.py --- bip_utils/__init__.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/bip_utils/__init__.py b/bip_utils/__init__.py index 8ed649d2..8e719411 100644 --- a/bip_utils/__init__.py +++ b/bip_utils/__init__.py @@ -393,7 +393,6 @@ TonMnemonicValidator, TonSeedGenerator, ) -from bip_utils.ton.ton import Ton # Utils from bip_utils.utils.crypto import ( @@ -433,5 +432,3 @@ # WIF from bip_utils.wif import WifDecoder, WifEncoder, WifPubKeyModes - - From baec7282822ca0d5b5614a61c51a8d64496a5466 Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Thu, 26 Feb 2026 09:45:21 +0100 Subject: [PATCH 15/66] Update ton.py --- examples/ton.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/ton.py b/examples/ton.py index f6b8912a..9377bf30 100644 --- a/examples/ton.py +++ b/examples/ton.py @@ -2,7 +2,7 @@ from bip_utils import ( Bip32Ed25519Slip, Bip39SeedGenerator, Bip44, Bip44Coins, Bip44ConfGetter, - TonSeedGenerator, TonMnemonicGenerator, TonMnemonicValidator, Ton + TonSeedGenerator, TonMnemonicGenerator, TonMnemonicValidator ) # Generate mnemonic for Ton wallets (e.g. Tonkeeper) From 690215705e43ac23fb8177aab59c59c95d579c44 Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Thu, 26 Feb 2026 10:02:25 +0100 Subject: [PATCH 16/66] Restore and clean up Ton class --- bip_utils/__init__.py | 1 + bip_utils/ton/__init__.py | 1 + bip_utils/ton/ton.py | 113 ++++++++++++++++++++++++++++++++++++++ examples/ton.py | 8 +-- 4 files changed, 119 insertions(+), 4 deletions(-) create mode 100644 bip_utils/ton/ton.py diff --git a/bip_utils/__init__.py b/bip_utils/__init__.py index 8e719411..0e657acf 100644 --- a/bip_utils/__init__.py +++ b/bip_utils/__init__.py @@ -383,6 +383,7 @@ SubstrateScaleU128Encoder, SubstrateScaleU256Encoder, ) +from bip_utils.ton import Ton from bip_utils.ton.address.ton_address_encoder import TonAddressEncoder # TON diff --git a/bip_utils/ton/__init__.py b/bip_utils/ton/__init__.py index e69de29b..6691b4fa 100644 --- a/bip_utils/ton/__init__.py +++ b/bip_utils/ton/__init__.py @@ -0,0 +1 @@ +from bip_utils.ton.ton import Ton diff --git a/bip_utils/ton/ton.py b/bip_utils/ton/ton.py new file mode 100644 index 00000000..6e418609 --- /dev/null +++ b/bip_utils/ton/ton.py @@ -0,0 +1,113 @@ +# Copyright (c) 2022 Emanuele Bellocchia +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +"""Module containing utility classes for Ton keys derivation.""" + +# Imports +from __future__ import annotations + +from typing import Union + +from bip_utils.ecc.common.ikeys import IPrivateKey, IPublicKey +from bip_utils.ecc.ed25519.ed25519_keys import Ed25519PrivateKey, Ed25519PublicKey +from bip_utils.ton.address.ton_address_encoder import TonAddressEncoder + + +class Ton: + """ + TON class. + It allows to generate keys and addresses for TON wallets such as Tonkeeper. + It also allows to generate addresses based on bip44 such as Trustwallet or Ledger. + """ + + m_priv_key: IPrivateKey + m_pub_key: IPublicKey + + @classmethod + def FromSeed(cls, + seed_bytes: bytes) -> Ton: + """ + Construct class from seed bytes. + + Args: + seed_bytes (bytes): Seed bytes + + Returns: + Ton object: Ton object + + Raises: + ValueError: If key bytes are not valid + """ + return cls(Ed25519PrivateKey.FromBytes(seed_bytes[:32])) + + def __init__(self, + priv_key: Union[bytes, IPrivateKey]) -> None: + """ + Construct class. + + Args: + priv_key (Union[bytes, IPrivateKey]): Private key bytes or object + + Raises: + ValueError: If key bytes are not valid + TypeError: If private key is not an Ed25519PrivateKey objec + """ + if isinstance(priv_key, bytes): + priv_key = Ed25519PrivateKey.FromBytes(priv_key) + if not isinstance(priv_key, Ed25519PrivateKey): + raise TypeError("Private key is not an Ed25519PrivateKey object or bytes") + + self.m_priv_key = priv_key + self.m_pub_key = priv_key.PublicKey() + + def PublicKey(self) -> IPublicKey: + """ + Return public key object. + + Returns: + IPublicKey object: IPublicKey object + """ + return self.m_pub_key + + def PrivateKey(self) -> IPrivateKey: + """ + Return private key object. + + Returns: + IPrivateKey object: IPrivateKey object + """ + return self.m_priv_key + + def GetAddress(self, + version: str = "v5r1", + is_bounceable: bool = False) -> str: + """ + Get address from public key. + + Args: + version (str, optional): Address version (default: v5r1) + is_bounceable (bool, optional): Whether the address is bounceable (default: False) + + Returns: + str: Generated address + """ + return TonAddressEncoder(self.m_pub_key.RawUncompressed().ToBytes()[1:], + version, + is_bounceable).encode() diff --git a/examples/ton.py b/examples/ton.py index 9377bf30..7b103fa0 100644 --- a/examples/ton.py +++ b/examples/ton.py @@ -2,7 +2,7 @@ from bip_utils import ( Bip32Ed25519Slip, Bip39SeedGenerator, Bip44, Bip44Coins, Bip44ConfGetter, - TonSeedGenerator, TonMnemonicGenerator, TonMnemonicValidator + TonSeedGenerator, TonMnemonicGenerator, TonMnemonicValidator, Ton ) # Generate mnemonic for Ton wallets (e.g. Tonkeeper) @@ -14,14 +14,14 @@ print(f"Is the mnemonic valid? {is_valid}") # Generate seed and address from memonic -seed = TonSeedGenerator(mnemonic).Generate() +seed_bytes = TonSeedGenerator(mnemonic).Generate() # Default address type is v5r1 -addr = Ton().FromSeed(seed).GetAddress() +addr = Ton.FromSeed(seed_bytes).GetAddress() print(f"V5R1 Address: {addr}") # Generate v4 address -addr_v4 = Ton().FromSeed(seed).GetAddress("v4") +addr_v4 = Ton.FromSeed(seed_bytes).GetAddress("v4") print(f"V4 Address: {addr_v4}") From 1d18d66bb9b0e800096c02047fd7301c7448fc24 Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Thu, 26 Feb 2026 10:02:34 +0100 Subject: [PATCH 17/66] Minor changes --- bip_utils/ton/mnemonic/ton_mnemonic.py | 3 +++ bip_utils/ton/mnemonic/ton_mnemonic_generator.py | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/bip_utils/ton/mnemonic/ton_mnemonic.py b/bip_utils/ton/mnemonic/ton_mnemonic.py index 8da8500d..dae689a0 100644 --- a/bip_utils/ton/mnemonic/ton_mnemonic.py +++ b/bip_utils/ton/mnemonic/ton_mnemonic.py @@ -25,6 +25,7 @@ from typing import List from bip_utils.bip.bip39 import Bip39Languages, Bip39Mnemonic +from bip_utils.bip.bip39.bip39_mnemonic import Bip39MnemonicConst from bip_utils.utils.mnemonic import MnemonicLanguages @@ -51,6 +52,8 @@ class TonMnemonicConst: TonWordsNum.WORDS_NUM_12, TonWordsNum.WORDS_NUM_24, ] + # Total number of words + WORDS_LIST_NUM: int = Bip39MnemonicConst.WORDS_LIST_NUM class TonMnemonic(Bip39Mnemonic): diff --git a/bip_utils/ton/mnemonic/ton_mnemonic_generator.py b/bip_utils/ton/mnemonic/ton_mnemonic_generator.py index 56e29250..04f3075d 100644 --- a/bip_utils/ton/mnemonic/ton_mnemonic_generator.py +++ b/bip_utils/ton/mnemonic/ton_mnemonic_generator.py @@ -27,7 +27,6 @@ import secrets from typing import Union -from bip_utils.bip.bip39.bip39_mnemonic import Bip39MnemonicConst from bip_utils.bip.bip39.bip39_mnemonic_utils import Bip39WordsListGetter from bip_utils.ton.mnemonic.ton_mnemonic import TonLanguages, TonMnemonic, TonMnemonicConst, TonWordsNum from bip_utils.ton.mnemonic.ton_mnemonic_validator import TonMnemonicValidator @@ -84,7 +83,7 @@ def FromWordsNumber(self, # Generate mnemonic mnemonic_array = [] for _ in range(words_num): - idx = secrets.randbelow(Bip39MnemonicConst.WORDS_LIST_NUM) + idx = secrets.randbelow(TonMnemonicConst.WORDS_LIST_NUM) mnemonic_array.append(words_list.GetWordAtIdx(idx)) mnemonic = " ".join(mnemonic_array) From 05f391548eac2cf7b810e180d40fd4c8d7501e7d Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Thu, 26 Feb 2026 10:06:59 +0100 Subject: [PATCH 18/66] Remove infinite loop --- bip_utils/ton/mnemonic/ton_mnemonic_generator.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/bip_utils/ton/mnemonic/ton_mnemonic_generator.py b/bip_utils/ton/mnemonic/ton_mnemonic_generator.py index 04f3075d..3213551c 100644 --- a/bip_utils/ton/mnemonic/ton_mnemonic_generator.py +++ b/bip_utils/ton/mnemonic/ton_mnemonic_generator.py @@ -33,6 +33,13 @@ from bip_utils.utils.mnemonic import Mnemonic +class TonMnemonicGeneratorConst: + """Class container for TON mnemonic generator constants.""" + + # Max attempts to generate a valid mnemonic + MAX_ATTEMPTS: int = 10**6 + + class TonMnemonicGenerator: """ TON mnemonic generator class. @@ -71,7 +78,7 @@ def FromWordsNumber(self, Mnemonic object: Generated mnemonic Raises: - ValueError: If words number is not valid + ValueError: If words number is not valid or if unable to generate a valid mnemonic """ # Check words number if words_num not in TonMnemonicConst. MNEMONIC_WORD_NUM: @@ -79,7 +86,7 @@ def FromWordsNumber(self, mnemonic_validator = TonMnemonicValidator(self.m_lang) words_list = Bip39WordsListGetter().GetByLanguage(self.m_lang.value) - while True: + for _ in range(TonMnemonicGeneratorConst.MAX_ATTEMPTS): # Generate mnemonic mnemonic_array = [] for _ in range(words_num): @@ -89,6 +96,6 @@ def FromWordsNumber(self, # Stop if generated mnemonic is valid if mnemonic_validator.IsValid(mnemonic, passphrase): - break + return TonMnemonic(mnemonic_array) - return TonMnemonic(mnemonic_array) + raise ValueError("Unable to generate a valid mnemonic") From 60e67e0f60cdda293885d14068a1324a209f1671 Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Thu, 26 Feb 2026 10:19:40 +0100 Subject: [PATCH 19/66] Fix mnemonic generation with passphrase in according to Ton source --- bip_utils/ton/mnemonic/ton_mnemonic_generator.py | 10 +++++++--- bip_utils/ton/mnemonic/ton_mnemonic_validator.py | 5 ++--- bip_utils/ton/mnemonic/ton_seed_utils.py | 16 ++++++++++++++++ 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/bip_utils/ton/mnemonic/ton_mnemonic_generator.py b/bip_utils/ton/mnemonic/ton_mnemonic_generator.py index 3213551c..da2a3229 100644 --- a/bip_utils/ton/mnemonic/ton_mnemonic_generator.py +++ b/bip_utils/ton/mnemonic/ton_mnemonic_generator.py @@ -30,6 +30,7 @@ from bip_utils.bip.bip39.bip39_mnemonic_utils import Bip39WordsListGetter from bip_utils.ton.mnemonic.ton_mnemonic import TonLanguages, TonMnemonic, TonMnemonicConst, TonWordsNum from bip_utils.ton.mnemonic.ton_mnemonic_validator import TonMnemonicValidator +from bip_utils.ton.mnemonic.ton_seed_utils import TonSeedUtils from bip_utils.utils.mnemonic import Mnemonic @@ -84,7 +85,6 @@ def FromWordsNumber(self, if words_num not in TonMnemonicConst. MNEMONIC_WORD_NUM: raise ValueError(f"Words number for mnemonic ({words_num}) is not valid") - mnemonic_validator = TonMnemonicValidator(self.m_lang) words_list = Bip39WordsListGetter().GetByLanguage(self.m_lang.value) for _ in range(TonMnemonicGeneratorConst.MAX_ATTEMPTS): # Generate mnemonic @@ -95,7 +95,11 @@ def FromWordsNumber(self, mnemonic = " ".join(mnemonic_array) # Stop if generated mnemonic is valid - if mnemonic_validator.IsValid(mnemonic, passphrase): - return TonMnemonic(mnemonic_array) + if passphrase != "": + if TonSeedUtils.IsPasswordNeeded(mnemonic): + return TonMnemonic(mnemonic_array) + else: + if TonSeedUtils.IsBasicSeed(TonSeedUtils.GetEntropyBytes(mnemonic, passphrase)): + return TonMnemonic(mnemonic_array) raise ValueError("Unable to generate a valid mnemonic") diff --git a/bip_utils/ton/mnemonic/ton_mnemonic_validator.py b/bip_utils/ton/mnemonic/ton_mnemonic_validator.py index 2e658f63..9decdde4 100644 --- a/bip_utils/ton/mnemonic/ton_mnemonic_validator.py +++ b/bip_utils/ton/mnemonic/ton_mnemonic_validator.py @@ -80,7 +80,6 @@ def IsValid(self, except ValueError: return False # Check seed - entropy_bytes = TonSeedUtils.GetEntropyBytes(mnemonic_obj.ToStr(), passphrase) if passphrase != "": - return TonSeedUtils.IsPasswordSeed(entropy_bytes) - return TonSeedUtils.IsBasicSeed(entropy_bytes) + return TonSeedUtils.IsPasswordNeeded(mnemonic_obj.ToStr()) + return TonSeedUtils.IsBasicSeed(TonSeedUtils.GetEntropyBytes(mnemonic_obj.ToStr(), passphrase)) diff --git a/bip_utils/ton/mnemonic/ton_seed_utils.py b/bip_utils/ton/mnemonic/ton_seed_utils.py index 2f932cf7..a3088a8d 100644 --- a/bip_utils/ton/mnemonic/ton_seed_utils.py +++ b/bip_utils/ton/mnemonic/ton_seed_utils.py @@ -65,6 +65,22 @@ def GetEntropyBytes(mnemonic: str, """ return HmacSha512().QuickDigest(mnemonic, passphrase) + @classmethod + def IsPasswordNeeded(cls, + mnemonic: str) -> bool: + """ + Get if the mnemonic needs a password. + + Args: + mnemonic (str): Mnemonic to check + + Returns: + bool: True if the mnemonic needs a password, False otherwise + """ + # Use entropy bytes without passphrase in according to Ton source code + entropy_bytes = cls.GetEntropyBytes(mnemonic) + return cls.IsPasswordSeed(entropy_bytes) and not cls.IsBasicSeed(entropy_bytes) + @staticmethod def GetDefaultSeed(entropy_bytes: bytes) -> bytes: """ From 25cc52f29ac6a7522aa90dade289642b3d18c2e7 Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Thu, 26 Feb 2026 10:20:12 +0100 Subject: [PATCH 20/66] Run ruff --- bip_utils/ton/mnemonic/ton_mnemonic_generator.py | 6 ++---- bip_utils/ton/ton.py | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/bip_utils/ton/mnemonic/ton_mnemonic_generator.py b/bip_utils/ton/mnemonic/ton_mnemonic_generator.py index da2a3229..dfeaa250 100644 --- a/bip_utils/ton/mnemonic/ton_mnemonic_generator.py +++ b/bip_utils/ton/mnemonic/ton_mnemonic_generator.py @@ -29,7 +29,6 @@ from bip_utils.bip.bip39.bip39_mnemonic_utils import Bip39WordsListGetter from bip_utils.ton.mnemonic.ton_mnemonic import TonLanguages, TonMnemonic, TonMnemonicConst, TonWordsNum -from bip_utils.ton.mnemonic.ton_mnemonic_validator import TonMnemonicValidator from bip_utils.ton.mnemonic.ton_seed_utils import TonSeedUtils from bip_utils.utils.mnemonic import Mnemonic @@ -98,8 +97,7 @@ def FromWordsNumber(self, if passphrase != "": if TonSeedUtils.IsPasswordNeeded(mnemonic): return TonMnemonic(mnemonic_array) - else: - if TonSeedUtils.IsBasicSeed(TonSeedUtils.GetEntropyBytes(mnemonic, passphrase)): - return TonMnemonic(mnemonic_array) + elif TonSeedUtils.IsBasicSeed(TonSeedUtils.GetEntropyBytes(mnemonic, passphrase)): + return TonMnemonic(mnemonic_array) raise ValueError("Unable to generate a valid mnemonic") diff --git a/bip_utils/ton/ton.py b/bip_utils/ton/ton.py index 6e418609..f2f956db 100644 --- a/bip_utils/ton/ton.py +++ b/bip_utils/ton/ton.py @@ -26,7 +26,7 @@ from typing import Union from bip_utils.ecc.common.ikeys import IPrivateKey, IPublicKey -from bip_utils.ecc.ed25519.ed25519_keys import Ed25519PrivateKey, Ed25519PublicKey +from bip_utils.ecc.ed25519.ed25519_keys import Ed25519PrivateKey from bip_utils.ton.address.ton_address_encoder import TonAddressEncoder From 8687c78ac548b953cac89954b65502a0a19eefb5 Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Thu, 26 Feb 2026 10:34:07 +0100 Subject: [PATCH 21/66] Add different seeds support --- bip_utils/ton/mnemonic/ton_seed_generator.py | 19 ++++- bip_utils/ton/mnemonic/ton_seed_utils.py | 87 ++++++++++++-------- 2 files changed, 69 insertions(+), 37 deletions(-) diff --git a/bip_utils/ton/mnemonic/ton_seed_generator.py b/bip_utils/ton/mnemonic/ton_seed_generator.py index a0cd2f5c..9711bae7 100644 --- a/bip_utils/ton/mnemonic/ton_seed_generator.py +++ b/bip_utils/ton/mnemonic/ton_seed_generator.py @@ -24,6 +24,7 @@ """ # Imports +from enum import Enum, auto, unique from typing import Union from bip_utils.ton.mnemonic.ton_mnemonic import TonLanguages @@ -32,6 +33,14 @@ from bip_utils.utils.mnemonic import Mnemonic +@unique +class TonSeedTypes(Enum): + """Enumerative for TON seed types.""" + + HD_KEY = auto() + PRIVATE_KEY = auto() + + class TonSeedGenerator: """ TON seed generator class. @@ -59,15 +68,19 @@ def __init__(self, self.m_mnemonic = mnemonic_str def Generate(self, - passphrase: str = "") -> bytes: + passphrase: str = "", + seed_type: TonSeedTypes = TonSeedTypes.PRIVATE_KEY) -> bytes: """ - Generate seed. The seed is the PBKDF2-HMAC-SHA512 of the entropy bytes. + Generate seed. Args: passphrase (str, optional): Passphrase (empty by default) + seed_type (TonSeedTypes, optional): Seed type (PRIVATE_KEY by default) Returns: bytes: Generated seed """ entropy_bytes = TonSeedUtils.GetEntropyBytes(self.m_mnemonic, passphrase) - return TonSeedUtils.GetDefaultSeed(entropy_bytes) + if seed_type == TonSeedTypes.PRIVATE_KEY: + return TonSeedUtils.GetPrivateKeySeed(entropy_bytes) + return TonSeedUtils.GetHdKeySeed(entropy_bytes) diff --git a/bip_utils/ton/mnemonic/ton_seed_utils.py b/bip_utils/ton/mnemonic/ton_seed_utils.py index a3088a8d..ccfe945d 100644 --- a/bip_utils/ton/mnemonic/ton_seed_utils.py +++ b/bip_utils/ton/mnemonic/ton_seed_utils.py @@ -37,9 +37,12 @@ class TonSeedUtilsConst: # Basic seed BASIC_SEED_SALT_MOD: str = "TON seed version" BASIC_SEED_PBKDF2_ROUNDS: int = 100000 // 256 - # Default seed - DEF_SEED_SALT_MOD: str = "TON default seed" - DEF_SEED_PBKDF2_ROUNDS: int = 100000 + # Private key seed + PRIV_KEY_SEED_SALT_MOD: str = "TON default seed" + PRIV_KEY_SEED_PBKDF2_ROUNDS: int = 100000 + # HD key seed + HD_KEY_SEED_SALT_MOD: str = "TON HD Keys seed" + HD_KEY_SEED_PBKDF2_ROUNDS: int = 100000 # Seed length in bytes SEED_LEN_BYTES: int = 64 @@ -65,6 +68,40 @@ def GetEntropyBytes(mnemonic: str, """ return HmacSha512().QuickDigest(mnemonic, passphrase) + @staticmethod + def IsBasicSeed(entropy_bytes: bytes) -> bool: + """ + Get if the entropy bytes are for a basic seed. + + Args: + entropy_bytes (bytes): Entropy bytes to validate + + Returns: + bool: True if the entropy bytes are for a basic seed, False otherwise + """ + seed_bytes = Pbkdf2HmacSha512().DeriveKey(entropy_bytes, + TonSeedUtilsConst.BASIC_SEED_SALT_MOD, + TonSeedUtilsConst.BASIC_SEED_PBKDF2_ROUNDS, + TonSeedUtilsConst.SEED_LEN_BYTES) + return seed_bytes[0] == 0 + + @staticmethod + def IsPasswordSeed(entropy_bytes: bytes) -> bool: + """ + Get if the entropy bytes are for a password seed. + + Args: + entropy_bytes (bytes): Entropy bytes to validate + + Returns: + bool: True if the entropy bytes are for a password seed, False otherwise + """ + seed_bytes = Pbkdf2HmacSha512().DeriveKey(entropy_bytes, + TonSeedUtilsConst.PASSWORD_SEED_SALT_MOD, + TonSeedUtilsConst.PASSWORD_SEED_PBKDF2_ROUNDS, + TonSeedUtilsConst.SEED_LEN_BYTES) + return seed_bytes[0] == 1 + @classmethod def IsPasswordNeeded(cls, mnemonic: str) -> bool: @@ -82,51 +119,33 @@ def IsPasswordNeeded(cls, return cls.IsPasswordSeed(entropy_bytes) and not cls.IsBasicSeed(entropy_bytes) @staticmethod - def GetDefaultSeed(entropy_bytes: bytes) -> bytes: + def GetPrivateKeySeed(entropy_bytes: bytes) -> bytes: """ - Get the default seed from entropy bytes. + Get the private key seed from entropy bytes. Args: entropy_bytes (bytes): Entropy bytes Returns: - bytes: Default seed bytes + bytes: Private key seed bytes """ return Pbkdf2HmacSha512().DeriveKey(entropy_bytes, - TonSeedUtilsConst.DEF_SEED_SALT_MOD, - TonSeedUtilsConst.DEF_SEED_PBKDF2_ROUNDS, + TonSeedUtilsConst.PRIV_KEY_SEED_SALT_MOD, + TonSeedUtilsConst.PRIV_KEY_SEED_PBKDF2_ROUNDS, TonSeedUtilsConst.SEED_LEN_BYTES) @staticmethod - def IsBasicSeed(entropy_bytes: bytes) -> bool: + def GetHdKeySeed(entropy_bytes: bytes) -> bytes: """ - Get if the entropy bytes are for a basic seed. + Get the HD key seed from entropy bytes. Args: - entropy_bytes (bytes): Entropy bytes to validate - - Returns: - bool: True if the entropy bytes are for a basic seed, False otherwise - """ - seed_bytes = Pbkdf2HmacSha512().DeriveKey(entropy_bytes, - TonSeedUtilsConst.BASIC_SEED_SALT_MOD, - TonSeedUtilsConst.BASIC_SEED_PBKDF2_ROUNDS, - TonSeedUtilsConst.SEED_LEN_BYTES) - return seed_bytes[0] == 0 - - @staticmethod - def IsPasswordSeed(entropy_bytes: bytes) -> bool: - """ - Get if the entropy bytes are for a password seed. - - Args: - entropy_bytes (bytes): Entropy bytes to validate + entropy_bytes (bytes): Entropy bytes Returns: - bool: True if the entropy bytes are for a password seed, False otherwise + bytes: HD key seed bytes """ - seed_bytes = Pbkdf2HmacSha512().DeriveKey(entropy_bytes, - TonSeedUtilsConst.PASSWORD_SEED_SALT_MOD, - TonSeedUtilsConst.PASSWORD_SEED_PBKDF2_ROUNDS, - TonSeedUtilsConst.SEED_LEN_BYTES) - return seed_bytes[0] == 1 + return Pbkdf2HmacSha512().DeriveKey(entropy_bytes, + TonSeedUtilsConst.HD_KEY_SEED_SALT_MOD, + TonSeedUtilsConst.HD_KEY_SEED_PBKDF2_ROUNDS, + TonSeedUtilsConst.SEED_LEN_BYTES) From 9f1019839cb3d16aa4c8601389d241fa0da6f6a5 Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Thu, 26 Feb 2026 10:36:53 +0100 Subject: [PATCH 22/66] Add type check --- bip_utils/ton/mnemonic/ton_seed_generator.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bip_utils/ton/mnemonic/ton_seed_generator.py b/bip_utils/ton/mnemonic/ton_seed_generator.py index 9711bae7..ad69b900 100644 --- a/bip_utils/ton/mnemonic/ton_seed_generator.py +++ b/bip_utils/ton/mnemonic/ton_seed_generator.py @@ -79,7 +79,13 @@ def Generate(self, Returns: bytes: Generated seed + + Raises: + TypeError: If the seed type is not a TonSeedTypes enum """ + if not isinstance(seed_type, TonSeedTypes): + raise TypeError("Seed type is not an enumerative of TonSeedTypes") + entropy_bytes = TonSeedUtils.GetEntropyBytes(self.m_mnemonic, passphrase) if seed_type == TonSeedTypes.PRIVATE_KEY: return TonSeedUtils.GetPrivateKeySeed(entropy_bytes) From 8bb848b6fb0dbdac7ff7e9f411c002c158671c0f Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Thu, 26 Feb 2026 10:57:39 +0100 Subject: [PATCH 23/66] Clean up TonAddrEncoder --- bip_utils/addr/__init__.py | 2 +- bip_utils/addr/ton_addr.py | 24 ++++++++---------------- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/bip_utils/addr/__init__.py b/bip_utils/addr/__init__.py index 9f92f9cc..eea72977 100644 --- a/bip_utils/addr/__init__.py +++ b/bip_utils/addr/__init__.py @@ -76,7 +76,7 @@ SubstrateSr25519AddrEncoder, ) from bip_utils.addr.sui_addr import SuiAddr, SuiAddrDecoder, SuiAddrEncoder -from bip_utils.addr.ton_addr import TonAddrEncoder +from bip_utils.addr.ton_addr import TonAddr, TonAddrEncoder from bip_utils.addr.trx_addr import TrxAddr, TrxAddrDecoder, TrxAddrEncoder from bip_utils.addr.xlm_addr import XlmAddr, XlmAddrDecoder, XlmAddrEncoder, XlmAddrTypes from bip_utils.addr.xmr_addr import ( diff --git a/bip_utils/addr/ton_addr.py b/bip_utils/addr/ton_addr.py index 1c1f98f0..7cce6d01 100644 --- a/bip_utils/addr/ton_addr.py +++ b/bip_utils/addr/ton_addr.py @@ -26,9 +26,7 @@ from bip_utils.addr.addr_key_validator import AddrKeyValidator from bip_utils.addr.iaddr_encoder import IAddrEncoder from bip_utils.ecc import IPublicKey -from bip_utils.ecc.ed25519.ed25519_keys import Ed25519KeysConst from bip_utils.ton.address.ton_address_encoder import TonAddressEncoder -from bip_utils.utils.misc import BytesUtils class TonAddrEncoder(IAddrEncoder): @@ -45,31 +43,25 @@ def EncodeKey(pub_key: Union[bytes, IPublicKey], Args: pub_key (bytes or IPublicKey): Public key bytes or object - **kwargs : Not used + + Other Parameters: + version (str, optional): Address version (default: v4) + is_bounceable (bool, optional): Whether the address is bounceable (default: False) Returns: str: Address string Raised: ValueError: If the public key is not valid - TypeError: If the public key is not ed25519, version is not valid or is_bounceable is not a boolean + TypeError: If the public key is not ed25519 """ pub_key_obj = AddrKeyValidator.ValidateAndGetEd25519Key(pub_key) - pub_key_bytes = pub_key_obj.RawCompressed().ToBytes() - # Remove the 0x00 prefix if present - if (len(pub_key_bytes) == Ed25519KeysConst.PUB_KEY_BYTE_LEN + len(Ed25519KeysConst.PUB_KEY_PREFIX) - and pub_key_bytes[0] == BytesUtils.ToInteger(Ed25519KeysConst.PUB_KEY_PREFIX)): - pub_key_bytes = pub_key_bytes[1:] + pub_key_bytes = pub_key_obj.RawCompressed().ToBytes()[1:] - # Get and check address version. Default is v4, which is what is current employed in trust and ledger. version = kwargs.get("version", "v4") - - # Version check is done in TonAddressEncoder, which will raise a ValueError if the version is not valid. We can skip it here to avoid code duplication. is_bounceable = kwargs.get("is_bounceable", False) - if not isinstance(is_bounceable, bool): - raise TypeError("is_bounceable must be a boolean") - # Add prefix and encode - return TonAddressEncoder( pub_key_bytes, version=version, is_bounceable=is_bounceable).encode() + + return TonAddressEncoder(pub_key_bytes, version, is_bounceable).encode() # Deprecated: only for compatibility, Encoder class shall be used instead From 678b43edb261aacd567e33f15c2bd4a0ab00791f Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Thu, 26 Feb 2026 10:58:06 +0100 Subject: [PATCH 24/66] Add TON keys for consistency with other classes --- bip_utils/__init__.py | 10 +- bip_utils/ton/__init__.py | 2 + bip_utils/ton/ton.py | 32 ++--- bip_utils/ton/ton_ex.py | 25 ++++ bip_utils/ton/ton_keys.py | 241 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 289 insertions(+), 21 deletions(-) create mode 100644 bip_utils/ton/ton_ex.py create mode 100644 bip_utils/ton/ton_keys.py diff --git a/bip_utils/__init__.py b/bip_utils/__init__.py index 0e657acf..d09c4598 100644 --- a/bip_utils/__init__.py +++ b/bip_utils/__init__.py @@ -116,6 +116,8 @@ SuiAddr, SuiAddrDecoder, SuiAddrEncoder, + TonAddr, + TonAddrEncoder, TrxAddr, TrxAddrDecoder, TrxAddrEncoder, @@ -383,8 +385,12 @@ SubstrateScaleU128Encoder, SubstrateScaleU256Encoder, ) -from bip_utils.ton import Ton -from bip_utils.ton.address.ton_address_encoder import TonAddressEncoder +from bip_utils.ton import ( + Ton, + TonKeyError, + TonPrivateKey, + TonPublicKey, +) # TON from bip_utils.ton.mnemonic import ( diff --git a/bip_utils/ton/__init__.py b/bip_utils/ton/__init__.py index 6691b4fa..f754e99c 100644 --- a/bip_utils/ton/__init__.py +++ b/bip_utils/ton/__init__.py @@ -1 +1,3 @@ from bip_utils.ton.ton import Ton +from bip_utils.ton.ton_ex import TonKeyError +from bip_utils.ton.ton_keys import TonPrivateKey, TonPublicKey diff --git a/bip_utils/ton/ton.py b/bip_utils/ton/ton.py index f2f956db..4f5d9174 100644 --- a/bip_utils/ton/ton.py +++ b/bip_utils/ton/ton.py @@ -25,9 +25,9 @@ from typing import Union -from bip_utils.ecc.common.ikeys import IPrivateKey, IPublicKey -from bip_utils.ecc.ed25519.ed25519_keys import Ed25519PrivateKey +from bip_utils.ecc.common.ikeys import IPrivateKey from bip_utils.ton.address.ton_address_encoder import TonAddressEncoder +from bip_utils.ton.ton_keys import TonPrivateKey, TonPublicKey class Ton: @@ -37,8 +37,8 @@ class Ton: It also allows to generate addresses based on bip44 such as Trustwallet or Ledger. """ - m_priv_key: IPrivateKey - m_pub_key: IPublicKey + m_priv_key: TonPrivateKey + m_pub_key: TonPublicKey @classmethod def FromSeed(cls, @@ -53,9 +53,9 @@ def FromSeed(cls, Ton object: Ton object Raises: - ValueError: If key bytes are not valid + TonKeyError: If the key constructed from the bytes is not valid """ - return cls(Ed25519PrivateKey.FromBytes(seed_bytes[:32])) + return cls(seed_bytes[:32]) def __init__(self, priv_key: Union[bytes, IPrivateKey]) -> None: @@ -66,32 +66,26 @@ def __init__(self, priv_key (Union[bytes, IPrivateKey]): Private key bytes or object Raises: - ValueError: If key bytes are not valid - TypeError: If private key is not an Ed25519PrivateKey objec + TonKeyError: If the key constructed from the bytes is not valid """ - if isinstance(priv_key, bytes): - priv_key = Ed25519PrivateKey.FromBytes(priv_key) - if not isinstance(priv_key, Ed25519PrivateKey): - raise TypeError("Private key is not an Ed25519PrivateKey object or bytes") + self.m_priv_key = TonPrivateKey.FromBytesOrKeyObject(priv_key) + self.m_pub_key = self.m_priv_key.PublicKey() - self.m_priv_key = priv_key - self.m_pub_key = priv_key.PublicKey() - - def PublicKey(self) -> IPublicKey: + def PublicKey(self) -> TonPublicKey: """ Return public key object. Returns: - IPublicKey object: IPublicKey object + TonPublicKey object: TonPublicKey object """ return self.m_pub_key - def PrivateKey(self) -> IPrivateKey: + def PrivateKey(self) -> TonPrivateKey: """ Return private key object. Returns: - IPrivateKey object: IPrivateKey object + TonPrivateKey object: TonPrivateKey object """ return self.m_priv_key diff --git a/bip_utils/ton/ton_ex.py b/bip_utils/ton/ton_ex.py new file mode 100644 index 00000000..0e21e7e4 --- /dev/null +++ b/bip_utils/ton/ton_ex.py @@ -0,0 +1,25 @@ +# Copyright (c) 2021 Emanuele Bellocchia +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +"""Module for TON exceptions.""" + + +class TonKeyError(Exception): + """Exception in case of TON key error.""" diff --git a/bip_utils/ton/ton_keys.py b/bip_utils/ton/ton_keys.py new file mode 100644 index 00000000..3855c00f --- /dev/null +++ b/bip_utils/ton/ton_keys.py @@ -0,0 +1,241 @@ +# Copyright (c) 2021 Emanuele Bellocchia +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +"""Module for TON keys handling.""" + +# Imports +from __future__ import annotations + +from functools import lru_cache +from typing import Union + +from bip_utils.ecc import IPrivateKey, IPublicKey +from bip_utils.ecc.ed25519.ed25519_keys import Ed25519PrivateKey, Ed25519PublicKey +from bip_utils.ton.ton_ex import TonKeyError +from bip_utils.utils.misc import DataBytes + + +class TonPublicKey: + """TON public key class.""" + + m_pub_key: IPublicKey + + @classmethod + def FromBytesOrKeyObject(cls, + pub_key: Union[bytes, IPublicKey]) -> TonPublicKey: + """ + Get the public key from key bytes or object. + + Args: + pub_key (bytes or IPublicKey): Public key + + Returns: + TonPublicKey object: TonPublicKey object + + Raises: + TonKeyError: If the key constructed from the bytes is not valid + """ + return (cls.FromBytes(pub_key) + if isinstance(pub_key, bytes) + else cls(pub_key)) + + @classmethod + def FromBytes(cls, + key_bytes: bytes) -> TonPublicKey: + """ + Create from bytes. + + Args: + key_bytes (bytes): Key bytes + + Returns: + TonPublicKey object: TonPublicKey object + + Raises: + TonKeyError: If the key constructed from the bytes is not valid + """ + return cls(cls.__KeyFromBytes(key_bytes)) + + def __init__(self, + pub_key: IPublicKey) -> None: + """ + Construct class. + + Args: + pub_key (IPublicKey object): Key object + + Raises: + TonKeyError: If the bytes length is not valid + TypeError: If the key is not a Ed25519PublicKey object + """ + if not isinstance(pub_key, Ed25519PublicKey): + raise TypeError("Invalid public key object type") + self.m_pub_key = pub_key + + def KeyObject(self) -> IPublicKey: + """ + Return the key object. + + Returns: + IPublicKey object: Key object + """ + return self.m_pub_key + + @lru_cache() + def RawCompressed(self) -> DataBytes: + """ + Return raw compressed public key. + + Returns: + DataBytes object: DataBytes object + """ + return self.m_pub_key.RawCompressed() + + @lru_cache() + def RawUncompressed(self) -> DataBytes: + """ + Return raw uncompressed public key. + + Returns: + DataBytes object: DataBytes object + """ + return self.m_pub_key.RawUncompressed() + + @staticmethod + def __KeyFromBytes(key_bytes: bytes) -> IPublicKey: + """ + Construct key from bytes. + + Args: + key_bytes (bytes): Key bytes + + Returns: + IPublicKey object: IPublicKey object + + Raises: + TonKeyError: If the key constructed from the bytes is not valid + """ + try: + return Ed25519PublicKey.FromBytes(key_bytes) + except ValueError as ex: + raise TonKeyError("Invalid public key") from ex + + +class TonPrivateKey: + """TON private key class.""" + + m_priv_key: IPrivateKey + + @classmethod + def FromBytesOrKeyObject(cls, + priv_key: Union[bytes, IPrivateKey]) -> TonPrivateKey: + """ + Get the private key from key bytes or object. + + Args: + priv_key (bytes or IPrivateKey): Private key + + Returns: + TonPrivateKey object: TonPrivateKey object + + Raises: + TonKeyError: If the key constructed from the bytes is not valid + """ + return (cls.FromBytes(priv_key) + if isinstance(priv_key, bytes) + else cls(priv_key)) + + @classmethod + def FromBytes(cls, + key_bytes: bytes) -> TonPrivateKey: + """ + Create from bytes. + + Args: + key_bytes (bytes): Key bytes + + Raises: + TonKeyError: If the key constructed from the bytes is not valid + """ + return cls(cls.__KeyFromBytes(key_bytes)) + + def __init__(self, + priv_key: IPrivateKey) -> None: + """ + Construct class. + + Args: + priv_key (IPrivateKey object): Key object + + Raises: + TonKeyError: If the bytes length is not valid + TypeError: If the key is not a Ed25519PrivateKey object + """ + if not isinstance(priv_key, Ed25519PrivateKey): + raise TypeError("Invalid private key object type") + self.m_priv_key = priv_key + + def KeyObject(self) -> IPrivateKey: + """ + Return the key object. + + Returns: + IPrivateKey object: Key object + """ + return self.m_priv_key + + @lru_cache() + def Raw(self) -> DataBytes: + """ + Return raw private key. + + Returns: + DataBytes object: DataBytes object + """ + return self.m_priv_key.Raw() + + @lru_cache() + def PublicKey(self) -> TonPublicKey: + """ + Get the public key correspondent to the private one. + + Returns: + TonPublicKey object: TonPublicKey object + """ + return TonPublicKey(self.m_priv_key.PublicKey()) + + @staticmethod + def __KeyFromBytes(key_bytes: bytes) -> IPrivateKey: + """ + Construct key from bytes. + + Args: + key_bytes (bytes): Key bytes + + Returns: + IPrivateKey object: IPrivateKey object + + Raises: + TonKeyError: If the key constructed from the bytes is not valid + """ + try: + return Ed25519PrivateKey.FromBytes(key_bytes) + except ValueError as ex: + raise TonKeyError("Invalid private key") from ex From 8687543c5c45de7ebb254c89d5aca68466ad07ae Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Thu, 26 Feb 2026 13:25:43 +0100 Subject: [PATCH 25/66] Clean up TON address part, fix all mypy and ruff errors/warnings --- .github/workflows/code-analysis.yml | 3 + .github/workflows/code-coverage.yml | 3 + .github/workflows/test.yml | 3 + .github/workflows/test_min_reqs.yml | 3 + bip_utils/__init__.py | 15 +- bip_utils/addr/ton_addr.py | 31 +++- bip_utils/bip/conf/bip44/bip44_conf.py | 5 +- bip_utils/coin_conf/coins_conf.py | 3 +- bip_utils/ton/__init__.py | 1 - bip_utils/ton/addr/__init__.py | 5 + bip_utils/ton/addr/ton_addr_versions.py | 34 ++++ bip_utils/ton/addr/ton_v3r1_addr_encoder.py | 84 +++++++++ bip_utils/ton/addr/ton_v3r2_addr_encoder.py | 84 +++++++++ bip_utils/ton/addr/ton_v4_addr_encoder.py | 85 +++++++++ bip_utils/ton/addr/ton_v5r1_addr_encoder.py | 93 ++++++++++ bip_utils/ton/address/__init__.py | 1 - bip_utils/ton/address/ton_address_encoder.py | 168 ------------------ bip_utils/ton/keys/__init__.py | 1 + bip_utils/ton/{ => keys}/ton_keys.py | 0 .../ton/mnemonic/ton_mnemonic_generator.py | 2 +- .../ton/mnemonic/ton_mnemonic_validator.py | 2 +- bip_utils/ton/mnemonic/ton_seed_generator.py | 6 +- bip_utils/ton/mnemonic/ton_seed_utils.py | 2 +- bip_utils/ton/ton.py | 17 +- bip_utils/utils/misc/__init__.py | 1 + bip_utils/utils/misc/base64.py | 74 ++++++++ examples/ton.py | 8 +- 27 files changed, 534 insertions(+), 200 deletions(-) create mode 100644 bip_utils/ton/addr/__init__.py create mode 100644 bip_utils/ton/addr/ton_addr_versions.py create mode 100644 bip_utils/ton/addr/ton_v3r1_addr_encoder.py create mode 100644 bip_utils/ton/addr/ton_v3r2_addr_encoder.py create mode 100644 bip_utils/ton/addr/ton_v4_addr_encoder.py create mode 100644 bip_utils/ton/addr/ton_v5r1_addr_encoder.py delete mode 100644 bip_utils/ton/address/__init__.py delete mode 100644 bip_utils/ton/address/ton_address_encoder.py create mode 100644 bip_utils/ton/keys/__init__.py rename bip_utils/ton/{ => keys}/ton_keys.py (100%) create mode 100644 bip_utils/utils/misc/base64.py diff --git a/.github/workflows/code-analysis.yml b/.github/workflows/code-analysis.yml index 047a69f6..3df8eb01 100644 --- a/.github/workflows/code-analysis.yml +++ b/.github/workflows/code-analysis.yml @@ -7,6 +7,7 @@ on: branches: [ "master" ] paths-ignore: - README.md + - tox.ini - 'benchmark/**' - 'docs/**' - 'examples/**' @@ -16,11 +17,13 @@ on: branches: [ "master" ] paths-ignore: - README.md + - tox.ini - 'benchmark/**' - 'docs/**' - 'examples/**' - 'libs_wheels/**' - 'readme/**' + workflow_dispatch: jobs: code_analysis: diff --git a/.github/workflows/code-coverage.yml b/.github/workflows/code-coverage.yml index 4cff1221..e3ab3e4b 100644 --- a/.github/workflows/code-coverage.yml +++ b/.github/workflows/code-coverage.yml @@ -7,6 +7,7 @@ on: branches: [ "master" ] paths-ignore: - README.md + - tox.ini - 'benchmark/**' - 'docs/**' - 'examples/**' @@ -16,11 +17,13 @@ on: branches: [ "master" ] paths-ignore: - README.md + - tox.ini - 'benchmark/**' - 'docs/**' - 'examples/**' - 'libs_wheels/**' - 'readme/**' + workflow_dispatch: jobs: code_coverage: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 841e95a9..ceefd917 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,6 +7,7 @@ on: branches: [ "master" ] paths-ignore: - README.md + - tox.ini - 'benchmark/**' - 'docs/**' - 'examples/**' @@ -16,11 +17,13 @@ on: branches: [ "master" ] paths-ignore: - README.md + - tox.ini - 'benchmark/**' - 'docs/**' - 'examples/**' - 'libs_wheels/**' - 'readme/**' + workflow_dispatch: jobs: build_test_py307: diff --git a/.github/workflows/test_min_reqs.yml b/.github/workflows/test_min_reqs.yml index 1dfb5378..4c5e99be 100644 --- a/.github/workflows/test_min_reqs.yml +++ b/.github/workflows/test_min_reqs.yml @@ -7,6 +7,7 @@ on: branches: [ "master" ] paths-ignore: - README.md + - tox.ini - 'benchmark/**' - 'docs/**' - 'examples/**' @@ -16,11 +17,13 @@ on: branches: [ "master" ] paths-ignore: - README.md + - tox.ini - 'benchmark/**' - 'docs/**' - 'examples/**' - 'libs_wheels/**' - 'readme/**' + workflow_dispatch: jobs: test_min_reqs_py37: diff --git a/bip_utils/__init__.py b/bip_utils/__init__.py index d09c4598..42a9f899 100644 --- a/bip_utils/__init__.py +++ b/bip_utils/__init__.py @@ -385,14 +385,23 @@ SubstrateScaleU128Encoder, SubstrateScaleU256Encoder, ) + +# TON from bip_utils.ton import ( Ton, TonKeyError, +) +from bip_utils.ton.addr import ( + TonAddrVersions, + TonV3R1AddrEncoder, + TonV3R2AddrEncoder, + TonV4AddrEncoder, + TonV5R1AddrEncoder, +) +from bip_utils.ton.keys import ( TonPrivateKey, TonPublicKey, ) - -# TON from bip_utils.ton.mnemonic import ( TonLanguages, TonMnemonic, @@ -429,6 +438,8 @@ AlgoUtils, Base32Decoder, Base32Encoder, + Base64Decoder, + Base64Encoder, BitUtils, BytesUtils, DataBytes, diff --git a/bip_utils/addr/ton_addr.py b/bip_utils/addr/ton_addr.py index 7cce6d01..c05ed961 100644 --- a/bip_utils/addr/ton_addr.py +++ b/bip_utils/addr/ton_addr.py @@ -18,7 +18,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -"""Module for Tron address encoding following the rest of the modules.""" +"""Module for TON address encoding.""" # Imports from typing import Any, Union @@ -26,7 +26,14 @@ from bip_utils.addr.addr_key_validator import AddrKeyValidator from bip_utils.addr.iaddr_encoder import IAddrEncoder from bip_utils.ecc import IPublicKey -from bip_utils.ton.address.ton_address_encoder import TonAddressEncoder +from bip_utils.ton.addr import ( + TonAddrVersions, + TonV3R1AddrEncoder, + TonV3R2AddrEncoder, + TonV4AddrEncoder, + TonV5R1AddrEncoder, +) +from bip_utils.ton.keys import TonPublicKey class TonAddrEncoder(IAddrEncoder): @@ -45,8 +52,8 @@ def EncodeKey(pub_key: Union[bytes, IPublicKey], pub_key (bytes or IPublicKey): Public key bytes or object Other Parameters: - version (str, optional): Address version (default: v4) - is_bounceable (bool, optional): Whether the address is bounceable (default: False) + version (TonAddrVersions, optional): Address version (default: v4) + is_bounceable (bool, optional) : Whether the address is bounceable (default: False) Returns: str: Address string @@ -56,12 +63,22 @@ def EncodeKey(pub_key: Union[bytes, IPublicKey], TypeError: If the public key is not ed25519 """ pub_key_obj = AddrKeyValidator.ValidateAndGetEd25519Key(pub_key) - pub_key_bytes = pub_key_obj.RawCompressed().ToBytes()[1:] + ton_pub_key_obj = TonPublicKey.FromBytesOrKeyObject(pub_key_obj) + + version = kwargs.get("version", TonAddrVersions.V4) + if not isinstance(version, TonAddrVersions): + raise TypeError("Version is not an enumerative of TonAddrVersions") - version = kwargs.get("version", "v4") is_bounceable = kwargs.get("is_bounceable", False) - return TonAddressEncoder(pub_key_bytes, version, is_bounceable).encode() + if version == TonAddrVersions.V5R1: + return TonV5R1AddrEncoder(ton_pub_key_obj).Encode(is_bounceable) + elif version == TonAddrVersions.V4: + return TonV4AddrEncoder(ton_pub_key_obj).Encode(is_bounceable) + elif version == TonAddrVersions.V3R2: + return TonV3R2AddrEncoder(ton_pub_key_obj).Encode(is_bounceable) + else: + return TonV3R1AddrEncoder(ton_pub_key_obj).Encode(is_bounceable) # Deprecated: only for compatibility, Encoder class shall be used instead diff --git a/bip_utils/bip/conf/bip44/bip44_conf.py b/bip_utils/bip/conf/bip44/bip44_conf.py index e3b41f59..a3cb9531 100644 --- a/bip_utils/bip/conf/bip44/bip44_conf.py +++ b/bip_utils/bip/conf/bip44/bip44_conf.py @@ -1351,7 +1351,10 @@ class Bip44Conf: wif_net_ver=None, bip32_cls=Bip32Slip10Ed25519, addr_cls=TonAddrEncoder, - addr_params={"version": CoinsConf.Ton.ParamByKey("version"), "is_bounceable": CoinsConf.Ton.ParamByKey("is_bounceable")}, + addr_params={ + "version": CoinsConf.Ton.ParamByKey("version"), + "is_bounceable": CoinsConf.Ton.ParamByKey("is_bounceable"), + }, ) # Configuration for Tron diff --git a/bip_utils/coin_conf/coins_conf.py b/bip_utils/coin_conf/coins_conf.py index f650a694..eb6d91b8 100644 --- a/bip_utils/coin_conf/coins_conf.py +++ b/bip_utils/coin_conf/coins_conf.py @@ -23,6 +23,7 @@ # Imports from bip_utils.coin_conf.coin_conf import CoinConf from bip_utils.slip.slip173 import Slip173 +from bip_utils.ton.addr.ton_addr_versions import TonAddrVersions from bip_utils.utils.conf import CoinNames @@ -854,7 +855,7 @@ class CoinsConf: Ton: CoinConf = CoinConf( coin_name=CoinNames("The Open Network", "TON"), params={ - "version": "v4", + "version": TonAddrVersions.V4, "is_bounceable": False, }, ) diff --git a/bip_utils/ton/__init__.py b/bip_utils/ton/__init__.py index f754e99c..9f784b07 100644 --- a/bip_utils/ton/__init__.py +++ b/bip_utils/ton/__init__.py @@ -1,3 +1,2 @@ from bip_utils.ton.ton import Ton from bip_utils.ton.ton_ex import TonKeyError -from bip_utils.ton.ton_keys import TonPrivateKey, TonPublicKey diff --git a/bip_utils/ton/addr/__init__.py b/bip_utils/ton/addr/__init__.py new file mode 100644 index 00000000..f3103a0d --- /dev/null +++ b/bip_utils/ton/addr/__init__.py @@ -0,0 +1,5 @@ +from bip_utils.ton.addr.ton_addr_versions import TonAddrVersions +from bip_utils.ton.addr.ton_v3r1_addr_encoder import TonV3R1AddrEncoder +from bip_utils.ton.addr.ton_v3r2_addr_encoder import TonV3R2AddrEncoder +from bip_utils.ton.addr.ton_v4_addr_encoder import TonV4AddrEncoder +from bip_utils.ton.addr.ton_v5r1_addr_encoder import TonV5R1AddrEncoder diff --git a/bip_utils/ton/addr/ton_addr_versions.py b/bip_utils/ton/addr/ton_addr_versions.py new file mode 100644 index 00000000..492be040 --- /dev/null +++ b/bip_utils/ton/addr/ton_addr_versions.py @@ -0,0 +1,34 @@ +# Copyright (c) 2021 Emanuele Bellocchia +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +"""Module for defining TON address versions.""" + +# Imports +from enum import Enum, auto, unique + + +@unique +class TonAddrVersions(Enum): + """Enumerative for TON address versions.""" + + V5R1 = auto() + V4 = auto() + V3R2 = auto() + V3R1 = auto() diff --git a/bip_utils/ton/addr/ton_v3r1_addr_encoder.py b/bip_utils/ton/addr/ton_v3r1_addr_encoder.py new file mode 100644 index 00000000..762c93c2 --- /dev/null +++ b/bip_utils/ton/addr/ton_v3r1_addr_encoder.py @@ -0,0 +1,84 @@ +# Copyright (c) 2022 Emanuele Bellocchia +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +""" +Module containing utility classes for TON V3R1 address computation. + +Reference: https://github.com/ton-org/ton/blob/main/src/wallets/v3/r1.ts +""" + +# Imports +from pytoniq_core import Address, Cell, begin_cell + +from bip_utils.ton.keys import TonPublicKey +from bip_utils.utils.misc import Base64Decoder + + +class TonV3R1AddrEncoderConst: + """Class container for Ton V3R1 address encoder constants.""" + + CONTRACT_CODE: bytes = Base64Decoder.Decode("te6cckEBAQEAYgAAwP8AIN0gggFMl7qXMO1E0NcLH+Ck8mCDCNcYINMf0x/TH/gjE7vyY+1E0NMf0x/T/9FRMrryoVFEuvKiBPkBVBBV+RDyo/gAkyDXSpbTB9QC+wDo0QGkyMsfyx/L/8ntVD++buA=") # noqa: E501 + WORKCHAIN: int = 0 + + +class TonV3R1AddrEncoder: + """TON V3R1 address encoder class.""" + + m_pub_key: bytes + + def __init__(self, + pub_key_obj: TonPublicKey): + """ + Construct class. + + Args: + pub_key_obj (TonPublicKey object): Public key object + """ + self.m_pub_key = pub_key_obj.RawCompressed().ToBytes()[1:] + + def Encode(self, + is_bounceable: bool) -> str: + """ + Encode public key to V3R1 address. + + Args: + is_bounceable (bool): Whether the address is bounceable + + Returns: + str: Address string + """ + wallet_id = 698983191 + TonV3R1AddrEncoderConst.WORKCHAIN + + code = Cell.one_from_boc(TonV3R1AddrEncoderConst.CONTRACT_CODE) + + data = (begin_cell().store_uint(0, 32) + .store_uint(wallet_id, 32) + .store_bytes(self.m_pub_key) + .end_cell()) + + hash = (begin_cell().store_bit(False) + .store_bit(False) + .store_maybe_ref(code) + .store_maybe_ref(data) + .store_dict(None) + .end_cell().hash) + + addr_obj = Address((TonV3R1AddrEncoderConst.WORKCHAIN, hash)) + return addr_obj.to_str(is_bounceable=is_bounceable) diff --git a/bip_utils/ton/addr/ton_v3r2_addr_encoder.py b/bip_utils/ton/addr/ton_v3r2_addr_encoder.py new file mode 100644 index 00000000..f4a52060 --- /dev/null +++ b/bip_utils/ton/addr/ton_v3r2_addr_encoder.py @@ -0,0 +1,84 @@ +# Copyright (c) 2022 Emanuele Bellocchia +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +""" +Module containing utility classes for TON V3R2 address computation. + +Reference: https://github.com/ton-org/ton/blob/main/src/wallets/v3/r2.ts +""" + +# Imports +from pytoniq_core import Address, Cell, begin_cell + +from bip_utils.ton.keys import TonPublicKey +from bip_utils.utils.misc import Base64Decoder + + +class TonV3R2AddrEncoderConst: + """Class container for Ton V3R2 address encoder constants.""" + + CONTRACT_CODE: bytes = Base64Decoder.Decode("te6cckEBAQEAcQAA3v8AIN0gggFMl7ohggEznLqxn3Gw7UTQ0x/THzHXC//jBOCk8mCDCNcYINMf0x/TH/gjE7vyY+1E0NMf0x/T/9FRMrryoVFEuvKiBPkBVBBV+RDyo/gAkyDXSpbTB9QC+wDo0QGkyMsfyx/L/8ntVBC9ba0=") # noqa: E501 + WORKCHAIN: int = 0 + + +class TonV3R2AddrEncoder: + """TON V3R2 address encoder class.""" + + m_pub_key: bytes + + def __init__(self, + pub_key_obj: TonPublicKey): + """ + Construct class. + + Args: + pub_key_obj (TonPublicKey object): Public key object + """ + self.m_pub_key = pub_key_obj.RawCompressed().ToBytes()[1:] + + def Encode(self, + is_bounceable: bool) -> str: + """ + Encode public key to V3R2 address. + + Args: + is_bounceable (bool): Whether the address is bounceable + + Returns: + str: Address string + """ + wallet_id = 698983191 + TonV3R2AddrEncoderConst.WORKCHAIN + + code = Cell.one_from_boc(TonV3R2AddrEncoderConst.CONTRACT_CODE) + + data = (begin_cell().store_uint(0, 32) + .store_uint(wallet_id, 32) + .store_bytes(self.m_pub_key) + .end_cell()) + + hash = (begin_cell().store_bit(False) + .store_bit(False) + .store_maybe_ref(code) + .store_maybe_ref(data) + .store_dict(None) + .end_cell().hash) + + addr_obj = Address((TonV3R2AddrEncoderConst.WORKCHAIN, hash)) + return addr_obj.to_str(is_bounceable=is_bounceable) diff --git a/bip_utils/ton/addr/ton_v4_addr_encoder.py b/bip_utils/ton/addr/ton_v4_addr_encoder.py new file mode 100644 index 00000000..67d234fc --- /dev/null +++ b/bip_utils/ton/addr/ton_v4_addr_encoder.py @@ -0,0 +1,85 @@ +# Copyright (c) 2022 Emanuele Bellocchia +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +""" +Module containing utility classes for TON V4 address computation. + +Reference: https://github.com/ton-org/ton/blob/main/src/wallets/v4/WalletContractV4.ts +""" + +# Imports +from pytoniq_core import Address, Cell, begin_cell + +from bip_utils.ton.keys import TonPublicKey +from bip_utils.utils.misc import Base64Decoder + + +class TonV4AddrEncoderConst: + """Class container for Ton V4 address encoder constants.""" + + CONTRACT_CODE: bytes = Base64Decoder.Decode("te6ccgECFAEAAtQAART/APSkE/S88sgLAQIBIAIDAgFIBAUE+PKDCNcYINMf0x/THwL4I7vyZO1E0NMf0x/T//QE0VFDuvKhUVG68qIF+QFUEGT5EPKj+AAkpMjLH1JAyx9SMMv/UhD0AMntVPgPAdMHIcAAn2xRkyDXSpbTB9QC+wDoMOAhwAHjACHAAuMAAcADkTDjDQOkyMsfEssfy/8QERITAubQAdDTAyFxsJJfBOAi10nBIJJfBOAC0x8hghBwbHVnvSKCEGRzdHK9sJJfBeAD+kAwIPpEAcjKB8v/ydDtRNCBAUDXIfQEMFyBAQj0Cm+hMbOSXwfgBdM/yCWCEHBsdWe6kjgw4w0DghBkc3RyupJfBuMNBgcCASAICQB4AfoA9AQw+CdvIjBQCqEhvvLgUIIQcGx1Z4MesXCAGFAEywUmzxZY+gIZ9ADLaRfLH1Jgyz8gyYBA+wAGAIpQBIEBCPRZMO1E0IEBQNcgyAHPFvQAye1UAXKwjiOCEGRzdHKDHrFwgBhQBcsFUAPPFiP6AhPLassfyz/JgED7AJJfA+ICASAKCwBZvSQrb2omhAgKBrkPoCGEcNQICEekk30pkQzmkD6f+YN4EoAbeBAUiYcVnzGEAgFYDA0AEbjJftRNDXCx+AA9sp37UTQgQFA1yH0BDACyMoHy//J0AGBAQj0Cm+hMYAIBIA4PABmtznaiaEAga5Drhf/AABmvHfaiaEAQa5DrhY/AAG7SB/oA1NQi+QAFyMoHFcv/ydB3dIAYyMsFywIizxZQBfoCFMtrEszMyXP7AMhAFIEBCPRR8qcCAHCBAQjXGPoA0z/IVCBHgQEI9FHyp4IQbm90ZXB0gBjIywXLAlAGzxZQBPoCFMtqEssfyz/Jc/sAAgBsgQEI1xj6ANM/MFIkgQEI9Fnyp4IQZHN0cnB0gBjIywXLAlAFzxZQA/oCE8tqyx8Syz/Jc/sAAAr0AMntVA==") # noqa: E501 + WORKCHAIN: int = 0 + + +class TonV4AddrEncoder: + """TON V4 address encoder class.""" + + m_pub_key: bytes + + def __init__(self, + pub_key_obj: TonPublicKey): + """ + Construct class. + + Args: + pub_key_obj (TonPublicKey object): Public key object + """ + self.m_pub_key = pub_key_obj.RawCompressed().ToBytes()[1:] + + def Encode(self, + is_bounceable: bool) -> str: + """ + Encode public key to V4 address. + + Args: + is_bounceable (bool): Whether the address is bounceable + + Returns: + str: Address string + """ + wallet_id = 698983191 + TonV4AddrEncoderConst.WORKCHAIN + + code = Cell.one_from_boc(TonV4AddrEncoderConst.CONTRACT_CODE) + + data = (begin_cell().store_uint(0, 32) + .store_uint(wallet_id, 32) + .store_bytes(self.m_pub_key) + .store_bit(0) + .end_cell()) + + hash = (begin_cell().store_bit(False) + .store_bit(False) + .store_maybe_ref(code) + .store_maybe_ref(data) + .store_dict(None) + .end_cell().hash) + + addr_obj = Address((TonV4AddrEncoderConst.WORKCHAIN, hash)) + return addr_obj.to_str(is_bounceable=is_bounceable) diff --git a/bip_utils/ton/addr/ton_v5r1_addr_encoder.py b/bip_utils/ton/addr/ton_v5r1_addr_encoder.py new file mode 100644 index 00000000..6933d7d0 --- /dev/null +++ b/bip_utils/ton/addr/ton_v5r1_addr_encoder.py @@ -0,0 +1,93 @@ +# Copyright (c) 2022 Emanuele Bellocchia +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +""" +Module containing utility classes for TON V5R1 address. + +Reference: https://github.com/ton-org/ton/blob/main/src/wallets/v5r1/WalletContractV5R1.ts +""" + +# Imports +from pytoniq_core import Address, Cell, begin_cell + +from bip_utils.ton.keys import TonPublicKey + + +class TonV5R1AddrEncoderConst: + """Class container for Ton V5R1 address encoder constants.""" + + CONTRACT_CODE: str = "b5ee9c7241021401000281000114ff00f4a413f4bcf2c80b01020120020d020148030402dcd020d749c120915b8f6320d70b1f2082106578746ebd21821073696e74bdb0925f03e082106578746eba8eb48020d72101d074d721fa4030fa44f828fa443058bd915be0ed44d0810141d721f4058307f40e6fa1319130e18040d721707fdb3ce03120d749810280b99130e070e2100f020120050c020120060902016e07080019adce76a2684020eb90eb85ffc00019af1df6a2684010eb90eb858fc00201480a0b0017b325fb51341c75c875c2c7e00011b262fb513435c280200019be5f0f6a2684080a0eb90fa02c0102f20e011e20d70b1f82107369676ebaf2e08a7f0f01e68ef0eda2edfb218308d722028308d723208020d721d31fd31fd31fed44d0d200d31f20d31fd3ffd70a000af90140ccf9109a28945f0adb31e1f2c087df02b35007b0f2d0845125baf2e0855036baf2e086f823bbf2d0882292f800de01a47fc8ca00cb1f01cf16c9ed542092f80fde70db3cd81003f6eda2edfb02f404216e926c218e4c0221d73930709421c700b38e2d01d72820761e436c20d749c008f2e09320d74ac002f2e09320d71d06c712c2005230b0f2d089d74cd7393001a4e86c128407bbf2e093d74ac000f2e093ed55e2d20001c000915be0ebd72c08142091709601d72c081c12e25210b1e30f20d74a111213009601fa4001fa44f828fa443058baf2e091ed44d0810141d718f405049d7fc8ca0040048307f453f2e08b8e14038307f45bf2e08c22d70a00216e01b3b0f2d090e2c85003cf1612f400c9ed54007230d72c08248e2d21f2e092d200ed44d0d2005113baf2d08f54503091319c01810140d721d70a00f2e08ee2c8ca0058cf16c9ed5493f2c08de20010935bdb31e1d74cd0b4d6c35e" # noqa: E501 + NETWORK_GLOBAL_ID: int = -239 + SUBWALLET_NUMBER: int = 0 + WORKCHAIN: int = 0 + + +class TonV5R1AddrEncoder: + """TON V5R1 address encoder class.""" + + m_pub_key: bytes + + def __init__(self, + pub_key_obj: TonPublicKey): + """ + Construct class. + + Args: + pub_key_obj (TonPublicKey object): Public key object + """ + self.m_pub_key = pub_key_obj.RawCompressed().ToBytes()[1:] + + def Encode(self, + is_bounceable: bool) -> str: + """ + Encode public key to V5R1 address. + + Args: + is_bounceable (bool): Whether the address is bounceable + + Returns: + str: Address string + """ + code = Cell.one_from_boc(TonV5R1AddrEncoderConst.CONTRACT_CODE) + + context = (begin_cell().store_uint(1, 1) + .store_int(TonV5R1AddrEncoderConst.WORKCHAIN, 8) + .store_uint(0, 8) + .store_uint(TonV5R1AddrEncoderConst.SUBWALLET_NUMBER, 15) + .end_cell() + .begin_parse() + .load_int(32)) + + data = (begin_cell().store_uint(1, 1) + .store_uint(0, 32) + .store_int(TonV5R1AddrEncoderConst.NETWORK_GLOBAL_ID ^ context, 32) + .store_bytes(self.m_pub_key) + .store_bit(0) + .end_cell()) + + hash = (begin_cell().store_bit(False) + .store_bit(False) + .store_maybe_ref(code) + .store_maybe_ref(data) + .store_dict(None) + .end_cell().hash) + + addr_obj = Address((TonV5R1AddrEncoderConst.WORKCHAIN, hash)) + return addr_obj.to_str(is_bounceable=is_bounceable) diff --git a/bip_utils/ton/address/__init__.py b/bip_utils/ton/address/__init__.py deleted file mode 100644 index aa07d829..00000000 --- a/bip_utils/ton/address/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from bip_utils.ton.address.ton_address_encoder import TonAddressEncoder diff --git a/bip_utils/ton/address/ton_address_encoder.py b/bip_utils/ton/address/ton_address_encoder.py deleted file mode 100644 index b845e4e6..00000000 --- a/bip_utils/ton/address/ton_address_encoder.py +++ /dev/null @@ -1,168 +0,0 @@ - - -import base64 -from enum import StrEnum, unique -from typing import List - -from pytoniq_core import Address, Cell, begin_cell - - -wallet_versions_serialisation = { - "v5r1": 0 - } - - -@unique -class TonAddressVerions(StrEnum): - """Enumerative for TON address versions.""" - - V5R1 = "v5r1" - V4 = "v4" - V3R2 = "v3r2" - V3R1 = "v3r1" - - -class TonAddressConst: - """Class container for TON address constants.""" - - # Accepted addrsess versions - TON_ADDRESS_VERSIONS: List[TonAddressVerions] = [ - TonAddressVerions.V5R1, - TonAddressVerions.V4, - TonAddressVerions.V3R2, - TonAddressVerions.V3R1 - ] - - -class TonAddressEncoder: - """ - TON address encoder class. - See for source: - https://github.com/ton-org/ton/blob/main/src/wallets/v5r1/WalletContractV5R1.ts - https://github.com/ton-org/ton/blob/main/src/wallets/v4/WalletContractV4.ts - https://github.com/ton-org/ton/blob/main/src/wallets/v3/r2.ts - https://github.com/ton-org/ton/blob/main/src/wallets/v3/r1.ts - """ - - def __init__(self, public_key, version="v5r1", is_bounceable=False): - if version not in TonAddressConst.TON_ADDRESS_VERSIONS: - raise ValueError(f"Version ({version}) is not valid. Supported versions are: {', '.join(TonAddressConst.TON_ADDRESS_VERSIONS)}") - self.public_key = public_key - self.is_bounceable = is_bounceable - self.version = version - - def v5r1Address(self): - - wallet_details = { - "workchain": 0, - "walletVersion": "v5r1", - "subwalletNumber": 0, - "networkGlobalId": -239 - } - - - code = Cell.one_from_boc("b5ee9c7241021401000281000114ff00f4a413f4bcf2c80b01020120020d020148030402dcd020d749c120915b8f6320d70b1f2082106578746ebd21821073696e74bdb0925f03e082106578746eba8eb48020d72101d074d721fa4030fa44f828fa443058bd915be0ed44d0810141d721f4058307f40e6fa1319130e18040d721707fdb3ce03120d749810280b99130e070e2100f020120050c020120060902016e07080019adce76a2684020eb90eb85ffc00019af1df6a2684010eb90eb858fc00201480a0b0017b325fb51341c75c875c2c7e00011b262fb513435c280200019be5f0f6a2684080a0eb90fa02c0102f20e011e20d70b1f82107369676ebaf2e08a7f0f01e68ef0eda2edfb218308d722028308d723208020d721d31fd31fd31fed44d0d200d31f20d31fd3ffd70a000af90140ccf9109a28945f0adb31e1f2c087df02b35007b0f2d0845125baf2e0855036baf2e086f823bbf2d0882292f800de01a47fc8ca00cb1f01cf16c9ed542092f80fde70db3cd81003f6eda2edfb02f404216e926c218e4c0221d73930709421c700b38e2d01d72820761e436c20d749c008f2e09320d74ac002f2e09320d71d06c712c2005230b0f2d089d74cd7393001a4e86c128407bbf2e093d74ac000f2e093ed55e2d20001c000915be0ebd72c08142091709601d72c081c12e25210b1e30f20d74a111213009601fa4001fa44f828fa443058baf2e091ed44d0810141d718f405049d7fc8ca0040048307f453f2e08b8e14038307f45bf2e08c22d70a00216e01b3b0f2d090e2c85003cf1612f400c9ed54007230d72c08248e2d21f2e092d200ed44d0d2005113baf2d08f54503091319c01810140d721d70a00f2e08ee2c8ca0058cf16c9ed5493f2c08de20010935bdb31e1d74cd0b4d6c35e") - - context = begin_cell() .store_uint(1, 1)\ - .store_int(wallet_details["workchain"] , 8)\ - .store_uint(wallet_versions_serialisation[wallet_details["walletVersion"]], 8)\ - .store_uint(wallet_details["subwalletNumber"], 15).end_cell().begin_parse().load_int(32) - - data = begin_cell().store_uint(1,1)\ - .store_uint(0, 32)\ - .store_int(wallet_details["networkGlobalId"] ^ context, 32)\ - .store_bytes(self.public_key)\ - .store_bit(0) \ - .end_cell() - - - hash_ = begin_cell().store_bit(False).store_bit(False).store_maybe_ref(code)\ - .store_maybe_ref(data)\ - .store_dict(None)\ - .end_cell().hash - - add = Address((wallet_details["workchain"], hash_)) - return add.to_str(is_bounceable=self.is_bounceable) - - def v4Address(self): - - wallet_details = {"workchain": 0} - - wallet_id = 698983191 + wallet_details["workchain"] - - code = Cell.one_from_boc(base64.b64decode("te6ccgECFAEAAtQAART/APSkE/S88sgLAQIBIAIDAgFIBAUE+PKDCNcYINMf0x/THwL4I7vyZO1E0NMf0x/T//QE0VFDuvKhUVG68qIF+QFUEGT5EPKj+AAkpMjLH1JAyx9SMMv/UhD0AMntVPgPAdMHIcAAn2xRkyDXSpbTB9QC+wDoMOAhwAHjACHAAuMAAcADkTDjDQOkyMsfEssfy/8QERITAubQAdDTAyFxsJJfBOAi10nBIJJfBOAC0x8hghBwbHVnvSKCEGRzdHK9sJJfBeAD+kAwIPpEAcjKB8v/ydDtRNCBAUDXIfQEMFyBAQj0Cm+hMbOSXwfgBdM/yCWCEHBsdWe6kjgw4w0DghBkc3RyupJfBuMNBgcCASAICQB4AfoA9AQw+CdvIjBQCqEhvvLgUIIQcGx1Z4MesXCAGFAEywUmzxZY+gIZ9ADLaRfLH1Jgyz8gyYBA+wAGAIpQBIEBCPRZMO1E0IEBQNcgyAHPFvQAye1UAXKwjiOCEGRzdHKDHrFwgBhQBcsFUAPPFiP6AhPLassfyz/JgED7AJJfA+ICASAKCwBZvSQrb2omhAgKBrkPoCGEcNQICEekk30pkQzmkD6f+YN4EoAbeBAUiYcVnzGEAgFYDA0AEbjJftRNDXCx+AA9sp37UTQgQFA1yH0BDACyMoHy//J0AGBAQj0Cm+hMYAIBIA4PABmtznaiaEAga5Drhf/AABmvHfaiaEAQa5DrhY/AAG7SB/oA1NQi+QAFyMoHFcv/ydB3dIAYyMsFywIizxZQBfoCFMtrEszMyXP7AMhAFIEBCPRR8qcCAHCBAQjXGPoA0z/IVCBHgQEI9FHyp4IQbm90ZXB0gBjIywXLAlAGzxZQBPoCFMtqEssfyz/Jc/sAAgBsgQEI1xj6ANM/MFIkgQEI9Fnyp4IQZHN0cnB0gBjIywXLAlAFzxZQA/oCE8tqyx8Syz/Jc/sAAAr0AMntVA==")) - - - data = begin_cell()\ - .store_uint(0, 32)\ - .store_uint(wallet_id, 32)\ - .store_bytes(self.public_key)\ - .store_bit(0) \ - .end_cell() - - - hash_ = begin_cell().store_bit(False).store_bit(False).store_maybe_ref(code)\ - .store_maybe_ref(data)\ - .store_dict(None)\ - .end_cell().hash - - add = Address((wallet_details["workchain"], hash_)) - return add.to_str(is_bounceable=self.is_bounceable) - - - def v3r2Address(self): - - wallet_details = {"workchain": 0} - - wallet_id = 698983191 + wallet_details["workchain"] - - code = Cell.one_from_boc(base64.b64decode("te6cckEBAQEAcQAA3v8AIN0gggFMl7ohggEznLqxn3Gw7UTQ0x/THzHXC//jBOCk8mCDCNcYINMf0x/TH/gjE7vyY+1E0NMf0x/T/9FRMrryoVFEuvKiBPkBVBBV+RDyo/gAkyDXSpbTB9QC+wDo0QGkyMsfyx/L/8ntVBC9ba0=")) - - - data = begin_cell()\ - .store_uint(0, 32)\ - .store_uint(wallet_id, 32)\ - .store_bytes(self.public_key)\ - .end_cell() - - - hash_ = begin_cell().store_bit(False).store_bit(False).store_maybe_ref(code)\ - .store_maybe_ref(data)\ - .store_dict(None)\ - .end_cell().hash - - add = Address((wallet_details["workchain"], hash_)) - return add.to_str(is_bounceable=self.is_bounceable) - - def v3r1Address(self): - wallet_details = {"workchain": 0} - - wallet_id = 698983191 + wallet_details["workchain"] - - code = Cell.one_from_boc(base64.b64decode("te6cckEBAQEAYgAAwP8AIN0gggFMl7qXMO1E0NcLH+Ck8mCDCNcYINMf0x/TH/gjE7vyY+1E0NMf0x/T/9FRMrryoVFEuvKiBPkBVBBV+RDyo/gAkyDXSpbTB9QC+wDo0QGkyMsfyx/L/8ntVD++buA=")) - - - data = begin_cell()\ - .store_uint(0, 32)\ - .store_uint(wallet_id, 32)\ - .store_bytes(self.public_key)\ - .end_cell() - - - hash_ = begin_cell().store_bit(False).store_bit(False).store_maybe_ref(code)\ - .store_maybe_ref(data)\ - .store_dict(None)\ - .end_cell().hash - - add = Address((wallet_details["workchain"], hash_)) - return add.to_str(is_bounceable=self.is_bounceable) - - def encode(self): - if self.version == "v5r1": - return self.v5r1Address() - elif self.version == "v4": - return self.v4Address() - elif self.version == "v3r2": - return self.v3r2Address() - else: - return self.v3r1Address() diff --git a/bip_utils/ton/keys/__init__.py b/bip_utils/ton/keys/__init__.py new file mode 100644 index 00000000..a2fe1bd7 --- /dev/null +++ b/bip_utils/ton/keys/__init__.py @@ -0,0 +1 @@ +from bip_utils.ton.keys.ton_keys import TonPrivateKey, TonPublicKey diff --git a/bip_utils/ton/ton_keys.py b/bip_utils/ton/keys/ton_keys.py similarity index 100% rename from bip_utils/ton/ton_keys.py rename to bip_utils/ton/keys/ton_keys.py diff --git a/bip_utils/ton/mnemonic/ton_mnemonic_generator.py b/bip_utils/ton/mnemonic/ton_mnemonic_generator.py index dfeaa250..48be2d07 100644 --- a/bip_utils/ton/mnemonic/ton_mnemonic_generator.py +++ b/bip_utils/ton/mnemonic/ton_mnemonic_generator.py @@ -72,7 +72,7 @@ def FromWordsNumber(self, Args: words_num (int or TonWordsNum, optional): Number of words (12 or 24 by default) - passphrase (str, optional): Passphrase (empty by default) + passphrase (str, optional) : Passphrase (empty by default) Returns: Mnemonic object: Generated mnemonic diff --git a/bip_utils/ton/mnemonic/ton_mnemonic_validator.py b/bip_utils/ton/mnemonic/ton_mnemonic_validator.py index 9decdde4..76519de5 100644 --- a/bip_utils/ton/mnemonic/ton_mnemonic_validator.py +++ b/bip_utils/ton/mnemonic/ton_mnemonic_validator.py @@ -64,7 +64,7 @@ def IsValid(self, Args: mnemonic (str or Mnemonic object): Mnemonic - passphrase (str, optional): Passphrase (empty by default) + passphrase (str, optional) : Passphrase (empty by default) Returns: bool: True if valid, False otherwise diff --git a/bip_utils/ton/mnemonic/ton_seed_generator.py b/bip_utils/ton/mnemonic/ton_seed_generator.py index ad69b900..3992977b 100644 --- a/bip_utils/ton/mnemonic/ton_seed_generator.py +++ b/bip_utils/ton/mnemonic/ton_seed_generator.py @@ -56,8 +56,8 @@ def __init__(self, Construct class. Args: - mnemonic (str or Mnemonic object) : Mnemonic - lang (TonLanguages, optional): Language (default: English) + mnemonic (str or Mnemonic object): Mnemonic + lang (TonLanguages, optional) : Language (default: English) Raises: ValueError: If the mnemonic is not valid @@ -74,7 +74,7 @@ def Generate(self, Generate seed. Args: - passphrase (str, optional): Passphrase (empty by default) + passphrase (str, optional) : Passphrase (empty by default) seed_type (TonSeedTypes, optional): Seed type (PRIVATE_KEY by default) Returns: diff --git a/bip_utils/ton/mnemonic/ton_seed_utils.py b/bip_utils/ton/mnemonic/ton_seed_utils.py index ccfe945d..93185149 100644 --- a/bip_utils/ton/mnemonic/ton_seed_utils.py +++ b/bip_utils/ton/mnemonic/ton_seed_utils.py @@ -61,7 +61,7 @@ def GetEntropyBytes(mnemonic: str, Args: mnemonic (str or Mnemonic object): Mnemonic - passphrase (str, optional): Passphrase (empty by default) + passphrase (str, optional) : Passphrase (empty by default) Returns: bytes: Entropy bytes diff --git a/bip_utils/ton/ton.py b/bip_utils/ton/ton.py index 4f5d9174..fb172ef7 100644 --- a/bip_utils/ton/ton.py +++ b/bip_utils/ton/ton.py @@ -25,9 +25,10 @@ from typing import Union +from bip_utils.addr.ton_addr import TonAddrEncoder from bip_utils.ecc.common.ikeys import IPrivateKey -from bip_utils.ton.address.ton_address_encoder import TonAddressEncoder -from bip_utils.ton.ton_keys import TonPrivateKey, TonPublicKey +from bip_utils.ton.addr import TonAddrVersions +from bip_utils.ton.keys import TonPrivateKey, TonPublicKey class Ton: @@ -90,18 +91,16 @@ def PrivateKey(self) -> TonPrivateKey: return self.m_priv_key def GetAddress(self, - version: str = "v5r1", + version: TonAddrVersions = TonAddrVersions.V5R1, is_bounceable: bool = False) -> str: """ Get address from public key. Args: - version (str, optional): Address version (default: v5r1) - is_bounceable (bool, optional): Whether the address is bounceable (default: False) + version (TonAddrVersions, optional): Address version (default: v5r1) + is_bounceable (bool, optional) : Whether the address is bounceable (default: False) Returns: - str: Generated address + str: Address string """ - return TonAddressEncoder(self.m_pub_key.RawUncompressed().ToBytes()[1:], - version, - is_bounceable).encode() + return TonAddrEncoder.EncodeKey(self.m_pub_key.KeyObject(), version=version, is_bounceable=is_bounceable) diff --git a/bip_utils/utils/misc/__init__.py b/bip_utils/utils/misc/__init__.py index 7508bcd8..44618424 100644 --- a/bip_utils/utils/misc/__init__.py +++ b/bip_utils/utils/misc/__init__.py @@ -1,5 +1,6 @@ from bip_utils.utils.misc.algo import AlgoUtils from bip_utils.utils.misc.base32 import Base32Decoder, Base32Encoder +from bip_utils.utils.misc.base64 import Base64Decoder, Base64Encoder from bip_utils.utils.misc.bit import BitUtils from bip_utils.utils.misc.bytes import BytesUtils from bip_utils.utils.misc.cbor_indefinite_len_array import CborIndefiniteLenArrayDecoder, CborIndefiniteLenArrayEncoder diff --git a/bip_utils/utils/misc/base64.py b/bip_utils/utils/misc/base64.py new file mode 100644 index 00000000..52f24744 --- /dev/null +++ b/bip_utils/utils/misc/base64.py @@ -0,0 +1,74 @@ +# Copyright (c) 2021 Emanuele Bellocchia +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +"""Module with helper class for Base32.""" + +# Imports +import base64 +import binascii +from typing import Union + +from bip_utils.utils.misc.algo import AlgoUtils + + +class Base64Decoder: + """ + Base64 decoder class. + It provides methods for decoding to Base64 format. + """ + + @staticmethod + def Decode(data: str) -> bytes: + """ + Decode from Base64. + + Args: + data (str): Data + + Returns: + bytes: Decoded bytes + + Raises: + ValueError: If the Base64 string is not valid + """ + try: + return base64.b64decode(data) + except binascii.Error as ex: + raise ValueError("Invalid Base64 string") from ex + + +class Base64Encoder: + """ + Base64 encoder class. + It provides methods for encoding to Base64 format. + """ + + @staticmethod + def Encode(data: Union[bytes, str]) -> bytes: + """ + Encode to Base64. + + Args: + data (str or bytes): Data + + Returns: + str: Encoded string + """ + return base64.b64encode(AlgoUtils.Encode(data)) diff --git a/examples/ton.py b/examples/ton.py index 7b103fa0..efc00ae8 100644 --- a/examples/ton.py +++ b/examples/ton.py @@ -2,7 +2,7 @@ from bip_utils import ( Bip32Ed25519Slip, Bip39SeedGenerator, Bip44, Bip44Coins, Bip44ConfGetter, - TonSeedGenerator, TonMnemonicGenerator, TonMnemonicValidator, Ton + TonSeedGenerator, TonMnemonicGenerator, TonMnemonicValidator, Ton, TonAddrVersions ) # Generate mnemonic for Ton wallets (e.g. Tonkeeper) @@ -16,12 +16,12 @@ # Generate seed and address from memonic seed_bytes = TonSeedGenerator(mnemonic).Generate() -# Default address type is v5r1 -addr = Ton.FromSeed(seed_bytes).GetAddress() +# Generate v5r1 address +addr = Ton.FromSeed(seed_bytes).GetAddress(TonAddrVersions.V5R1) print(f"V5R1 Address: {addr}") # Generate v4 address -addr_v4 = Ton.FromSeed(seed_bytes).GetAddress("v4") +addr_v4 = Ton.FromSeed(seed_bytes).GetAddress(TonAddrVersions.V4) print(f"V4 Address: {addr_v4}") From c01fd0d55a58dacdb6b0c1830bd084246273433f Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Thu, 26 Feb 2026 15:30:54 +0100 Subject: [PATCH 26/66] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 02a5f43b..0de20bd8 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,7 @@ Package dependencies: - [ed25519-blake2b](https://pypi.org/project/ed25519-blake2b/) for ed25519-blake2b curve - [pynacl](https://pypi.org/project/PyNaCl/) for ed25519 curve - [py-sr25519-bindings](https://pypi.org/project/py-sr25519-bindings/) for sr25519 curve +- [pytoniq_core](https://pypi.org/project/pytoniq-core/) for TON primitives Please note that, for the py-sr25519-bindings library, Rust is required to be installed. From 63d5d1324f648921438fc5a14038f2f0b3b5565e Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Thu, 26 Feb 2026 15:31:07 +0100 Subject: [PATCH 27/66] Alignment --- .github/workflows/test_min_reqs.yml | 49 +++++++++++++++++++++++------ requirements.txt | 7 +++-- 2 files changed, 44 insertions(+), 12 deletions(-) diff --git a/.github/workflows/test_min_reqs.yml b/.github/workflows/test_min_reqs.yml index 4c5e99be..a77bf2df 100644 --- a/.github/workflows/test_min_reqs.yml +++ b/.github/workflows/test_min_reqs.yml @@ -52,16 +52,15 @@ jobs: pip install pycryptodome==3.15 pip install pynacl==1.5 pip install py-sr25519-bindings==0.1.3 - pip install typing_extensions>=3.7.2 + pip install typing_extensions - name: Run tests run: | pytest - test_min_reqs_py38_39: + test_min_reqs_py38: strategy: fail-fast: false matrix: - python-version: ["3.8", "3.9"] # Same minimum requirements os: - ubuntu-latest - macOS-14 @@ -69,10 +68,10 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} + - name: Set up Python 3.8 uses: actions/setup-python@v3 with: - python-version: ${{ matrix.python-version }} + python-version: "3.8" - name: Install minimum dependencies run: | python -m pip install --upgrade pip @@ -89,6 +88,38 @@ jobs: run: | pytest + test_min_reqs_py39: + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - macOS-14 + - windows-latest + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3.9 + uses: actions/setup-python@v3 + with: + python-version: "3.9" + - name: Install minimum dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements-dev.txt + pip install cbor2==5.5.0 + pip install coincurve==${{ runner.os == 'macOS' && '18.0.0' || '15.0.1' }} + pip install crcmod==1.7 + pip install ecdsa==0.17 + pip install ed25519-blake2b==1.4 + pip install pycryptodome==3.15 + pip install pynacl==1.5 + pip install py-sr25519-bindings==0.1.3 + - name: Run tests + run: | + pytest + + test_min_reqs_py310: strategy: fail-fast: false @@ -108,7 +139,7 @@ jobs: run: | python -m pip install --upgrade pip pip install -r requirements-dev.txt - pip install cbor2==5.1.2 + pip install cbor2==5.5.0 pip install coincurve==${{ runner.os == 'macOS' && '18.0.0' || '16.0.0' }} pip install crcmod==1.7 pip install ecdsa==0.17 @@ -139,7 +170,7 @@ jobs: run: | python -m pip install --upgrade pip pip install -r requirements-dev.txt - pip install cbor2==5.1.2 + pip install cbor2==5.5.0 pip install coincurve==18.0.0 pip install crcmod==1.7 pip install ecdsa==0.17 @@ -170,7 +201,7 @@ jobs: run: | python -m pip install --upgrade pip pip install -r requirements-dev.txt - pip install cbor2==5.1.2 + pip install cbor2==5.5.0 pip install coincurve==19.0.1 pip install crcmod==1.7 pip install ecdsa==0.17 @@ -201,7 +232,7 @@ jobs: run: | python -m pip install --upgrade pip pip install -r requirements-dev.txt - pip install cbor2==5.1.2 + pip install cbor2==5.5.0 pip install coincurve==21.0.0 pip install crcmod==1.7 pip install ecdsa==0.17 diff --git a/requirements.txt b/requirements.txt index 5cc7b144..e40de614 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ -cbor2>=5.1.2,<6.0.0 +cbor2>=5.1.2,<6.0.0; python_version < '3.9' +cbor2>=5.5.0,<6.0.0; python_version >= '3.9' coincurve>=15.0.1,<19.0.0; python_version == '3.7' coincurve>=15.0.1; python_version > '3.7' and python_version < '3.10' coincurve>=16.0.0; python_version == '3.10' @@ -15,5 +16,5 @@ py-sr25519-bindings>=0.1.3,<2.0.0; python_version < '3.10' py-sr25519-bindings>=0.1.4,<2.0.0; python_version == '3.10' py-sr25519-bindings>=0.2.0,<2.0.0; python_version >= '3.11' py-sr25519-bindings>=0.2.2,<2.0.0; python_version >= '3.13' -typing_extensions>=3.7.2; python_version == '3.7' -pytoniq_core \ No newline at end of file +pytoniq_core +typing_extensions; python_version == '3.7' From 46cd3e0b610d4cb606d87b4762481285dc31e463 Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Thu, 26 Feb 2026 16:09:39 +0100 Subject: [PATCH 28/66] Update Ton example --- bip_utils/bip/conf/bip44/bip44_conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bip_utils/bip/conf/bip44/bip44_conf.py b/bip_utils/bip/conf/bip44/bip44_conf.py index a3cb9531..3e62b094 100644 --- a/bip_utils/bip/conf/bip44/bip44_conf.py +++ b/bip_utils/bip/conf/bip44/bip44_conf.py @@ -1346,7 +1346,7 @@ class Bip44Conf: coin_names=CoinsConf.Ton.CoinNames(), coin_idx=Slip44.TON, is_testnet=False, - def_path=DER_PATH_HARDENED_FULL, + def_path=DER_PATH_HARDENED_SHORT, key_net_ver=_BIP44_BTC_KEY_NET_VER_MAIN, wif_net_ver=None, bip32_cls=Bip32Slip10Ed25519, From e5999c509214ccc8984b10b99840e13201b3e757 Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Thu, 26 Feb 2026 16:09:50 +0100 Subject: [PATCH 29/66] ruff fix --- examples/bip32_slip10_nist256p1.py | 7 ++++++- examples/bip39_to_algorand.py | 9 +++++++-- examples/cardano_byron.py | 12 ++++++++++-- examples/cardano_shelley.py | 12 +++++++++--- examples/electrum.py | 18 +++++++++++++++--- 5 files changed, 47 insertions(+), 11 deletions(-) diff --git a/examples/bip32_slip10_nist256p1.py b/examples/bip32_slip10_nist256p1.py index 588367ae..f1b9b349 100644 --- a/examples/bip32_slip10_nist256p1.py +++ b/examples/bip32_slip10_nist256p1.py @@ -1,7 +1,12 @@ """Example of keys derivation using BIP32 (nist256p1 curve).""" from bip_utils import ( - Bip32Slip10Nist256p1, Bip39MnemonicGenerator, Bip39SeedGenerator, Bip39WordsNum, CoinsConf, NeoLegacyAddrEncoder + Bip32Slip10Nist256p1, + Bip39MnemonicGenerator, + Bip39SeedGenerator, + Bip39WordsNum, + CoinsConf, + NeoLegacyAddrEncoder, ) diff --git a/examples/bip39_to_algorand.py b/examples/bip39_to_algorand.py index d001e5bf..5ad56db3 100644 --- a/examples/bip39_to_algorand.py +++ b/examples/bip39_to_algorand.py @@ -9,8 +9,13 @@ from enum import Enum, auto, unique from bip_utils import ( - AlgorandMnemonicGenerator, Bip32KholawEd25519, Bip32Slip10Ed25519, Bip32Slip10Secp256k1, Bip39SeedGenerator, - BytesUtils, Ed25519PrivateKey + AlgorandMnemonicGenerator, + Bip32KholawEd25519, + Bip32Slip10Ed25519, + Bip32Slip10Secp256k1, + Bip39SeedGenerator, + BytesUtils, + Ed25519PrivateKey, ) diff --git a/examples/cardano_byron.py b/examples/cardano_byron.py index 48827cfb..74de85de 100644 --- a/examples/cardano_byron.py +++ b/examples/cardano_byron.py @@ -1,8 +1,16 @@ """Example of key derivation for Cardano (Byron addresses).""" from bip_utils import ( - Bip39MnemonicGenerator, Bip39SeedGenerator, Bip39WordsNum, Bip44, Bip44Changes, Bip44Coins, BytesUtils, - CardanoByronLegacy, CardanoByronLegacySeedGenerator, CardanoIcarusSeedGenerator + Bip39MnemonicGenerator, + Bip39SeedGenerator, + Bip39WordsNum, + Bip44, + Bip44Changes, + Bip44Coins, + BytesUtils, + CardanoByronLegacy, + CardanoByronLegacySeedGenerator, + CardanoIcarusSeedGenerator, ) diff --git a/examples/cardano_shelley.py b/examples/cardano_shelley.py index 5ed5b1e1..ed656e21 100644 --- a/examples/cardano_shelley.py +++ b/examples/cardano_shelley.py @@ -1,8 +1,14 @@ """Example of key derivation for Cardano (Shelley addresses).""" from bip_utils import ( - Bip39MnemonicGenerator, Bip39SeedGenerator, Bip39WordsNum, Bip44Changes, CardanoIcarusSeedGenerator, CardanoShelley, - Cip1852, Cip1852Coins + Bip39MnemonicGenerator, + Bip39SeedGenerator, + Bip39WordsNum, + Bip44Changes, + CardanoIcarusSeedGenerator, + CardanoShelley, + Cip1852, + Cip1852Coins, ) @@ -86,4 +92,4 @@ print(f" {i}. Address chain code (bytes): {shelley_addr_ctx.PublicKeys().AddressKey().ChainCode().ToHex()}") print(f" {i}. Address public key (bytes): {shelley_addr_ctx.PublicKeys().AddressKey().RawCompressed().ToHex()[2:]}") print(f" {i}. Address private key (bytes): {shelley_addr_ctx.PrivateKeys().AddressKey().Raw().ToHex()}") - print(f" {i}. Address: {shelley_addr_ctx.PublicKeys().ToAddress()}") \ No newline at end of file + print(f" {i}. Address: {shelley_addr_ctx.PublicKeys().ToAddress()}") diff --git a/examples/electrum.py b/examples/electrum.py index 2b3c4427..9d4f2cda 100644 --- a/examples/electrum.py +++ b/examples/electrum.py @@ -1,9 +1,21 @@ """Example of mnemonic generation and keys derivation like the Electrum wallet.""" from bip_utils import ( - BytesUtils, CoinsConf, ElectrumV1, ElectrumV1MnemonicGenerator, ElectrumV1SeedGenerator, ElectrumV1WordsNum, - ElectrumV2MnemonicGenerator, ElectrumV2MnemonicTypes, ElectrumV2SeedGenerator, ElectrumV2Segwit, ElectrumV2Standard, - ElectrumV2WordsNum, IPrivateKey, WifEncoder, WifPubKeyModes + BytesUtils, + CoinsConf, + ElectrumV1, + ElectrumV1MnemonicGenerator, + ElectrumV1SeedGenerator, + ElectrumV1WordsNum, + ElectrumV2MnemonicGenerator, + ElectrumV2MnemonicTypes, + ElectrumV2SeedGenerator, + ElectrumV2Segwit, + ElectrumV2Standard, + ElectrumV2WordsNum, + IPrivateKey, + WifEncoder, + WifPubKeyModes, ) From e0018d181647cddc2f8340ce8ca0a3811effb1da Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Thu, 26 Feb 2026 16:10:36 +0100 Subject: [PATCH 30/66] Update TON example --- examples/ton.py | 83 ++++++++++++++++++++++++------------------------- 1 file changed, 41 insertions(+), 42 deletions(-) diff --git a/examples/ton.py b/examples/ton.py index efc00ae8..49004cb6 100644 --- a/examples/ton.py +++ b/examples/ton.py @@ -1,56 +1,55 @@ """Example of mnemonic generation and key derivation for TON.""" from bip_utils import ( - Bip32Ed25519Slip, Bip39SeedGenerator, Bip44, Bip44Coins, Bip44ConfGetter, - TonSeedGenerator, TonMnemonicGenerator, TonMnemonicValidator, Ton, TonAddrVersions + Bip32Ed25519Slip, + Bip39MnemonicGenerator, + Bip39SeedGenerator, + Bip39WordsNum, + Bip44, + Bip44Coins, + Bip44ConfGetter, + TonAddrEncoder, + TonAddrVersions, ) -# Generate mnemonic for Ton wallets (e.g. Tonkeeper) -mnemonic = TonMnemonicGenerator().FromWordsNumber(24) -print(f"Mnemonic: {mnemonic}") -# Validate mnemonic -is_valid = TonMnemonicValidator().IsValid(mnemonic) -print(f"Is the mnemonic valid? {is_valid}") +# +# Generation like Tonkeeper, Tonwallet, Trustwallet +# -# Generate seed and address from memonic -seed_bytes = TonSeedGenerator(mnemonic).Generate() - -# Generate v5r1 address -addr = Ton.FromSeed(seed_bytes).GetAddress(TonAddrVersions.V5R1) -print(f"V5R1 Address: {addr}") - -# Generate v4 address -addr_v4 = Ton.FromSeed(seed_bytes).GetAddress(TonAddrVersions.V4) -print(f"V4 Address: {addr_v4}") - - -# Generate addresses based on bip44 (e.g. Trustwallet or Ledger) - -# Mnemonic -mnemonic = "bachelor neither fall observe flee give sniff rebel access maximum property beach" +# Generate random mnemonic +mnemonic = Bip39MnemonicGenerator().FromWordsNumber(Bip39WordsNum.WORDS_NUM_24) +print(f"Mnemonic string: {mnemonic}") # Generate seed from mnemonic seed_bytes = Bip39SeedGenerator(mnemonic).Generate() -coin_type = Bip44Coins.TON - -# Get address using the Trustwallet derivation path -bip44_mst = Bip44.FromSeed(seed_bytes, coin_type) -bip44_acc = bip44_mst.Purpose().Coin().Account(0) -addr = bip44_acc.PublicKey().ToAddress() -print(f"Address using Trustwallet derivation path: {addr}") - -# Ledger uses a non-standard derivation path, so we need to use Bip32 directly +# Construct from seed +bip44_mst_ctx = Bip44.FromSeed(seed_bytes, Bip44Coins.TON) +bip44_def_ctx = bip44_mst_ctx.DeriveDefaultPath() + +# Print keys +print(f"Ton private key: {bip44_def_ctx.PrivateKey().Raw().ToHex()}") +print(f"Ton public key: {bip44_def_ctx.PublicKey().RawCompressed().ToHex()[1:]}") +# Print address (default version is V4) +print(f"Ton address (V4): {bip44_def_ctx.PublicKey().ToAddress()}") +# Print address with other versions +pub_key_obj = bip44_def_ctx.PublicKey().Bip32Key().KeyObject() +print(f"Ton address (V3R1): {TonAddrEncoder.EncodeKey(pub_key_obj, version=TonAddrVersions.V3R1)}") +print(f"Ton address (V3R2): {TonAddrEncoder.EncodeKey(pub_key_obj, version=TonAddrVersions.V3R2)}") +print(f"Ton address (V5R1): {TonAddrEncoder.EncodeKey(pub_key_obj, version=TonAddrVersions.V5R1)}") + +# +# Generation like Ledger +# # Get coin index from configuration -coin_idx = Bip44ConfGetter.GetConfig(coin_type).CoinIndex() -# Account index -account_idx = 0 -derivation_path = f"m/44'/{coin_idx}'/0'/0'/{account_idx}'/0'" - +coin_idx = Bip44ConfGetter.GetConfig(Bip44Coins.TON).CoinIndex() +# Derive +derivation_path = f"m/44'/{coin_idx}'/0'/0'/0'/0'" bip32_ctx = Bip32Ed25519Slip.FromSeed(seed_bytes).DerivePath(derivation_path) -priv_key_bytes = bip32_ctx.PrivateKey().Raw().ToBytes() -bip44_ctx = Bip44.FromPrivateKey(priv_key_bytes, coin_type) -addr = bip44_ctx.PublicKey().ToAddress() -print(f"Address using Ledger derivation path: {addr}") +# Construct BIP44 object from private key +priv_key_bytes = bip32_ctx.PrivateKey().Raw().ToBytes() +bip44_ctx = Bip44.FromPrivateKey(priv_key_bytes, Bip44Coins.TON) +# Print address +print(f"Ton address (Ledger, V4): {bip44_ctx.PublicKey().ToAddress()}") From 9a6851f13367b9ff22527d902d5447983e5cc27a Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Thu, 26 Feb 2026 16:13:09 +0100 Subject: [PATCH 31/66] Add ton to toml/doc --- README.md | 1 + pyproject.toml | 1 + pyproject_legacy.toml | 1 + readme/bip44.md | 1 + 4 files changed, 4 insertions(+) diff --git a/README.md b/README.md index 0de20bd8..ba5a8d81 100644 --- a/README.md +++ b/README.md @@ -121,6 +121,7 @@ Supported BIP coins: - Terra - Tezos - Theta Network +- Ton - Tron - VeChain - Verge diff --git a/pyproject.toml b/pyproject.toml index aac478cd..97024308 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -121,6 +121,7 @@ keywords = [ "terra", "tezos", "theta", + "ton", "tron", "vechain", "verge", diff --git a/pyproject_legacy.toml b/pyproject_legacy.toml index a7396a22..982b0b36 100644 --- a/pyproject_legacy.toml +++ b/pyproject_legacy.toml @@ -128,6 +128,7 @@ keywords = [ "terra", "tezos", "theta", + "ton", "tron", "vechain", "verge", diff --git a/readme/bip44.md b/readme/bip44.md index 10d3e75d..cbc98a90 100644 --- a/readme/bip44.md +++ b/readme/bip44.md @@ -91,6 +91,7 @@ Supported coins enumerative for BIP-0044: |Terra|`Bip44Coins.TERRA`|-| |Tezos|`Bip44Coins.TEZOS`|-| |Theta Network|`Bip44Coins.THETA`|-| +|Ton|`Bip44Coins.TON`|-| |Tron|`Bip44Coins.TRON`|-| |VeChain|`Bip44Coins.VECHAIN`|-| |Verge|`Bip44Coins.VERGE`|-| From 6767664f3675bd2e78c885586502e7b3ab1cc823 Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Thu, 26 Feb 2026 16:13:31 +0100 Subject: [PATCH 32/66] Update docs --- docs/bip_utils/addr/index.rst | 1 + docs/bip_utils/addr/ton_addr.rst | 7 +++++++ docs/bip_utils/index.rst | 1 + docs/bip_utils/ton/addr/index.rst | 10 ++++++++++ docs/bip_utils/ton/addr/ton_addr_versions.rst | 7 +++++++ docs/bip_utils/ton/addr/ton_v3r1_addr_encoder.rst | 7 +++++++ docs/bip_utils/ton/addr/ton_v3r2_addr_encoder.rst | 7 +++++++ docs/bip_utils/ton/addr/ton_v4_addr_encoder.rst | 7 +++++++ docs/bip_utils/ton/addr/ton_v5r1_addr_encoder.rst | 7 +++++++ docs/bip_utils/ton/index.rst | 10 ++++++++++ docs/bip_utils/ton/keys/index.rst | 6 ++++++ docs/bip_utils/ton/keys/ton_keys.rst | 7 +++++++ docs/bip_utils/ton/mnemonic/index.rst | 10 ++++++++++ docs/bip_utils/ton/mnemonic/ton_mnemonic.rst | 7 +++++++ docs/bip_utils/ton/mnemonic/ton_mnemonic_generator.rst | 7 +++++++ docs/bip_utils/ton/mnemonic/ton_mnemonic_validator.rst | 7 +++++++ docs/bip_utils/ton/mnemonic/ton_seed_generator.rst | 7 +++++++ docs/bip_utils/ton/mnemonic/ton_seed_utils.rst | 7 +++++++ docs/bip_utils/ton/ton.rst | 7 +++++++ docs/bip_utils/ton/ton_ex.rst | 7 +++++++ docs/bip_utils/utils/misc/base64.rst | 7 +++++++ docs/bip_utils/utils/misc/index.rst | 1 + 22 files changed, 144 insertions(+) create mode 100644 docs/bip_utils/addr/ton_addr.rst create mode 100644 docs/bip_utils/ton/addr/index.rst create mode 100644 docs/bip_utils/ton/addr/ton_addr_versions.rst create mode 100644 docs/bip_utils/ton/addr/ton_v3r1_addr_encoder.rst create mode 100644 docs/bip_utils/ton/addr/ton_v3r2_addr_encoder.rst create mode 100644 docs/bip_utils/ton/addr/ton_v4_addr_encoder.rst create mode 100644 docs/bip_utils/ton/addr/ton_v5r1_addr_encoder.rst create mode 100644 docs/bip_utils/ton/index.rst create mode 100644 docs/bip_utils/ton/keys/index.rst create mode 100644 docs/bip_utils/ton/keys/ton_keys.rst create mode 100644 docs/bip_utils/ton/mnemonic/index.rst create mode 100644 docs/bip_utils/ton/mnemonic/ton_mnemonic.rst create mode 100644 docs/bip_utils/ton/mnemonic/ton_mnemonic_generator.rst create mode 100644 docs/bip_utils/ton/mnemonic/ton_mnemonic_validator.rst create mode 100644 docs/bip_utils/ton/mnemonic/ton_seed_generator.rst create mode 100644 docs/bip_utils/ton/mnemonic/ton_seed_utils.rst create mode 100644 docs/bip_utils/ton/ton.rst create mode 100644 docs/bip_utils/ton/ton_ex.rst create mode 100644 docs/bip_utils/utils/misc/base64.rst diff --git a/docs/bip_utils/addr/index.rst b/docs/bip_utils/addr/index.rst index 3403d4bc..d28d73ef 100644 --- a/docs/bip_utils/addr/index.rst +++ b/docs/bip_utils/addr/index.rst @@ -37,6 +37,7 @@ addr sol_addr substrate_addr sui_addr + ton_addr trx_addr xlm_addr xmr_addr diff --git a/docs/bip_utils/addr/ton_addr.rst b/docs/bip_utils/addr/ton_addr.rst new file mode 100644 index 00000000..a431a4cf --- /dev/null +++ b/docs/bip_utils/addr/ton_addr.rst @@ -0,0 +1,7 @@ +ton_addr +======== + +.. automodule:: bip_utils.addr.ton_addr + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/bip_utils/index.rst b/docs/bip_utils/index.rst index ec518f01..bd4f7a3e 100644 --- a/docs/bip_utils/index.rst +++ b/docs/bip_utils/index.rst @@ -18,5 +18,6 @@ bip_utils solana/index.rst ss58/index.rst substrate/index.rst + ton/index.rst utils/index.rst wif/index.rst diff --git a/docs/bip_utils/ton/addr/index.rst b/docs/bip_utils/ton/addr/index.rst new file mode 100644 index 00000000..cfe54cde --- /dev/null +++ b/docs/bip_utils/ton/addr/index.rst @@ -0,0 +1,10 @@ +addr +==== +.. toctree:: + :maxdepth: 10 + + ton_addr_versions + ton_v3r1_addr_encoder + ton_v3r2_addr_encoder + ton_v4_addr_encoder + ton_v5r1_addr_encoder diff --git a/docs/bip_utils/ton/addr/ton_addr_versions.rst b/docs/bip_utils/ton/addr/ton_addr_versions.rst new file mode 100644 index 00000000..4a63b6ae --- /dev/null +++ b/docs/bip_utils/ton/addr/ton_addr_versions.rst @@ -0,0 +1,7 @@ +ton_addr_versions +================= + +.. automodule:: bip_utils.ton.addr.ton_addr_versions + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/bip_utils/ton/addr/ton_v3r1_addr_encoder.rst b/docs/bip_utils/ton/addr/ton_v3r1_addr_encoder.rst new file mode 100644 index 00000000..5912e247 --- /dev/null +++ b/docs/bip_utils/ton/addr/ton_v3r1_addr_encoder.rst @@ -0,0 +1,7 @@ +ton_v3r1_addr_encoder +===================== + +.. automodule:: bip_utils.ton.addr.ton_v3r1_addr_encoder + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/bip_utils/ton/addr/ton_v3r2_addr_encoder.rst b/docs/bip_utils/ton/addr/ton_v3r2_addr_encoder.rst new file mode 100644 index 00000000..9603d5f3 --- /dev/null +++ b/docs/bip_utils/ton/addr/ton_v3r2_addr_encoder.rst @@ -0,0 +1,7 @@ +ton_v3r2_addr_encoder +===================== + +.. automodule:: bip_utils.ton.addr.ton_v3r2_addr_encoder + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/bip_utils/ton/addr/ton_v4_addr_encoder.rst b/docs/bip_utils/ton/addr/ton_v4_addr_encoder.rst new file mode 100644 index 00000000..7fad5f08 --- /dev/null +++ b/docs/bip_utils/ton/addr/ton_v4_addr_encoder.rst @@ -0,0 +1,7 @@ +ton_v4_addr_encoder +=================== + +.. automodule:: bip_utils.ton.addr.ton_v4_addr_encoder + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/bip_utils/ton/addr/ton_v5r1_addr_encoder.rst b/docs/bip_utils/ton/addr/ton_v5r1_addr_encoder.rst new file mode 100644 index 00000000..b87e5669 --- /dev/null +++ b/docs/bip_utils/ton/addr/ton_v5r1_addr_encoder.rst @@ -0,0 +1,7 @@ +ton_v5r1_addr_encoder +===================== + +.. automodule:: bip_utils.ton.addr.ton_v5r1_addr_encoder + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/bip_utils/ton/index.rst b/docs/bip_utils/ton/index.rst new file mode 100644 index 00000000..85875f68 --- /dev/null +++ b/docs/bip_utils/ton/index.rst @@ -0,0 +1,10 @@ +ton +=== +.. toctree:: + :maxdepth: 10 + + addr/index.rst + keys/index.rst + mnemonic/index.rst + ton + ton_ex diff --git a/docs/bip_utils/ton/keys/index.rst b/docs/bip_utils/ton/keys/index.rst new file mode 100644 index 00000000..67041a25 --- /dev/null +++ b/docs/bip_utils/ton/keys/index.rst @@ -0,0 +1,6 @@ +keys +==== +.. toctree:: + :maxdepth: 10 + + ton_keys diff --git a/docs/bip_utils/ton/keys/ton_keys.rst b/docs/bip_utils/ton/keys/ton_keys.rst new file mode 100644 index 00000000..a9e21d71 --- /dev/null +++ b/docs/bip_utils/ton/keys/ton_keys.rst @@ -0,0 +1,7 @@ +ton_keys +======== + +.. automodule:: bip_utils.ton.keys.ton_keys + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/bip_utils/ton/mnemonic/index.rst b/docs/bip_utils/ton/mnemonic/index.rst new file mode 100644 index 00000000..1cc69cea --- /dev/null +++ b/docs/bip_utils/ton/mnemonic/index.rst @@ -0,0 +1,10 @@ +mnemonic +======== +.. toctree:: + :maxdepth: 10 + + ton_mnemonic + ton_mnemonic_generator + ton_mnemonic_validator + ton_seed_generator + ton_seed_utils diff --git a/docs/bip_utils/ton/mnemonic/ton_mnemonic.rst b/docs/bip_utils/ton/mnemonic/ton_mnemonic.rst new file mode 100644 index 00000000..278a9820 --- /dev/null +++ b/docs/bip_utils/ton/mnemonic/ton_mnemonic.rst @@ -0,0 +1,7 @@ +ton_mnemonic +============ + +.. automodule:: bip_utils.ton.mnemonic.ton_mnemonic + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/bip_utils/ton/mnemonic/ton_mnemonic_generator.rst b/docs/bip_utils/ton/mnemonic/ton_mnemonic_generator.rst new file mode 100644 index 00000000..c3596f7b --- /dev/null +++ b/docs/bip_utils/ton/mnemonic/ton_mnemonic_generator.rst @@ -0,0 +1,7 @@ +ton_mnemonic_generator +====================== + +.. automodule:: bip_utils.ton.mnemonic.ton_mnemonic_generator + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/bip_utils/ton/mnemonic/ton_mnemonic_validator.rst b/docs/bip_utils/ton/mnemonic/ton_mnemonic_validator.rst new file mode 100644 index 00000000..6e7d55a0 --- /dev/null +++ b/docs/bip_utils/ton/mnemonic/ton_mnemonic_validator.rst @@ -0,0 +1,7 @@ +ton_mnemonic_validator +====================== + +.. automodule:: bip_utils.ton.mnemonic.ton_mnemonic_validator + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/bip_utils/ton/mnemonic/ton_seed_generator.rst b/docs/bip_utils/ton/mnemonic/ton_seed_generator.rst new file mode 100644 index 00000000..2d73c88a --- /dev/null +++ b/docs/bip_utils/ton/mnemonic/ton_seed_generator.rst @@ -0,0 +1,7 @@ +ton_seed_generator +================== + +.. automodule:: bip_utils.ton.mnemonic.ton_seed_generator + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/bip_utils/ton/mnemonic/ton_seed_utils.rst b/docs/bip_utils/ton/mnemonic/ton_seed_utils.rst new file mode 100644 index 00000000..d1cb133f --- /dev/null +++ b/docs/bip_utils/ton/mnemonic/ton_seed_utils.rst @@ -0,0 +1,7 @@ +ton_seed_utils +============== + +.. automodule:: bip_utils.ton.mnemonic.ton_seed_utils + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/bip_utils/ton/ton.rst b/docs/bip_utils/ton/ton.rst new file mode 100644 index 00000000..43e5d0c8 --- /dev/null +++ b/docs/bip_utils/ton/ton.rst @@ -0,0 +1,7 @@ +ton +=== + +.. automodule:: bip_utils.ton.ton + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/bip_utils/ton/ton_ex.rst b/docs/bip_utils/ton/ton_ex.rst new file mode 100644 index 00000000..30aa0e5d --- /dev/null +++ b/docs/bip_utils/ton/ton_ex.rst @@ -0,0 +1,7 @@ +ton_ex +====== + +.. automodule:: bip_utils.ton.ton_ex + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/bip_utils/utils/misc/base64.rst b/docs/bip_utils/utils/misc/base64.rst new file mode 100644 index 00000000..6d10ba12 --- /dev/null +++ b/docs/bip_utils/utils/misc/base64.rst @@ -0,0 +1,7 @@ +base64 +====== + +.. automodule:: bip_utils.utils.misc.base64 + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/bip_utils/utils/misc/index.rst b/docs/bip_utils/utils/misc/index.rst index 6fe18402..f07656c8 100644 --- a/docs/bip_utils/utils/misc/index.rst +++ b/docs/bip_utils/utils/misc/index.rst @@ -5,6 +5,7 @@ misc algo base32 + base64 bit bytes cbor_indefinite_len_array From 51f9c844645551ad6386ee0b539ba705326bcc94 Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Thu, 26 Feb 2026 16:17:15 +0100 Subject: [PATCH 33/66] Update addr.md --- readme/utility/addr.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/readme/utility/addr.md b/readme/utility/addr.md index 73957430..03264743 100644 --- a/readme/utility/addr.md +++ b/readme/utility/addr.md @@ -201,6 +201,15 @@ The address library allows encoding/decoding addresses for all the supported coi pub_key_hash = MvrkAddrDecoder.DecodeAddr(addr, prefix=MvrkAddrPrefixes.MV1) + # Ton address with custom parameters + addr = TonAddrEncoder.EncodeKey(pub_key, + version=TonAddrVersions.V4) + # Or with the default parameters from BIP configuration: + addr = TonAddrEncoder.EncodeKey(pub_key, + **Bip44Conf.Ton.AddrParams()) + # NOTE: TonAddrDecoder is not currently implemented + + **Code example (coins based on the ed25519-blake2b curve)** import binascii From ce907fc9439fee5d4d757112632384422f3295da Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Thu, 26 Feb 2026 22:08:57 +0100 Subject: [PATCH 34/66] Add missing imports --- bip_utils/__init__.py | 2 ++ bip_utils/ton/mnemonic/__init__.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/bip_utils/__init__.py b/bip_utils/__init__.py index 42a9f899..dc9886de 100644 --- a/bip_utils/__init__.py +++ b/bip_utils/__init__.py @@ -408,6 +408,8 @@ TonMnemonicGenerator, TonMnemonicValidator, TonSeedGenerator, + TonSeedTypes, + TonWordsNum, ) # Utils diff --git a/bip_utils/ton/mnemonic/__init__.py b/bip_utils/ton/mnemonic/__init__.py index f99d691c..3bc984d7 100644 --- a/bip_utils/ton/mnemonic/__init__.py +++ b/bip_utils/ton/mnemonic/__init__.py @@ -1,4 +1,4 @@ from bip_utils.ton.mnemonic.ton_mnemonic import TonLanguages, TonMnemonic, TonWordsNum from bip_utils.ton.mnemonic.ton_mnemonic_generator import TonMnemonicGenerator from bip_utils.ton.mnemonic.ton_mnemonic_validator import TonMnemonicValidator -from bip_utils.ton.mnemonic.ton_seed_generator import TonSeedGenerator +from bip_utils.ton.mnemonic.ton_seed_generator import TonSeedGenerator, TonSeedTypes From a96a1c0858e6622b7a49046a9bbee6f835d24bf6 Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Thu, 26 Feb 2026 22:09:01 +0100 Subject: [PATCH 35/66] Update requirements.txt --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index e40de614..f1b43501 100644 --- a/requirements.txt +++ b/requirements.txt @@ -16,5 +16,5 @@ py-sr25519-bindings>=0.1.3,<2.0.0; python_version < '3.10' py-sr25519-bindings>=0.1.4,<2.0.0; python_version == '3.10' py-sr25519-bindings>=0.2.0,<2.0.0; python_version >= '3.11' py-sr25519-bindings>=0.2.2,<2.0.0; python_version >= '3.13' -pytoniq_core +pytoniq_core>=0.1.0,<0.2.0 typing_extensions; python_version == '3.7' From 3aa7725e4f1696dd2460eb50db4d215c14a33b49 Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Thu, 26 Feb 2026 22:09:12 +0100 Subject: [PATCH 36/66] Update Ton example --- examples/ton.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/examples/ton.py b/examples/ton.py index 49004cb6..00cfd63d 100644 --- a/examples/ton.py +++ b/examples/ton.py @@ -10,8 +10,41 @@ Bip44ConfGetter, TonAddrEncoder, TonAddrVersions, + TonMnemonicGenerator, + TonMnemonicValidator, + TonSeedGenerator, + TonSeedTypes, + TonWordsNum, + Ton, ) +# +# Generation like ton-crypto +# + +# Generate random mnemonic +mnemonic = TonMnemonicGenerator().FromWordsNumber(TonWordsNum.WORDS_NUM_24) +print(f"Mnemonic: {mnemonic}") + +# Validate mnemonic +is_valid = TonMnemonicValidator().IsValid(mnemonic) +print(f"Mnemonic valid: {is_valid}") + +# Generate seed for HD keys +seed_bytes = TonSeedGenerator(mnemonic).Generate(seed_type=TonSeedTypes.HD_KEY) +print(f"Seed for HD keys: {seed_bytes.hex()}") + +# Generate seed for keypair +seed_bytes = TonSeedGenerator(mnemonic).Generate(seed_type=TonSeedTypes.PRIVATE_KEY) +print(f"Seed for keypair: {seed_bytes.hex()}") + +# Generate keypair and address +ton = Ton.FromSeed(seed_bytes) +print(f"Public key: {ton.PublicKey().RawCompressed().ToHex()}") +print(f"Private key: {ton.PrivateKey().Raw().ToHex()}") +print(f"Address: {ton.GetAddress()}") + + # # Generation like Tonkeeper, Tonwallet, Trustwallet From 3589485fdd801ef9fe86c0bece24453e12654e28 Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Fri, 27 Feb 2026 09:10:34 +0100 Subject: [PATCH 37/66] Update copyright date --- LICENSE | 2 +- benchmark/benchmark.py | 2 +- benchmark/tests/benchmark_tests_base.py | 2 +- benchmark/tests/bip44_tests.py | 2 +- benchmark/tests/ed25519_blake2b_tests.py | 2 +- benchmark/tests/ed25519_kholaw_tests.py | 2 +- benchmark/tests/ed25519_tests.py | 2 +- benchmark/tests/monero_tests.py | 2 +- benchmark/tests/nist256p1_tests.py | 2 +- benchmark/tests/secp256k1_tests.py | 2 +- benchmark/tests/substrate_tests.py | 2 +- bip_utils/addr/P2PKH_addr.py | 2 +- bip_utils/addr/P2SH_addr.py | 2 +- bip_utils/addr/P2TR_addr.py | 2 +- bip_utils/addr/P2WPKH_addr.py | 2 +- bip_utils/addr/ada_byron_addr.py | 2 +- bip_utils/addr/ada_shelley_addr.py | 2 +- bip_utils/addr/addr_dec_utils.py | 2 +- bip_utils/addr/addr_key_validator.py | 2 +- bip_utils/addr/algo_addr.py | 2 +- bip_utils/addr/aptos_addr.py | 2 +- bip_utils/addr/atom_addr.py | 2 +- bip_utils/addr/avax_addr.py | 2 +- bip_utils/addr/bch_addr_converter.py | 2 +- bip_utils/addr/egld_addr.py | 2 +- bip_utils/addr/eos_addr.py | 2 +- bip_utils/addr/ergo_addr.py | 2 +- bip_utils/addr/eth_addr.py | 2 +- bip_utils/addr/fil_addr.py | 2 +- bip_utils/addr/iaddr_decoder.py | 2 +- bip_utils/addr/iaddr_encoder.py | 2 +- bip_utils/addr/icx_addr.py | 2 +- bip_utils/addr/inj_addr.py | 2 +- bip_utils/addr/mvrk_addr.py | 2 +- bip_utils/addr/nano_addr.py | 2 +- bip_utils/addr/near_addr.py | 2 +- bip_utils/addr/neo_addr.py | 2 +- bip_utils/addr/neo_legacy_addr.py | 2 +- bip_utils/addr/neo_n3_addr.py | 2 +- bip_utils/addr/nim_addr.py | 2 +- bip_utils/addr/okex_addr.py | 2 +- bip_utils/addr/one_addr.py | 2 +- bip_utils/addr/sol_addr.py | 2 +- bip_utils/addr/substrate_addr.py | 2 +- bip_utils/addr/sui_addr.py | 2 +- bip_utils/addr/ton_addr.py | 2 +- bip_utils/addr/trx_addr.py | 2 +- bip_utils/addr/xlm_addr.py | 2 +- bip_utils/addr/xmr_addr.py | 2 +- bip_utils/addr/xrp_addr.py | 2 +- bip_utils/addr/xtz_addr.py | 2 +- bip_utils/addr/zil_addr.py | 2 +- bip_utils/algorand/mnemonic/algorand_entropy_generator.py | 2 +- bip_utils/algorand/mnemonic/algorand_mnemonic.py | 2 +- bip_utils/algorand/mnemonic/algorand_mnemonic_decoder.py | 2 +- bip_utils/algorand/mnemonic/algorand_mnemonic_encoder.py | 2 +- bip_utils/algorand/mnemonic/algorand_mnemonic_generator.py | 2 +- bip_utils/algorand/mnemonic/algorand_mnemonic_utils.py | 2 +- bip_utils/algorand/mnemonic/algorand_mnemonic_validator.py | 2 +- bip_utils/algorand/mnemonic/algorand_seed_generator.py | 2 +- bip_utils/base58/base58.py | 2 +- bip_utils/base58/base58_ex.py | 2 +- bip_utils/base58/base58_xmr.py | 2 +- bip_utils/bech32/bch_bech32.py | 2 +- bip_utils/bech32/bech32.py | 2 +- bip_utils/bech32/bech32_base.py | 2 +- bip_utils/bech32/bech32_ex.py | 2 +- bip_utils/bech32/segwit_bech32.py | 2 +- bip_utils/bip/bip32/base/bip32_base.py | 2 +- bip_utils/bip/bip32/base/ibip32_key_derivator.py | 2 +- bip_utils/bip/bip32/base/ibip32_mst_key_generator.py | 2 +- bip_utils/bip/bip32/bip32_const.py | 2 +- bip_utils/bip/bip32/bip32_ex.py | 2 +- bip_utils/bip/bip32/bip32_key_data.py | 2 +- bip_utils/bip/bip32/bip32_key_net_ver.py | 2 +- bip_utils/bip/bip32/bip32_key_ser.py | 2 +- bip_utils/bip/bip32/bip32_keys.py | 2 +- bip_utils/bip/bip32/bip32_path.py | 2 +- bip_utils/bip/bip32/bip32_utils.py | 2 +- bip_utils/bip/bip32/kholaw/bip32_kholaw_ed25519.py | 2 +- .../bip/bip32/kholaw/bip32_kholaw_ed25519_key_derivator.py | 2 +- bip_utils/bip/bip32/kholaw/bip32_kholaw_key_derivator_base.py | 2 +- bip_utils/bip/bip32/kholaw/bip32_kholaw_mst_key_generator.py | 2 +- bip_utils/bip/bip32/slip10/bip32_slip10_ed25519.py | 2 +- bip_utils/bip/bip32/slip10/bip32_slip10_ed25519_blake2b.py | 2 +- bip_utils/bip/bip32/slip10/bip32_slip10_key_derivator.py | 2 +- bip_utils/bip/bip32/slip10/bip32_slip10_mst_key_generator.py | 2 +- bip_utils/bip/bip32/slip10/bip32_slip10_nist256p1.py | 2 +- bip_utils/bip/bip32/slip10/bip32_slip10_secp256k1.py | 2 +- bip_utils/bip/bip38/bip38.py | 2 +- bip_utils/bip/bip38/bip38_addr.py | 2 +- bip_utils/bip/bip38/bip38_ec.py | 2 +- bip_utils/bip/bip38/bip38_no_ec.py | 2 +- bip_utils/bip/bip39/bip39_entropy_generator.py | 2 +- bip_utils/bip/bip39/bip39_mnemonic.py | 2 +- bip_utils/bip/bip39/bip39_mnemonic_decoder.py | 2 +- bip_utils/bip/bip39/bip39_mnemonic_encoder.py | 2 +- bip_utils/bip/bip39/bip39_mnemonic_generator.py | 2 +- bip_utils/bip/bip39/bip39_mnemonic_utils.py | 2 +- bip_utils/bip/bip39/bip39_mnemonic_validator.py | 2 +- bip_utils/bip/bip39/bip39_seed_generator.py | 2 +- bip_utils/bip/bip39/ibip39_seed_generator.py | 2 +- bip_utils/bip/bip44/bip44.py | 2 +- bip_utils/bip/bip44_base/bip44_base.py | 2 +- bip_utils/bip/bip44_base/bip44_base_ex.py | 2 +- bip_utils/bip/bip44_base/bip44_keys.py | 2 +- bip_utils/bip/bip49/bip49.py | 2 +- bip_utils/bip/bip84/bip84.py | 2 +- bip_utils/bip/bip86/bip86.py | 2 +- bip_utils/bip/conf/bip44/bip44_coins.py | 2 +- bip_utils/bip/conf/bip44/bip44_conf.py | 2 +- bip_utils/bip/conf/bip44/bip44_conf_getter.py | 2 +- bip_utils/bip/conf/bip49/bip49_coins.py | 2 +- bip_utils/bip/conf/bip49/bip49_conf.py | 2 +- bip_utils/bip/conf/bip49/bip49_conf_getter.py | 2 +- bip_utils/bip/conf/bip84/bip84_coins.py | 2 +- bip_utils/bip/conf/bip84/bip84_conf.py | 2 +- bip_utils/bip/conf/bip84/bip84_conf_getter.py | 2 +- bip_utils/bip/conf/bip86/bip86_coins.py | 2 +- bip_utils/bip/conf/bip86/bip86_conf.py | 2 +- bip_utils/bip/conf/bip86/bip86_conf_getter.py | 2 +- bip_utils/bip/conf/common/bip_bitcoin_cash_conf.py | 2 +- bip_utils/bip/conf/common/bip_coin_conf.py | 2 +- bip_utils/bip/conf/common/bip_coins.py | 2 +- bip_utils/bip/conf/common/bip_conf_const.py | 2 +- bip_utils/bip/conf/common/bip_litecoin_conf.py | 2 +- bip_utils/brainwallet/brainwallet.py | 2 +- bip_utils/brainwallet/brainwallet_algo.py | 2 +- bip_utils/brainwallet/brainwallet_algo_getter.py | 2 +- bip_utils/brainwallet/ibrainwallet_algo.py | 2 +- bip_utils/cardano/bip32/cardano_byron_legacy_bip32.py | 2 +- bip_utils/cardano/bip32/cardano_byron_legacy_key_derivator.py | 2 +- .../cardano/bip32/cardano_byron_legacy_mst_key_generator.py | 2 +- bip_utils/cardano/bip32/cardano_icarus_bip32.py | 2 +- bip_utils/cardano/bip32/cardano_icarus_mst_key_generator.py | 2 +- bip_utils/cardano/byron/cardano_byron_legacy.py | 2 +- bip_utils/cardano/cip1852/cip1852.py | 2 +- bip_utils/cardano/cip1852/conf/cip1852_coins.py | 2 +- bip_utils/cardano/cip1852/conf/cip1852_conf.py | 2 +- bip_utils/cardano/cip1852/conf/cip1852_conf_getter.py | 2 +- .../cardano/mnemonic/cardano_byron_legacy_seed_generator.py | 2 +- bip_utils/cardano/mnemonic/cardano_icarus_seed_generator.py | 2 +- bip_utils/cardano/shelley/cardano_shelley.py | 2 +- bip_utils/cardano/shelley/cardano_shelley_keys.py | 2 +- bip_utils/coin_conf/coin_conf.py | 2 +- bip_utils/coin_conf/coins_conf.py | 2 +- bip_utils/ecc/common/dummy_point.py | 2 +- bip_utils/ecc/common/ikeys.py | 2 +- bip_utils/ecc/common/ipoint.py | 2 +- bip_utils/ecc/conf.py | 2 +- bip_utils/ecc/curve/elliptic_curve.py | 2 +- bip_utils/ecc/curve/elliptic_curve_getter.py | 2 +- bip_utils/ecc/curve/elliptic_curve_types.py | 2 +- bip_utils/ecc/ecdsa/ecdsa_keys.py | 2 +- bip_utils/ecc/ed25519/ed25519.py | 2 +- bip_utils/ecc/ed25519/ed25519_const.py | 2 +- bip_utils/ecc/ed25519/ed25519_keys.py | 2 +- bip_utils/ecc/ed25519/ed25519_point.py | 2 +- bip_utils/ecc/ed25519/ed25519_utils.py | 2 +- bip_utils/ecc/ed25519/lib/ed25519_lib.py | 2 +- bip_utils/ecc/ed25519_blake2b/ed25519_blake2b.py | 2 +- bip_utils/ecc/ed25519_blake2b/ed25519_blake2b_const.py | 2 +- bip_utils/ecc/ed25519_blake2b/ed25519_blake2b_keys.py | 2 +- bip_utils/ecc/ed25519_blake2b/ed25519_blake2b_point.py | 2 +- bip_utils/ecc/ed25519_kholaw/ed25519_kholaw.py | 2 +- bip_utils/ecc/ed25519_kholaw/ed25519_kholaw_const.py | 2 +- bip_utils/ecc/ed25519_kholaw/ed25519_kholaw_keys.py | 2 +- bip_utils/ecc/ed25519_kholaw/ed25519_kholaw_point.py | 2 +- bip_utils/ecc/ed25519_monero/ed25519_monero.py | 2 +- bip_utils/ecc/ed25519_monero/ed25519_monero_const.py | 2 +- bip_utils/ecc/ed25519_monero/ed25519_monero_keys.py | 2 +- bip_utils/ecc/ed25519_monero/ed25519_monero_point.py | 2 +- bip_utils/ecc/nist256p1/nist256p1.py | 2 +- bip_utils/ecc/nist256p1/nist256p1_const.py | 2 +- bip_utils/ecc/nist256p1/nist256p1_keys.py | 2 +- bip_utils/ecc/nist256p1/nist256p1_point.py | 2 +- bip_utils/ecc/secp256k1/secp256k1.py | 2 +- bip_utils/ecc/secp256k1/secp256k1_const.py | 2 +- bip_utils/ecc/secp256k1/secp256k1_keys_coincurve.py | 2 +- bip_utils/ecc/secp256k1/secp256k1_keys_ecdsa.py | 2 +- bip_utils/ecc/secp256k1/secp256k1_point_coincurve.py | 2 +- bip_utils/ecc/secp256k1/secp256k1_point_ecdsa.py | 2 +- bip_utils/ecc/sr25519/sr25519.py | 2 +- bip_utils/ecc/sr25519/sr25519_const.py | 2 +- bip_utils/ecc/sr25519/sr25519_keys.py | 2 +- bip_utils/ecc/sr25519/sr25519_point.py | 2 +- bip_utils/electrum/electrum_v1.py | 2 +- bip_utils/electrum/electrum_v2.py | 2 +- bip_utils/electrum/mnemonic_v1/electrum_v1_entropy_generator.py | 2 +- bip_utils/electrum/mnemonic_v1/electrum_v1_mnemonic.py | 2 +- bip_utils/electrum/mnemonic_v1/electrum_v1_mnemonic_decoder.py | 2 +- bip_utils/electrum/mnemonic_v1/electrum_v1_mnemonic_encoder.py | 2 +- .../electrum/mnemonic_v1/electrum_v1_mnemonic_generator.py | 2 +- bip_utils/electrum/mnemonic_v1/electrum_v1_mnemonic_utils.py | 2 +- .../electrum/mnemonic_v1/electrum_v1_mnemonic_validator.py | 2 +- bip_utils/electrum/mnemonic_v1/electrum_v1_seed_generator.py | 2 +- bip_utils/electrum/mnemonic_v2/electrum_v2_entropy_generator.py | 2 +- bip_utils/electrum/mnemonic_v2/electrum_v2_mnemonic.py | 2 +- bip_utils/electrum/mnemonic_v2/electrum_v2_mnemonic_decoder.py | 2 +- bip_utils/electrum/mnemonic_v2/electrum_v2_mnemonic_encoder.py | 2 +- .../electrum/mnemonic_v2/electrum_v2_mnemonic_generator.py | 2 +- bip_utils/electrum/mnemonic_v2/electrum_v2_mnemonic_utils.py | 2 +- .../electrum/mnemonic_v2/electrum_v2_mnemonic_validator.py | 2 +- bip_utils/electrum/mnemonic_v2/electrum_v2_seed_generator.py | 2 +- bip_utils/monero/conf/monero_coin_conf.py | 2 +- bip_utils/monero/conf/monero_coins.py | 2 +- bip_utils/monero/conf/monero_conf.py | 2 +- bip_utils/monero/conf/monero_conf_getter.py | 2 +- bip_utils/monero/mnemonic/monero_entropy_generator.py | 2 +- bip_utils/monero/mnemonic/monero_mnemonic.py | 2 +- bip_utils/monero/mnemonic/monero_mnemonic_decoder.py | 2 +- bip_utils/monero/mnemonic/monero_mnemonic_encoder.py | 2 +- bip_utils/monero/mnemonic/monero_mnemonic_generator.py | 2 +- bip_utils/monero/mnemonic/monero_mnemonic_utils.py | 2 +- bip_utils/monero/mnemonic/monero_mnemonic_validator.py | 2 +- bip_utils/monero/mnemonic/monero_seed_generator.py | 2 +- bip_utils/monero/monero.py | 2 +- bip_utils/monero/monero_ex.py | 2 +- bip_utils/monero/monero_keys.py | 2 +- bip_utils/monero/monero_subaddr.py | 2 +- bip_utils/slip/slip173/slip173.py | 2 +- bip_utils/slip/slip32/slip32.py | 2 +- bip_utils/slip/slip32/slip32_key_net_ver.py | 2 +- bip_utils/slip/slip44/slip44.py | 2 +- bip_utils/solana/spl_token.py | 2 +- bip_utils/ss58/ss58.py | 2 +- bip_utils/ss58/ss58_ex.py | 2 +- bip_utils/substrate/conf/substrate_coin_conf.py | 2 +- bip_utils/substrate/conf/substrate_coins.py | 2 +- bip_utils/substrate/conf/substrate_conf.py | 2 +- bip_utils/substrate/conf/substrate_conf_getter.py | 2 +- bip_utils/substrate/mnemonic/substrate_bip39_seed_generator.py | 2 +- bip_utils/substrate/scale/substrate_scale_enc_base.py | 2 +- bip_utils/substrate/scale/substrate_scale_enc_bytes.py | 2 +- bip_utils/substrate/scale/substrate_scale_enc_cuint.py | 2 +- bip_utils/substrate/scale/substrate_scale_enc_uint.py | 2 +- bip_utils/substrate/substrate.py | 2 +- bip_utils/substrate/substrate_ex.py | 2 +- bip_utils/substrate/substrate_keys.py | 2 +- bip_utils/substrate/substrate_path.py | 2 +- bip_utils/ton/addr/ton_addr_versions.py | 2 +- bip_utils/ton/addr/ton_v3r1_addr_encoder.py | 2 +- bip_utils/ton/addr/ton_v3r2_addr_encoder.py | 2 +- bip_utils/ton/addr/ton_v4_addr_encoder.py | 2 +- bip_utils/ton/addr/ton_v5r1_addr_encoder.py | 2 +- bip_utils/ton/keys/ton_keys.py | 2 +- bip_utils/ton/mnemonic/ton_mnemonic.py | 2 +- bip_utils/ton/mnemonic/ton_mnemonic_generator.py | 2 +- bip_utils/ton/mnemonic/ton_mnemonic_validator.py | 2 +- bip_utils/ton/mnemonic/ton_seed_generator.py | 2 +- bip_utils/ton/mnemonic/ton_seed_utils.py | 2 +- bip_utils/ton/ton.py | 2 +- bip_utils/ton/ton_ex.py | 2 +- bip_utils/utils/conf/coin_names.py | 2 +- bip_utils/utils/crypto/aes_ecb.py | 2 +- bip_utils/utils/crypto/blake2.py | 2 +- bip_utils/utils/crypto/chacha20_poly1305.py | 2 +- bip_utils/utils/crypto/crc.py | 2 +- bip_utils/utils/crypto/hash160.py | 2 +- bip_utils/utils/crypto/hmac.py | 2 +- bip_utils/utils/crypto/pbkdf2.py | 2 +- bip_utils/utils/crypto/ripemd.py | 2 +- bip_utils/utils/crypto/scrypt.py | 2 +- bip_utils/utils/crypto/sha2.py | 2 +- bip_utils/utils/crypto/sha3.py | 2 +- bip_utils/utils/misc/algo.py | 2 +- bip_utils/utils/misc/base32.py | 2 +- bip_utils/utils/misc/base64.py | 2 +- bip_utils/utils/misc/bit.py | 2 +- bip_utils/utils/misc/bytes.py | 2 +- bip_utils/utils/misc/cbor_indefinite_len_array.py | 2 +- bip_utils/utils/misc/data_bytes.py | 2 +- bip_utils/utils/misc/integer.py | 2 +- bip_utils/utils/misc/string.py | 2 +- bip_utils/utils/mnemonic/entropy_generator.py | 2 +- bip_utils/utils/mnemonic/mnemonic.py | 2 +- bip_utils/utils/mnemonic/mnemonic_decoder_base.py | 2 +- bip_utils/utils/mnemonic/mnemonic_encoder_base.py | 2 +- bip_utils/utils/mnemonic/mnemonic_ex.py | 2 +- bip_utils/utils/mnemonic/mnemonic_utils.py | 2 +- bip_utils/utils/mnemonic/mnemonic_validator.py | 2 +- bip_utils/utils/typing/literal.py | 2 +- bip_utils/wif/wif.py | 2 +- tests/addr/test_P2PKH.py | 2 +- tests/addr/test_P2SH.py | 2 +- tests/addr/test_P2TR.py | 2 +- tests/addr/test_P2WPKH.py | 2 +- tests/addr/test_ada_byron_addr.py | 2 +- tests/addr/test_ada_shelley_addr.py | 2 +- tests/addr/test_addr_base.py | 2 +- tests/addr/test_addr_const.py | 2 +- tests/addr/test_algo_addr.py | 2 +- tests/addr/test_aptos_addr.py | 2 +- tests/addr/test_atom_addr.py | 2 +- tests/addr/test_avax_addr.py | 2 +- tests/addr/test_bch_P2PKH.py | 2 +- tests/addr/test_bch_P2SH.py | 2 +- tests/addr/test_bch_addr_converter.py | 2 +- tests/addr/test_egld_addr.py | 2 +- tests/addr/test_eos_addr.py | 2 +- tests/addr/test_ergo_addr.py | 2 +- tests/addr/test_eth_addr.py | 2 +- tests/addr/test_fil_addr.py | 2 +- tests/addr/test_icx_addr.py | 2 +- tests/addr/test_inj_addr.py | 2 +- tests/addr/test_mvrk_addr.py | 2 +- tests/addr/test_nano_addr.py | 2 +- tests/addr/test_near_addr.py | 2 +- tests/addr/test_neo_legacy_addr.py | 2 +- tests/addr/test_neo_n3_addr.py | 2 +- tests/addr/test_nim_addr.py | 2 +- tests/addr/test_okex_addr.py | 2 +- tests/addr/test_one_addr.py | 2 +- tests/addr/test_sol_addr.py | 2 +- tests/addr/test_substrate_addr.py | 2 +- tests/addr/test_sui_addr.py | 2 +- tests/addr/test_trx_addr.py | 2 +- tests/addr/test_xlm_addr.py | 2 +- tests/addr/test_xmr_addr.py | 2 +- tests/addr/test_xrp_addr.py | 2 +- tests/addr/test_xtz_addr.py | 2 +- tests/addr/test_zil_addr.py | 2 +- tests/algorand/mnemonic/test_algorand_mnemonic.py | 2 +- tests/base58/test_base58.py | 2 +- tests/base58/test_base58_xmr.py | 2 +- tests/bech32/test_bch_bech32.py | 2 +- tests/bech32/test_bech32.py | 2 +- tests/bech32/test_segwit_bech32.py | 2 +- tests/bip/bip32/test_bip32_base.py | 2 +- tests/bip/bip32/test_bip32_ed25519_kholaw.py | 2 +- tests/bip/bip32/test_bip32_key_data.py | 2 +- tests/bip/bip32/test_bip32_key_net_ver.py | 2 +- tests/bip/bip32/test_bip32_keys.py | 2 +- tests/bip/bip32/test_bip32_path.py | 2 +- tests/bip/bip32/test_bip32_slip10_ed25519.py | 2 +- tests/bip/bip32/test_bip32_slip10_ed25519_blake2b.py | 2 +- tests/bip/bip32/test_bip32_slip10_nist256p1.py | 2 +- tests/bip/bip32/test_bip32_slip10_secp256k1.py | 2 +- tests/bip/bip32/test_bip32_utils.py | 2 +- tests/bip/bip38/test_bip38_addr.py | 2 +- tests/bip/bip38/test_bip38_ec.py | 2 +- tests/bip/bip38/test_bip38_no_ec.py | 2 +- tests/bip/bip39/test_bip39.py | 2 +- tests/bip/bip44/test_bip44.py | 2 +- tests/bip/bip44_base/test_bip44_base.py | 2 +- tests/bip/bip44_base/test_bip44_keys.py | 2 +- tests/bip/bip49/test_bip49.py | 2 +- tests/bip/bip84/test_bip84.py | 2 +- tests/bip/bip86/test_bip86.py | 2 +- tests/brainwallet/test_brainwallet.py | 2 +- tests/cardano/bip32/test_cardano_byron_legacy_bip32.py | 2 +- tests/cardano/bip32/test_cardano_icarus_bip32.py | 2 +- tests/cardano/byron/test_cardano_byron_legacy.py | 2 +- tests/cardano/cip1852/test_cip1852.py | 2 +- tests/cardano/mnemonic/test_cardano_mnemonic.py | 2 +- tests/cardano/shelley/test_cardano_shelley.py | 2 +- tests/cardano/shelley/test_cardano_shelley_keys.py | 2 +- tests/ecc/test_ecc.py | 2 +- tests/electrum/mnemonic/test_electrum_v1_mnemonic.py | 2 +- tests/electrum/mnemonic/test_electrum_v2_mnemonic.py | 2 +- tests/electrum/test_electrum_v1.py | 2 +- tests/electrum/test_electrum_v2.py | 2 +- tests/monero/mnemonic/test_monero_mnemonic.py | 2 +- tests/monero/test_monero.py | 2 +- tests/monero/test_monero_keys.py | 2 +- tests/monero/test_monero_subaddr.py | 2 +- tests/slip/slip32/test_slip32.py | 2 +- tests/solana/test_spl_token.py | 2 +- tests/ss58/test_ss58.py | 2 +- tests/substrate/mnemonic/test_substrate_mnemonic.py | 2 +- tests/substrate/test_substrate.py | 2 +- tests/substrate/test_substrate_keys.py | 2 +- tests/substrate/test_substrate_path.py | 2 +- tests/substrate/test_substrate_scale_enc.py | 2 +- tests/utils/test_cbor_indefinite_len_array.py | 2 +- tests/utils/test_data_bytes.py | 2 +- tests/wif/test_wif.py | 2 +- 377 files changed, 377 insertions(+), 377 deletions(-) diff --git a/LICENSE b/LICENSE index aafa2fda..1d823cb5 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2024 Emanuele Bellocchia +Copyright (c) 2026 Emanuele Bellocchia Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/benchmark/benchmark.py b/benchmark/benchmark.py index 181aa2b3..2a8f5101 100644 --- a/benchmark/benchmark.py +++ b/benchmark/benchmark.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/benchmark/tests/benchmark_tests_base.py b/benchmark/tests/benchmark_tests_base.py index ec016698..442578b7 100644 --- a/benchmark/tests/benchmark_tests_base.py +++ b/benchmark/tests/benchmark_tests_base.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/benchmark/tests/bip44_tests.py b/benchmark/tests/bip44_tests.py index b1286992..c35ad072 100644 --- a/benchmark/tests/bip44_tests.py +++ b/benchmark/tests/bip44_tests.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/benchmark/tests/ed25519_blake2b_tests.py b/benchmark/tests/ed25519_blake2b_tests.py index 5919601a..1d635b76 100644 --- a/benchmark/tests/ed25519_blake2b_tests.py +++ b/benchmark/tests/ed25519_blake2b_tests.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/benchmark/tests/ed25519_kholaw_tests.py b/benchmark/tests/ed25519_kholaw_tests.py index f07b2f61..11f5e8a0 100644 --- a/benchmark/tests/ed25519_kholaw_tests.py +++ b/benchmark/tests/ed25519_kholaw_tests.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/benchmark/tests/ed25519_tests.py b/benchmark/tests/ed25519_tests.py index 7f050b27..e1c8eabf 100644 --- a/benchmark/tests/ed25519_tests.py +++ b/benchmark/tests/ed25519_tests.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/benchmark/tests/monero_tests.py b/benchmark/tests/monero_tests.py index 17d9d742..586713f5 100644 --- a/benchmark/tests/monero_tests.py +++ b/benchmark/tests/monero_tests.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/benchmark/tests/nist256p1_tests.py b/benchmark/tests/nist256p1_tests.py index ae357d50..fd83c533 100644 --- a/benchmark/tests/nist256p1_tests.py +++ b/benchmark/tests/nist256p1_tests.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/benchmark/tests/secp256k1_tests.py b/benchmark/tests/secp256k1_tests.py index 553c81a5..c07698f8 100644 --- a/benchmark/tests/secp256k1_tests.py +++ b/benchmark/tests/secp256k1_tests.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/benchmark/tests/substrate_tests.py b/benchmark/tests/substrate_tests.py index 73567aa3..9b138e18 100644 --- a/benchmark/tests/substrate_tests.py +++ b/benchmark/tests/substrate_tests.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/addr/P2PKH_addr.py b/bip_utils/addr/P2PKH_addr.py index b61005de..45ac76ff 100644 --- a/bip_utils/addr/P2PKH_addr.py +++ b/bip_utils/addr/P2PKH_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/addr/P2SH_addr.py b/bip_utils/addr/P2SH_addr.py index 9f29946e..6aad5f18 100644 --- a/bip_utils/addr/P2SH_addr.py +++ b/bip_utils/addr/P2SH_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/addr/P2TR_addr.py b/bip_utils/addr/P2TR_addr.py index eed055b7..9d9c4704 100644 --- a/bip_utils/addr/P2TR_addr.py +++ b/bip_utils/addr/P2TR_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/addr/P2WPKH_addr.py b/bip_utils/addr/P2WPKH_addr.py index 32d7e277..55f200a7 100644 --- a/bip_utils/addr/P2WPKH_addr.py +++ b/bip_utils/addr/P2WPKH_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/addr/ada_byron_addr.py b/bip_utils/addr/ada_byron_addr.py index e800b6c1..ee24ee6b 100644 --- a/bip_utils/addr/ada_byron_addr.py +++ b/bip_utils/addr/ada_byron_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/addr/ada_shelley_addr.py b/bip_utils/addr/ada_shelley_addr.py index 0fcfad96..1f0e69e3 100644 --- a/bip_utils/addr/ada_shelley_addr.py +++ b/bip_utils/addr/ada_shelley_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/addr/addr_dec_utils.py b/bip_utils/addr/addr_dec_utils.py index f201819a..1ec02265 100644 --- a/bip_utils/addr/addr_dec_utils.py +++ b/bip_utils/addr/addr_dec_utils.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/addr/addr_key_validator.py b/bip_utils/addr/addr_key_validator.py index a4aa8e43..20762e4d 100644 --- a/bip_utils/addr/addr_key_validator.py +++ b/bip_utils/addr/addr_key_validator.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/addr/algo_addr.py b/bip_utils/addr/algo_addr.py index cd7e87f2..315ae30e 100644 --- a/bip_utils/addr/algo_addr.py +++ b/bip_utils/addr/algo_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/addr/aptos_addr.py b/bip_utils/addr/aptos_addr.py index d88fd6ac..07403c39 100644 --- a/bip_utils/addr/aptos_addr.py +++ b/bip_utils/addr/aptos_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/addr/atom_addr.py b/bip_utils/addr/atom_addr.py index e3e103c3..b928092f 100644 --- a/bip_utils/addr/atom_addr.py +++ b/bip_utils/addr/atom_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/addr/avax_addr.py b/bip_utils/addr/avax_addr.py index cbb12d14..a5b6fdfa 100644 --- a/bip_utils/addr/avax_addr.py +++ b/bip_utils/addr/avax_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/addr/bch_addr_converter.py b/bip_utils/addr/bch_addr_converter.py index 8acb773a..84d251f3 100644 --- a/bip_utils/addr/bch_addr_converter.py +++ b/bip_utils/addr/bch_addr_converter.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/addr/egld_addr.py b/bip_utils/addr/egld_addr.py index 725a7d5d..0fc4f5be 100644 --- a/bip_utils/addr/egld_addr.py +++ b/bip_utils/addr/egld_addr.py @@ -1,5 +1,5 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/addr/eos_addr.py b/bip_utils/addr/eos_addr.py index 83457130..3eed0382 100644 --- a/bip_utils/addr/eos_addr.py +++ b/bip_utils/addr/eos_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/addr/ergo_addr.py b/bip_utils/addr/ergo_addr.py index 3866b519..49a9c0d7 100644 --- a/bip_utils/addr/ergo_addr.py +++ b/bip_utils/addr/ergo_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/addr/eth_addr.py b/bip_utils/addr/eth_addr.py index 92bb529a..1dba5bc4 100644 --- a/bip_utils/addr/eth_addr.py +++ b/bip_utils/addr/eth_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/addr/fil_addr.py b/bip_utils/addr/fil_addr.py index c44329c4..363fc1ea 100644 --- a/bip_utils/addr/fil_addr.py +++ b/bip_utils/addr/fil_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/addr/iaddr_decoder.py b/bip_utils/addr/iaddr_decoder.py index 00b0e382..a2b2401b 100644 --- a/bip_utils/addr/iaddr_decoder.py +++ b/bip_utils/addr/iaddr_decoder.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/addr/iaddr_encoder.py b/bip_utils/addr/iaddr_encoder.py index 7662e93a..d9e8afb9 100644 --- a/bip_utils/addr/iaddr_encoder.py +++ b/bip_utils/addr/iaddr_encoder.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/addr/icx_addr.py b/bip_utils/addr/icx_addr.py index 64cde26e..f9ddd849 100644 --- a/bip_utils/addr/icx_addr.py +++ b/bip_utils/addr/icx_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/addr/inj_addr.py b/bip_utils/addr/inj_addr.py index 3153cadf..3b7f5c4e 100644 --- a/bip_utils/addr/inj_addr.py +++ b/bip_utils/addr/inj_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/addr/mvrk_addr.py b/bip_utils/addr/mvrk_addr.py index fe5abfd9..5819f407 100644 --- a/bip_utils/addr/mvrk_addr.py +++ b/bip_utils/addr/mvrk_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/addr/nano_addr.py b/bip_utils/addr/nano_addr.py index b0e2596d..6afd26ef 100644 --- a/bip_utils/addr/nano_addr.py +++ b/bip_utils/addr/nano_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/addr/near_addr.py b/bip_utils/addr/near_addr.py index 0357f352..132e298d 100644 --- a/bip_utils/addr/near_addr.py +++ b/bip_utils/addr/near_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/addr/neo_addr.py b/bip_utils/addr/neo_addr.py index 0d84cf3c..79d1ae0a 100644 --- a/bip_utils/addr/neo_addr.py +++ b/bip_utils/addr/neo_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/addr/neo_legacy_addr.py b/bip_utils/addr/neo_legacy_addr.py index 61c38cb3..f0259dd1 100644 --- a/bip_utils/addr/neo_legacy_addr.py +++ b/bip_utils/addr/neo_legacy_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/addr/neo_n3_addr.py b/bip_utils/addr/neo_n3_addr.py index 2a3a4bb2..e0fe8c68 100644 --- a/bip_utils/addr/neo_n3_addr.py +++ b/bip_utils/addr/neo_n3_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/addr/nim_addr.py b/bip_utils/addr/nim_addr.py index ea45030a..772ac8d6 100644 --- a/bip_utils/addr/nim_addr.py +++ b/bip_utils/addr/nim_addr.py @@ -1,5 +1,5 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/addr/okex_addr.py b/bip_utils/addr/okex_addr.py index fb639a37..611a369a 100644 --- a/bip_utils/addr/okex_addr.py +++ b/bip_utils/addr/okex_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/addr/one_addr.py b/bip_utils/addr/one_addr.py index f6aa70f9..9f7a8fc9 100644 --- a/bip_utils/addr/one_addr.py +++ b/bip_utils/addr/one_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/addr/sol_addr.py b/bip_utils/addr/sol_addr.py index 95e9488a..ce6a4113 100644 --- a/bip_utils/addr/sol_addr.py +++ b/bip_utils/addr/sol_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/addr/substrate_addr.py b/bip_utils/addr/substrate_addr.py index 3ba4ca59..e0e0626e 100644 --- a/bip_utils/addr/substrate_addr.py +++ b/bip_utils/addr/substrate_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/addr/sui_addr.py b/bip_utils/addr/sui_addr.py index 52778bd2..9a1058c5 100644 --- a/bip_utils/addr/sui_addr.py +++ b/bip_utils/addr/sui_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/addr/ton_addr.py b/bip_utils/addr/ton_addr.py index c05ed961..3dd744bc 100644 --- a/bip_utils/addr/ton_addr.py +++ b/bip_utils/addr/ton_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/addr/trx_addr.py b/bip_utils/addr/trx_addr.py index 397cdcb5..fea7162c 100644 --- a/bip_utils/addr/trx_addr.py +++ b/bip_utils/addr/trx_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/addr/xlm_addr.py b/bip_utils/addr/xlm_addr.py index 8996d6e9..111f8c8a 100644 --- a/bip_utils/addr/xlm_addr.py +++ b/bip_utils/addr/xlm_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/addr/xmr_addr.py b/bip_utils/addr/xmr_addr.py index 88c0d928..3cea927f 100644 --- a/bip_utils/addr/xmr_addr.py +++ b/bip_utils/addr/xmr_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/addr/xrp_addr.py b/bip_utils/addr/xrp_addr.py index 31786334..d40b1764 100644 --- a/bip_utils/addr/xrp_addr.py +++ b/bip_utils/addr/xrp_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/addr/xtz_addr.py b/bip_utils/addr/xtz_addr.py index 51946f93..dd6e15cd 100644 --- a/bip_utils/addr/xtz_addr.py +++ b/bip_utils/addr/xtz_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/addr/zil_addr.py b/bip_utils/addr/zil_addr.py index 78073601..040c0d6b 100644 --- a/bip_utils/addr/zil_addr.py +++ b/bip_utils/addr/zil_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/algorand/mnemonic/algorand_entropy_generator.py b/bip_utils/algorand/mnemonic/algorand_entropy_generator.py index 2f4f32f7..de16b0b0 100644 --- a/bip_utils/algorand/mnemonic/algorand_entropy_generator.py +++ b/bip_utils/algorand/mnemonic/algorand_entropy_generator.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/algorand/mnemonic/algorand_mnemonic.py b/bip_utils/algorand/mnemonic/algorand_mnemonic.py index e36748e8..1a3d9e06 100644 --- a/bip_utils/algorand/mnemonic/algorand_mnemonic.py +++ b/bip_utils/algorand/mnemonic/algorand_mnemonic.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/algorand/mnemonic/algorand_mnemonic_decoder.py b/bip_utils/algorand/mnemonic/algorand_mnemonic_decoder.py index cfd3ceaa..2000b52f 100644 --- a/bip_utils/algorand/mnemonic/algorand_mnemonic_decoder.py +++ b/bip_utils/algorand/mnemonic/algorand_mnemonic_decoder.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/algorand/mnemonic/algorand_mnemonic_encoder.py b/bip_utils/algorand/mnemonic/algorand_mnemonic_encoder.py index d7896614..cca062b8 100644 --- a/bip_utils/algorand/mnemonic/algorand_mnemonic_encoder.py +++ b/bip_utils/algorand/mnemonic/algorand_mnemonic_encoder.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/algorand/mnemonic/algorand_mnemonic_generator.py b/bip_utils/algorand/mnemonic/algorand_mnemonic_generator.py index 3a269ece..e7efff4d 100644 --- a/bip_utils/algorand/mnemonic/algorand_mnemonic_generator.py +++ b/bip_utils/algorand/mnemonic/algorand_mnemonic_generator.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/algorand/mnemonic/algorand_mnemonic_utils.py b/bip_utils/algorand/mnemonic/algorand_mnemonic_utils.py index d23dcb58..e89a2ca0 100644 --- a/bip_utils/algorand/mnemonic/algorand_mnemonic_utils.py +++ b/bip_utils/algorand/mnemonic/algorand_mnemonic_utils.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/algorand/mnemonic/algorand_mnemonic_validator.py b/bip_utils/algorand/mnemonic/algorand_mnemonic_validator.py index 2f2f5083..960c7fc7 100644 --- a/bip_utils/algorand/mnemonic/algorand_mnemonic_validator.py +++ b/bip_utils/algorand/mnemonic/algorand_mnemonic_validator.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/algorand/mnemonic/algorand_seed_generator.py b/bip_utils/algorand/mnemonic/algorand_seed_generator.py index d96e273f..2aa2f6e9 100644 --- a/bip_utils/algorand/mnemonic/algorand_seed_generator.py +++ b/bip_utils/algorand/mnemonic/algorand_seed_generator.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/base58/base58.py b/bip_utils/base58/base58.py index 24dd39d8..149481cc 100644 --- a/bip_utils/base58/base58.py +++ b/bip_utils/base58/base58.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/base58/base58_ex.py b/bip_utils/base58/base58_ex.py index 8821beb2..24e4855b 100644 --- a/bip_utils/base58/base58_ex.py +++ b/bip_utils/base58/base58_ex.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/base58/base58_xmr.py b/bip_utils/base58/base58_xmr.py index 1314a23a..0cdd372b 100644 --- a/bip_utils/base58/base58_xmr.py +++ b/bip_utils/base58/base58_xmr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bech32/bch_bech32.py b/bip_utils/bech32/bch_bech32.py index 6ae315e5..4600aef0 100644 --- a/bip_utils/bech32/bch_bech32.py +++ b/bip_utils/bech32/bch_bech32.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bech32/bech32.py b/bip_utils/bech32/bech32.py index f83a23d3..24f75c5f 100644 --- a/bip_utils/bech32/bech32.py +++ b/bip_utils/bech32/bech32.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bech32/bech32_base.py b/bip_utils/bech32/bech32_base.py index c529fc4d..365b73d4 100644 --- a/bip_utils/bech32/bech32_base.py +++ b/bip_utils/bech32/bech32_base.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bech32/bech32_ex.py b/bip_utils/bech32/bech32_ex.py index 3f5a6f01..25564569 100644 --- a/bip_utils/bech32/bech32_ex.py +++ b/bip_utils/bech32/bech32_ex.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bech32/segwit_bech32.py b/bip_utils/bech32/segwit_bech32.py index e997dac5..a0494050 100644 --- a/bip_utils/bech32/segwit_bech32.py +++ b/bip_utils/bech32/segwit_bech32.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bip/bip32/base/bip32_base.py b/bip_utils/bip/bip32/base/bip32_base.py index e63ba5e4..7a6eb46f 100644 --- a/bip_utils/bip/bip32/base/bip32_base.py +++ b/bip_utils/bip/bip32/base/bip32_base.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bip/bip32/base/ibip32_key_derivator.py b/bip_utils/bip/bip32/base/ibip32_key_derivator.py index 65f9a273..48a15e81 100644 --- a/bip_utils/bip/bip32/base/ibip32_key_derivator.py +++ b/bip_utils/bip/bip32/base/ibip32_key_derivator.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bip/bip32/base/ibip32_mst_key_generator.py b/bip_utils/bip/bip32/base/ibip32_mst_key_generator.py index ccf779aa..a376a40a 100644 --- a/bip_utils/bip/bip32/base/ibip32_mst_key_generator.py +++ b/bip_utils/bip/bip32/base/ibip32_mst_key_generator.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bip/bip32/bip32_const.py b/bip_utils/bip/bip32/bip32_const.py index b8c8ffd2..c3e745ca 100644 --- a/bip_utils/bip/bip32/bip32_const.py +++ b/bip_utils/bip/bip32/bip32_const.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bip/bip32/bip32_ex.py b/bip_utils/bip/bip32/bip32_ex.py index dd13fd0d..e5dc2072 100644 --- a/bip_utils/bip/bip32/bip32_ex.py +++ b/bip_utils/bip/bip32/bip32_ex.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bip/bip32/bip32_key_data.py b/bip_utils/bip/bip32/bip32_key_data.py index a61428ee..ae130309 100644 --- a/bip_utils/bip/bip32/bip32_key_data.py +++ b/bip_utils/bip/bip32/bip32_key_data.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bip/bip32/bip32_key_net_ver.py b/bip_utils/bip/bip32/bip32_key_net_ver.py index f1da7f96..340b6c8f 100644 --- a/bip_utils/bip/bip32/bip32_key_net_ver.py +++ b/bip_utils/bip/bip32/bip32_key_net_ver.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bip/bip32/bip32_key_ser.py b/bip_utils/bip/bip32/bip32_key_ser.py index 893139c2..da6890bd 100644 --- a/bip_utils/bip/bip32/bip32_key_ser.py +++ b/bip_utils/bip/bip32/bip32_key_ser.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bip/bip32/bip32_keys.py b/bip_utils/bip/bip32/bip32_keys.py index b919ecbb..c5bbb30d 100644 --- a/bip_utils/bip/bip32/bip32_keys.py +++ b/bip_utils/bip/bip32/bip32_keys.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bip/bip32/bip32_path.py b/bip_utils/bip/bip32/bip32_path.py index 88dc0652..c051c4c2 100644 --- a/bip_utils/bip/bip32/bip32_path.py +++ b/bip_utils/bip/bip32/bip32_path.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bip/bip32/bip32_utils.py b/bip_utils/bip/bip32/bip32_utils.py index 0a593094..a9448677 100644 --- a/bip_utils/bip/bip32/bip32_utils.py +++ b/bip_utils/bip/bip32/bip32_utils.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bip/bip32/kholaw/bip32_kholaw_ed25519.py b/bip_utils/bip/bip32/kholaw/bip32_kholaw_ed25519.py index 363cd267..d402ddc1 100644 --- a/bip_utils/bip/bip32/kholaw/bip32_kholaw_ed25519.py +++ b/bip_utils/bip/bip32/kholaw/bip32_kholaw_ed25519.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bip/bip32/kholaw/bip32_kholaw_ed25519_key_derivator.py b/bip_utils/bip/bip32/kholaw/bip32_kholaw_ed25519_key_derivator.py index 9532d60d..53c28ea8 100644 --- a/bip_utils/bip/bip32/kholaw/bip32_kholaw_ed25519_key_derivator.py +++ b/bip_utils/bip/bip32/kholaw/bip32_kholaw_ed25519_key_derivator.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bip/bip32/kholaw/bip32_kholaw_key_derivator_base.py b/bip_utils/bip/bip32/kholaw/bip32_kholaw_key_derivator_base.py index 81f17ea3..3f820050 100644 --- a/bip_utils/bip/bip32/kholaw/bip32_kholaw_key_derivator_base.py +++ b/bip_utils/bip/bip32/kholaw/bip32_kholaw_key_derivator_base.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bip/bip32/kholaw/bip32_kholaw_mst_key_generator.py b/bip_utils/bip/bip32/kholaw/bip32_kholaw_mst_key_generator.py index ebb7b676..baf29048 100644 --- a/bip_utils/bip/bip32/kholaw/bip32_kholaw_mst_key_generator.py +++ b/bip_utils/bip/bip32/kholaw/bip32_kholaw_mst_key_generator.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bip/bip32/slip10/bip32_slip10_ed25519.py b/bip_utils/bip/bip32/slip10/bip32_slip10_ed25519.py index 6fcee021..28f9a825 100644 --- a/bip_utils/bip/bip32/slip10/bip32_slip10_ed25519.py +++ b/bip_utils/bip/bip32/slip10/bip32_slip10_ed25519.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bip/bip32/slip10/bip32_slip10_ed25519_blake2b.py b/bip_utils/bip/bip32/slip10/bip32_slip10_ed25519_blake2b.py index a721cedb..9cbd292b 100644 --- a/bip_utils/bip/bip32/slip10/bip32_slip10_ed25519_blake2b.py +++ b/bip_utils/bip/bip32/slip10/bip32_slip10_ed25519_blake2b.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bip/bip32/slip10/bip32_slip10_key_derivator.py b/bip_utils/bip/bip32/slip10/bip32_slip10_key_derivator.py index e8d75f67..208ad355 100644 --- a/bip_utils/bip/bip32/slip10/bip32_slip10_key_derivator.py +++ b/bip_utils/bip/bip32/slip10/bip32_slip10_key_derivator.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bip/bip32/slip10/bip32_slip10_mst_key_generator.py b/bip_utils/bip/bip32/slip10/bip32_slip10_mst_key_generator.py index 45634bce..acfd866c 100644 --- a/bip_utils/bip/bip32/slip10/bip32_slip10_mst_key_generator.py +++ b/bip_utils/bip/bip32/slip10/bip32_slip10_mst_key_generator.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bip/bip32/slip10/bip32_slip10_nist256p1.py b/bip_utils/bip/bip32/slip10/bip32_slip10_nist256p1.py index 58a6713e..50d033a7 100644 --- a/bip_utils/bip/bip32/slip10/bip32_slip10_nist256p1.py +++ b/bip_utils/bip/bip32/slip10/bip32_slip10_nist256p1.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bip/bip32/slip10/bip32_slip10_secp256k1.py b/bip_utils/bip/bip32/slip10/bip32_slip10_secp256k1.py index c8c75c11..a3822a4f 100644 --- a/bip_utils/bip/bip32/slip10/bip32_slip10_secp256k1.py +++ b/bip_utils/bip/bip32/slip10/bip32_slip10_secp256k1.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bip/bip38/bip38.py b/bip_utils/bip/bip38/bip38.py index 020023b7..a5ec2a36 100644 --- a/bip_utils/bip/bip38/bip38.py +++ b/bip_utils/bip/bip38/bip38.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bip/bip38/bip38_addr.py b/bip_utils/bip/bip38/bip38_addr.py index bce32618..ced168c2 100644 --- a/bip_utils/bip/bip38/bip38_addr.py +++ b/bip_utils/bip/bip38/bip38_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bip/bip38/bip38_ec.py b/bip_utils/bip/bip38/bip38_ec.py index abf95069..3bb730ab 100644 --- a/bip_utils/bip/bip38/bip38_ec.py +++ b/bip_utils/bip/bip38/bip38_ec.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bip/bip38/bip38_no_ec.py b/bip_utils/bip/bip38/bip38_no_ec.py index 945befde..04732beb 100644 --- a/bip_utils/bip/bip38/bip38_no_ec.py +++ b/bip_utils/bip/bip38/bip38_no_ec.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bip/bip39/bip39_entropy_generator.py b/bip_utils/bip/bip39/bip39_entropy_generator.py index b25842bc..49855ee9 100644 --- a/bip_utils/bip/bip39/bip39_entropy_generator.py +++ b/bip_utils/bip/bip39/bip39_entropy_generator.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bip/bip39/bip39_mnemonic.py b/bip_utils/bip/bip39/bip39_mnemonic.py index fc0c5e5b..a4665c2b 100644 --- a/bip_utils/bip/bip39/bip39_mnemonic.py +++ b/bip_utils/bip/bip39/bip39_mnemonic.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bip/bip39/bip39_mnemonic_decoder.py b/bip_utils/bip/bip39/bip39_mnemonic_decoder.py index a566c8ae..7998a367 100644 --- a/bip_utils/bip/bip39/bip39_mnemonic_decoder.py +++ b/bip_utils/bip/bip39/bip39_mnemonic_decoder.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bip/bip39/bip39_mnemonic_encoder.py b/bip_utils/bip/bip39/bip39_mnemonic_encoder.py index bd6dc6f5..1fad310e 100644 --- a/bip_utils/bip/bip39/bip39_mnemonic_encoder.py +++ b/bip_utils/bip/bip39/bip39_mnemonic_encoder.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bip/bip39/bip39_mnemonic_generator.py b/bip_utils/bip/bip39/bip39_mnemonic_generator.py index f241e28d..4002dbe2 100644 --- a/bip_utils/bip/bip39/bip39_mnemonic_generator.py +++ b/bip_utils/bip/bip39/bip39_mnemonic_generator.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bip/bip39/bip39_mnemonic_utils.py b/bip_utils/bip/bip39/bip39_mnemonic_utils.py index 36dec516..55642210 100644 --- a/bip_utils/bip/bip39/bip39_mnemonic_utils.py +++ b/bip_utils/bip/bip39/bip39_mnemonic_utils.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bip/bip39/bip39_mnemonic_validator.py b/bip_utils/bip/bip39/bip39_mnemonic_validator.py index 03d624a3..0ae42b67 100644 --- a/bip_utils/bip/bip39/bip39_mnemonic_validator.py +++ b/bip_utils/bip/bip39/bip39_mnemonic_validator.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bip/bip39/bip39_seed_generator.py b/bip_utils/bip/bip39/bip39_seed_generator.py index eff5b327..5d84a8e8 100644 --- a/bip_utils/bip/bip39/bip39_seed_generator.py +++ b/bip_utils/bip/bip39/bip39_seed_generator.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bip/bip39/ibip39_seed_generator.py b/bip_utils/bip/bip39/ibip39_seed_generator.py index 9ef2263c..605cb885 100644 --- a/bip_utils/bip/bip39/ibip39_seed_generator.py +++ b/bip_utils/bip/bip39/ibip39_seed_generator.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bip/bip44/bip44.py b/bip_utils/bip/bip44/bip44.py index fc4498ec..77bfb8f9 100644 --- a/bip_utils/bip/bip44/bip44.py +++ b/bip_utils/bip/bip44/bip44.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bip/bip44_base/bip44_base.py b/bip_utils/bip/bip44_base/bip44_base.py index 729b28e8..fa9984b4 100644 --- a/bip_utils/bip/bip44_base/bip44_base.py +++ b/bip_utils/bip/bip44_base/bip44_base.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bip/bip44_base/bip44_base_ex.py b/bip_utils/bip/bip44_base/bip44_base_ex.py index 0915286d..384368cb 100644 --- a/bip_utils/bip/bip44_base/bip44_base_ex.py +++ b/bip_utils/bip/bip44_base/bip44_base_ex.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bip/bip44_base/bip44_keys.py b/bip_utils/bip/bip44_base/bip44_keys.py index f471e14b..cdff2f67 100644 --- a/bip_utils/bip/bip44_base/bip44_keys.py +++ b/bip_utils/bip/bip44_base/bip44_keys.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bip/bip49/bip49.py b/bip_utils/bip/bip49/bip49.py index 1be45d54..086cd0c1 100644 --- a/bip_utils/bip/bip49/bip49.py +++ b/bip_utils/bip/bip49/bip49.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bip/bip84/bip84.py b/bip_utils/bip/bip84/bip84.py index 9da708fb..f5cfb5f3 100644 --- a/bip_utils/bip/bip84/bip84.py +++ b/bip_utils/bip/bip84/bip84.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bip/bip86/bip86.py b/bip_utils/bip/bip86/bip86.py index 801a9c3a..706fc6f3 100644 --- a/bip_utils/bip/bip86/bip86.py +++ b/bip_utils/bip/bip86/bip86.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bip/conf/bip44/bip44_coins.py b/bip_utils/bip/conf/bip44/bip44_coins.py index 56794ee2..57f2274f 100644 --- a/bip_utils/bip/conf/bip44/bip44_coins.py +++ b/bip_utils/bip/conf/bip44/bip44_coins.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bip/conf/bip44/bip44_conf.py b/bip_utils/bip/conf/bip44/bip44_conf.py index 3e62b094..0b5bfcbe 100644 --- a/bip_utils/bip/conf/bip44/bip44_conf.py +++ b/bip_utils/bip/conf/bip44/bip44_conf.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bip/conf/bip44/bip44_conf_getter.py b/bip_utils/bip/conf/bip44/bip44_conf_getter.py index d17f33ae..0366f50e 100644 --- a/bip_utils/bip/conf/bip44/bip44_conf_getter.py +++ b/bip_utils/bip/conf/bip44/bip44_conf_getter.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bip/conf/bip49/bip49_coins.py b/bip_utils/bip/conf/bip49/bip49_coins.py index f138bb6e..38c39686 100644 --- a/bip_utils/bip/conf/bip49/bip49_coins.py +++ b/bip_utils/bip/conf/bip49/bip49_coins.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bip/conf/bip49/bip49_conf.py b/bip_utils/bip/conf/bip49/bip49_conf.py index 7a2ab9fd..4f797014 100644 --- a/bip_utils/bip/conf/bip49/bip49_conf.py +++ b/bip_utils/bip/conf/bip49/bip49_conf.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bip/conf/bip49/bip49_conf_getter.py b/bip_utils/bip/conf/bip49/bip49_conf_getter.py index 3922dd1d..a2b4dfb7 100644 --- a/bip_utils/bip/conf/bip49/bip49_conf_getter.py +++ b/bip_utils/bip/conf/bip49/bip49_conf_getter.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bip/conf/bip84/bip84_coins.py b/bip_utils/bip/conf/bip84/bip84_coins.py index 0dc05600..1a53efa5 100644 --- a/bip_utils/bip/conf/bip84/bip84_coins.py +++ b/bip_utils/bip/conf/bip84/bip84_coins.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bip/conf/bip84/bip84_conf.py b/bip_utils/bip/conf/bip84/bip84_conf.py index cb43bb1d..51ec3181 100644 --- a/bip_utils/bip/conf/bip84/bip84_conf.py +++ b/bip_utils/bip/conf/bip84/bip84_conf.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bip/conf/bip84/bip84_conf_getter.py b/bip_utils/bip/conf/bip84/bip84_conf_getter.py index a2f16116..ecf7e655 100644 --- a/bip_utils/bip/conf/bip84/bip84_conf_getter.py +++ b/bip_utils/bip/conf/bip84/bip84_conf_getter.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bip/conf/bip86/bip86_coins.py b/bip_utils/bip/conf/bip86/bip86_coins.py index b68ecf8c..86f6f153 100644 --- a/bip_utils/bip/conf/bip86/bip86_coins.py +++ b/bip_utils/bip/conf/bip86/bip86_coins.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bip/conf/bip86/bip86_conf.py b/bip_utils/bip/conf/bip86/bip86_conf.py index 4fd8d2f8..6d1783f1 100644 --- a/bip_utils/bip/conf/bip86/bip86_conf.py +++ b/bip_utils/bip/conf/bip86/bip86_conf.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bip/conf/bip86/bip86_conf_getter.py b/bip_utils/bip/conf/bip86/bip86_conf_getter.py index 1dea8bc3..ef22b16e 100644 --- a/bip_utils/bip/conf/bip86/bip86_conf_getter.py +++ b/bip_utils/bip/conf/bip86/bip86_conf_getter.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bip/conf/common/bip_bitcoin_cash_conf.py b/bip_utils/bip/conf/common/bip_bitcoin_cash_conf.py index ef18355e..3bd5b349 100644 --- a/bip_utils/bip/conf/common/bip_bitcoin_cash_conf.py +++ b/bip_utils/bip/conf/common/bip_bitcoin_cash_conf.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bip/conf/common/bip_coin_conf.py b/bip_utils/bip/conf/common/bip_coin_conf.py index b2e9f7d8..d97be9fe 100644 --- a/bip_utils/bip/conf/common/bip_coin_conf.py +++ b/bip_utils/bip/conf/common/bip_coin_conf.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bip/conf/common/bip_coins.py b/bip_utils/bip/conf/common/bip_coins.py index be8112d7..89909600 100644 --- a/bip_utils/bip/conf/common/bip_coins.py +++ b/bip_utils/bip/conf/common/bip_coins.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bip/conf/common/bip_conf_const.py b/bip_utils/bip/conf/common/bip_conf_const.py index 6feee47f..94670ae4 100644 --- a/bip_utils/bip/conf/common/bip_conf_const.py +++ b/bip_utils/bip/conf/common/bip_conf_const.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/bip/conf/common/bip_litecoin_conf.py b/bip_utils/bip/conf/common/bip_litecoin_conf.py index 7d06ab02..b7731e82 100644 --- a/bip_utils/bip/conf/common/bip_litecoin_conf.py +++ b/bip_utils/bip/conf/common/bip_litecoin_conf.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/brainwallet/brainwallet.py b/bip_utils/brainwallet/brainwallet.py index 32f2189b..04bf0e9c 100644 --- a/bip_utils/brainwallet/brainwallet.py +++ b/bip_utils/brainwallet/brainwallet.py @@ -1,4 +1,4 @@ -# Copyright (c) 2023 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/brainwallet/brainwallet_algo.py b/bip_utils/brainwallet/brainwallet_algo.py index c4bd6228..840ad0c7 100644 --- a/bip_utils/brainwallet/brainwallet_algo.py +++ b/bip_utils/brainwallet/brainwallet_algo.py @@ -1,4 +1,4 @@ -# Copyright (c) 2023 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/brainwallet/brainwallet_algo_getter.py b/bip_utils/brainwallet/brainwallet_algo_getter.py index fb6d89ec..78c97668 100644 --- a/bip_utils/brainwallet/brainwallet_algo_getter.py +++ b/bip_utils/brainwallet/brainwallet_algo_getter.py @@ -1,4 +1,4 @@ -# Copyright (c) 2023 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/brainwallet/ibrainwallet_algo.py b/bip_utils/brainwallet/ibrainwallet_algo.py index 97b21101..bde2310f 100644 --- a/bip_utils/brainwallet/ibrainwallet_algo.py +++ b/bip_utils/brainwallet/ibrainwallet_algo.py @@ -1,4 +1,4 @@ -# Copyright (c) 2023 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/cardano/bip32/cardano_byron_legacy_bip32.py b/bip_utils/cardano/bip32/cardano_byron_legacy_bip32.py index 5ed4198e..d742ec41 100644 --- a/bip_utils/cardano/bip32/cardano_byron_legacy_bip32.py +++ b/bip_utils/cardano/bip32/cardano_byron_legacy_bip32.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/cardano/bip32/cardano_byron_legacy_key_derivator.py b/bip_utils/cardano/bip32/cardano_byron_legacy_key_derivator.py index 2a9cca6b..0d7fc590 100644 --- a/bip_utils/cardano/bip32/cardano_byron_legacy_key_derivator.py +++ b/bip_utils/cardano/bip32/cardano_byron_legacy_key_derivator.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/cardano/bip32/cardano_byron_legacy_mst_key_generator.py b/bip_utils/cardano/bip32/cardano_byron_legacy_mst_key_generator.py index 7f227a77..930f4288 100644 --- a/bip_utils/cardano/bip32/cardano_byron_legacy_mst_key_generator.py +++ b/bip_utils/cardano/bip32/cardano_byron_legacy_mst_key_generator.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/cardano/bip32/cardano_icarus_bip32.py b/bip_utils/cardano/bip32/cardano_icarus_bip32.py index a00e3e41..e78f30ef 100644 --- a/bip_utils/cardano/bip32/cardano_icarus_bip32.py +++ b/bip_utils/cardano/bip32/cardano_icarus_bip32.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/cardano/bip32/cardano_icarus_mst_key_generator.py b/bip_utils/cardano/bip32/cardano_icarus_mst_key_generator.py index 034d6159..f285139e 100644 --- a/bip_utils/cardano/bip32/cardano_icarus_mst_key_generator.py +++ b/bip_utils/cardano/bip32/cardano_icarus_mst_key_generator.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/cardano/byron/cardano_byron_legacy.py b/bip_utils/cardano/byron/cardano_byron_legacy.py index 69372201..b0fd4bd6 100644 --- a/bip_utils/cardano/byron/cardano_byron_legacy.py +++ b/bip_utils/cardano/byron/cardano_byron_legacy.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/cardano/cip1852/cip1852.py b/bip_utils/cardano/cip1852/cip1852.py index 7339872d..ee1bad26 100644 --- a/bip_utils/cardano/cip1852/cip1852.py +++ b/bip_utils/cardano/cip1852/cip1852.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/cardano/cip1852/conf/cip1852_coins.py b/bip_utils/cardano/cip1852/conf/cip1852_coins.py index 2a3ba4cf..efbf2187 100644 --- a/bip_utils/cardano/cip1852/conf/cip1852_coins.py +++ b/bip_utils/cardano/cip1852/conf/cip1852_coins.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/cardano/cip1852/conf/cip1852_conf.py b/bip_utils/cardano/cip1852/conf/cip1852_conf.py index a24071b3..a55618ae 100644 --- a/bip_utils/cardano/cip1852/conf/cip1852_conf.py +++ b/bip_utils/cardano/cip1852/conf/cip1852_conf.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/cardano/cip1852/conf/cip1852_conf_getter.py b/bip_utils/cardano/cip1852/conf/cip1852_conf_getter.py index 7cd41eb3..b9bf8bf5 100644 --- a/bip_utils/cardano/cip1852/conf/cip1852_conf_getter.py +++ b/bip_utils/cardano/cip1852/conf/cip1852_conf_getter.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/cardano/mnemonic/cardano_byron_legacy_seed_generator.py b/bip_utils/cardano/mnemonic/cardano_byron_legacy_seed_generator.py index cc67b8d5..cbd42cec 100644 --- a/bip_utils/cardano/mnemonic/cardano_byron_legacy_seed_generator.py +++ b/bip_utils/cardano/mnemonic/cardano_byron_legacy_seed_generator.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/cardano/mnemonic/cardano_icarus_seed_generator.py b/bip_utils/cardano/mnemonic/cardano_icarus_seed_generator.py index a0117199..09d051ee 100644 --- a/bip_utils/cardano/mnemonic/cardano_icarus_seed_generator.py +++ b/bip_utils/cardano/mnemonic/cardano_icarus_seed_generator.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/cardano/shelley/cardano_shelley.py b/bip_utils/cardano/shelley/cardano_shelley.py index 4f82aab1..e5a0b4e1 100644 --- a/bip_utils/cardano/shelley/cardano_shelley.py +++ b/bip_utils/cardano/shelley/cardano_shelley.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/cardano/shelley/cardano_shelley_keys.py b/bip_utils/cardano/shelley/cardano_shelley_keys.py index 1cb96a1e..ff1ec6b4 100644 --- a/bip_utils/cardano/shelley/cardano_shelley_keys.py +++ b/bip_utils/cardano/shelley/cardano_shelley_keys.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/coin_conf/coin_conf.py b/bip_utils/coin_conf/coin_conf.py index 245c5441..77e0cf98 100644 --- a/bip_utils/coin_conf/coin_conf.py +++ b/bip_utils/coin_conf/coin_conf.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/coin_conf/coins_conf.py b/bip_utils/coin_conf/coins_conf.py index eb6d91b8..7a1096a4 100644 --- a/bip_utils/coin_conf/coins_conf.py +++ b/bip_utils/coin_conf/coins_conf.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/ecc/common/dummy_point.py b/bip_utils/ecc/common/dummy_point.py index 5e121189..32c29c72 100644 --- a/bip_utils/ecc/common/dummy_point.py +++ b/bip_utils/ecc/common/dummy_point.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/ecc/common/ikeys.py b/bip_utils/ecc/common/ikeys.py index bad2560b..8f111023 100644 --- a/bip_utils/ecc/common/ikeys.py +++ b/bip_utils/ecc/common/ikeys.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/ecc/common/ipoint.py b/bip_utils/ecc/common/ipoint.py index b3fd2571..5246da40 100644 --- a/bip_utils/ecc/common/ipoint.py +++ b/bip_utils/ecc/common/ipoint.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/ecc/conf.py b/bip_utils/ecc/conf.py index d6d15118..28f2063b 100644 --- a/bip_utils/ecc/conf.py +++ b/bip_utils/ecc/conf.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/ecc/curve/elliptic_curve.py b/bip_utils/ecc/curve/elliptic_curve.py index a400443b..cdbb3401 100644 --- a/bip_utils/ecc/curve/elliptic_curve.py +++ b/bip_utils/ecc/curve/elliptic_curve.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/ecc/curve/elliptic_curve_getter.py b/bip_utils/ecc/curve/elliptic_curve_getter.py index cb6be49f..5b821637 100644 --- a/bip_utils/ecc/curve/elliptic_curve_getter.py +++ b/bip_utils/ecc/curve/elliptic_curve_getter.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/ecc/curve/elliptic_curve_types.py b/bip_utils/ecc/curve/elliptic_curve_types.py index d30f0753..3b8df7ce 100644 --- a/bip_utils/ecc/curve/elliptic_curve_types.py +++ b/bip_utils/ecc/curve/elliptic_curve_types.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/ecc/ecdsa/ecdsa_keys.py b/bip_utils/ecc/ecdsa/ecdsa_keys.py index 2997c47a..c33d46ab 100644 --- a/bip_utils/ecc/ecdsa/ecdsa_keys.py +++ b/bip_utils/ecc/ecdsa/ecdsa_keys.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/ecc/ed25519/ed25519.py b/bip_utils/ecc/ed25519/ed25519.py index 80daac4d..5510f227 100644 --- a/bip_utils/ecc/ed25519/ed25519.py +++ b/bip_utils/ecc/ed25519/ed25519.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/ecc/ed25519/ed25519_const.py b/bip_utils/ecc/ed25519/ed25519_const.py index fe94ef2b..d2ab9087 100644 --- a/bip_utils/ecc/ed25519/ed25519_const.py +++ b/bip_utils/ecc/ed25519/ed25519_const.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/ecc/ed25519/ed25519_keys.py b/bip_utils/ecc/ed25519/ed25519_keys.py index 4e4bfc08..ad265c63 100644 --- a/bip_utils/ecc/ed25519/ed25519_keys.py +++ b/bip_utils/ecc/ed25519/ed25519_keys.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/ecc/ed25519/ed25519_point.py b/bip_utils/ecc/ed25519/ed25519_point.py index 827f4c8b..4c72b4b1 100644 --- a/bip_utils/ecc/ed25519/ed25519_point.py +++ b/bip_utils/ecc/ed25519/ed25519_point.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/ecc/ed25519/ed25519_utils.py b/bip_utils/ecc/ed25519/ed25519_utils.py index 94b3dcc4..3d1b563e 100644 --- a/bip_utils/ecc/ed25519/ed25519_utils.py +++ b/bip_utils/ecc/ed25519/ed25519_utils.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/ecc/ed25519/lib/ed25519_lib.py b/bip_utils/ecc/ed25519/lib/ed25519_lib.py index b9d27a0f..9db85514 100644 --- a/bip_utils/ecc/ed25519/lib/ed25519_lib.py +++ b/bip_utils/ecc/ed25519/lib/ed25519_lib.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/ecc/ed25519_blake2b/ed25519_blake2b.py b/bip_utils/ecc/ed25519_blake2b/ed25519_blake2b.py index a3d76eff..c250ed39 100644 --- a/bip_utils/ecc/ed25519_blake2b/ed25519_blake2b.py +++ b/bip_utils/ecc/ed25519_blake2b/ed25519_blake2b.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/ecc/ed25519_blake2b/ed25519_blake2b_const.py b/bip_utils/ecc/ed25519_blake2b/ed25519_blake2b_const.py index 6069756b..76657b6d 100644 --- a/bip_utils/ecc/ed25519_blake2b/ed25519_blake2b_const.py +++ b/bip_utils/ecc/ed25519_blake2b/ed25519_blake2b_const.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/ecc/ed25519_blake2b/ed25519_blake2b_keys.py b/bip_utils/ecc/ed25519_blake2b/ed25519_blake2b_keys.py index 73223582..1ba237e9 100644 --- a/bip_utils/ecc/ed25519_blake2b/ed25519_blake2b_keys.py +++ b/bip_utils/ecc/ed25519_blake2b/ed25519_blake2b_keys.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/ecc/ed25519_blake2b/ed25519_blake2b_point.py b/bip_utils/ecc/ed25519_blake2b/ed25519_blake2b_point.py index 8d4bf358..20bffe86 100644 --- a/bip_utils/ecc/ed25519_blake2b/ed25519_blake2b_point.py +++ b/bip_utils/ecc/ed25519_blake2b/ed25519_blake2b_point.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/ecc/ed25519_kholaw/ed25519_kholaw.py b/bip_utils/ecc/ed25519_kholaw/ed25519_kholaw.py index 70eec0df..9060e565 100644 --- a/bip_utils/ecc/ed25519_kholaw/ed25519_kholaw.py +++ b/bip_utils/ecc/ed25519_kholaw/ed25519_kholaw.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/ecc/ed25519_kholaw/ed25519_kholaw_const.py b/bip_utils/ecc/ed25519_kholaw/ed25519_kholaw_const.py index 1b2c6f27..ddb7c6e1 100644 --- a/bip_utils/ecc/ed25519_kholaw/ed25519_kholaw_const.py +++ b/bip_utils/ecc/ed25519_kholaw/ed25519_kholaw_const.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/ecc/ed25519_kholaw/ed25519_kholaw_keys.py b/bip_utils/ecc/ed25519_kholaw/ed25519_kholaw_keys.py index 20b35c0c..51673edf 100644 --- a/bip_utils/ecc/ed25519_kholaw/ed25519_kholaw_keys.py +++ b/bip_utils/ecc/ed25519_kholaw/ed25519_kholaw_keys.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/ecc/ed25519_kholaw/ed25519_kholaw_point.py b/bip_utils/ecc/ed25519_kholaw/ed25519_kholaw_point.py index 42c2e3fa..604663ec 100644 --- a/bip_utils/ecc/ed25519_kholaw/ed25519_kholaw_point.py +++ b/bip_utils/ecc/ed25519_kholaw/ed25519_kholaw_point.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/ecc/ed25519_monero/ed25519_monero.py b/bip_utils/ecc/ed25519_monero/ed25519_monero.py index 4a08f6fd..94fc3445 100644 --- a/bip_utils/ecc/ed25519_monero/ed25519_monero.py +++ b/bip_utils/ecc/ed25519_monero/ed25519_monero.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/ecc/ed25519_monero/ed25519_monero_const.py b/bip_utils/ecc/ed25519_monero/ed25519_monero_const.py index 7801dfdf..829cce6e 100644 --- a/bip_utils/ecc/ed25519_monero/ed25519_monero_const.py +++ b/bip_utils/ecc/ed25519_monero/ed25519_monero_const.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/ecc/ed25519_monero/ed25519_monero_keys.py b/bip_utils/ecc/ed25519_monero/ed25519_monero_keys.py index 02e4c24a..40739654 100644 --- a/bip_utils/ecc/ed25519_monero/ed25519_monero_keys.py +++ b/bip_utils/ecc/ed25519_monero/ed25519_monero_keys.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/ecc/ed25519_monero/ed25519_monero_point.py b/bip_utils/ecc/ed25519_monero/ed25519_monero_point.py index ff05d419..f51870f7 100644 --- a/bip_utils/ecc/ed25519_monero/ed25519_monero_point.py +++ b/bip_utils/ecc/ed25519_monero/ed25519_monero_point.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/ecc/nist256p1/nist256p1.py b/bip_utils/ecc/nist256p1/nist256p1.py index 8530e80e..6dcd3e63 100644 --- a/bip_utils/ecc/nist256p1/nist256p1.py +++ b/bip_utils/ecc/nist256p1/nist256p1.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/ecc/nist256p1/nist256p1_const.py b/bip_utils/ecc/nist256p1/nist256p1_const.py index 9da13c35..a0d3bd6a 100644 --- a/bip_utils/ecc/nist256p1/nist256p1_const.py +++ b/bip_utils/ecc/nist256p1/nist256p1_const.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/ecc/nist256p1/nist256p1_keys.py b/bip_utils/ecc/nist256p1/nist256p1_keys.py index adcee6b5..bad45509 100644 --- a/bip_utils/ecc/nist256p1/nist256p1_keys.py +++ b/bip_utils/ecc/nist256p1/nist256p1_keys.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/ecc/nist256p1/nist256p1_point.py b/bip_utils/ecc/nist256p1/nist256p1_point.py index 993f8bb1..35b947b1 100644 --- a/bip_utils/ecc/nist256p1/nist256p1_point.py +++ b/bip_utils/ecc/nist256p1/nist256p1_point.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/ecc/secp256k1/secp256k1.py b/bip_utils/ecc/secp256k1/secp256k1.py index 0cad4192..9c5397a1 100644 --- a/bip_utils/ecc/secp256k1/secp256k1.py +++ b/bip_utils/ecc/secp256k1/secp256k1.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/ecc/secp256k1/secp256k1_const.py b/bip_utils/ecc/secp256k1/secp256k1_const.py index 1c10188c..9f6161fe 100644 --- a/bip_utils/ecc/secp256k1/secp256k1_const.py +++ b/bip_utils/ecc/secp256k1/secp256k1_const.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/ecc/secp256k1/secp256k1_keys_coincurve.py b/bip_utils/ecc/secp256k1/secp256k1_keys_coincurve.py index 2e53c503..3eed2403 100644 --- a/bip_utils/ecc/secp256k1/secp256k1_keys_coincurve.py +++ b/bip_utils/ecc/secp256k1/secp256k1_keys_coincurve.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/ecc/secp256k1/secp256k1_keys_ecdsa.py b/bip_utils/ecc/secp256k1/secp256k1_keys_ecdsa.py index 8502691f..e0e030a6 100644 --- a/bip_utils/ecc/secp256k1/secp256k1_keys_ecdsa.py +++ b/bip_utils/ecc/secp256k1/secp256k1_keys_ecdsa.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/ecc/secp256k1/secp256k1_point_coincurve.py b/bip_utils/ecc/secp256k1/secp256k1_point_coincurve.py index 5e10895c..341f13d5 100644 --- a/bip_utils/ecc/secp256k1/secp256k1_point_coincurve.py +++ b/bip_utils/ecc/secp256k1/secp256k1_point_coincurve.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/ecc/secp256k1/secp256k1_point_ecdsa.py b/bip_utils/ecc/secp256k1/secp256k1_point_ecdsa.py index c9eabe35..0da042f3 100644 --- a/bip_utils/ecc/secp256k1/secp256k1_point_ecdsa.py +++ b/bip_utils/ecc/secp256k1/secp256k1_point_ecdsa.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/ecc/sr25519/sr25519.py b/bip_utils/ecc/sr25519/sr25519.py index 7eeb51d0..274314a0 100644 --- a/bip_utils/ecc/sr25519/sr25519.py +++ b/bip_utils/ecc/sr25519/sr25519.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/ecc/sr25519/sr25519_const.py b/bip_utils/ecc/sr25519/sr25519_const.py index 79a457f2..d8107907 100644 --- a/bip_utils/ecc/sr25519/sr25519_const.py +++ b/bip_utils/ecc/sr25519/sr25519_const.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/ecc/sr25519/sr25519_keys.py b/bip_utils/ecc/sr25519/sr25519_keys.py index 85ae4b78..cbff5870 100644 --- a/bip_utils/ecc/sr25519/sr25519_keys.py +++ b/bip_utils/ecc/sr25519/sr25519_keys.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/ecc/sr25519/sr25519_point.py b/bip_utils/ecc/sr25519/sr25519_point.py index 713fcef6..aebd9930 100644 --- a/bip_utils/ecc/sr25519/sr25519_point.py +++ b/bip_utils/ecc/sr25519/sr25519_point.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/electrum/electrum_v1.py b/bip_utils/electrum/electrum_v1.py index aab51632..b1d4b69c 100644 --- a/bip_utils/electrum/electrum_v1.py +++ b/bip_utils/electrum/electrum_v1.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/electrum/electrum_v2.py b/bip_utils/electrum/electrum_v2.py index efef7cbb..a94cda9a 100644 --- a/bip_utils/electrum/electrum_v2.py +++ b/bip_utils/electrum/electrum_v2.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/electrum/mnemonic_v1/electrum_v1_entropy_generator.py b/bip_utils/electrum/mnemonic_v1/electrum_v1_entropy_generator.py index eb6d3b55..2a0f17f9 100644 --- a/bip_utils/electrum/mnemonic_v1/electrum_v1_entropy_generator.py +++ b/bip_utils/electrum/mnemonic_v1/electrum_v1_entropy_generator.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/electrum/mnemonic_v1/electrum_v1_mnemonic.py b/bip_utils/electrum/mnemonic_v1/electrum_v1_mnemonic.py index e84d4054..e30976dd 100644 --- a/bip_utils/electrum/mnemonic_v1/electrum_v1_mnemonic.py +++ b/bip_utils/electrum/mnemonic_v1/electrum_v1_mnemonic.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/electrum/mnemonic_v1/electrum_v1_mnemonic_decoder.py b/bip_utils/electrum/mnemonic_v1/electrum_v1_mnemonic_decoder.py index 7ee4caae..cfbb886c 100644 --- a/bip_utils/electrum/mnemonic_v1/electrum_v1_mnemonic_decoder.py +++ b/bip_utils/electrum/mnemonic_v1/electrum_v1_mnemonic_decoder.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/electrum/mnemonic_v1/electrum_v1_mnemonic_encoder.py b/bip_utils/electrum/mnemonic_v1/electrum_v1_mnemonic_encoder.py index cee6f600..302232fc 100644 --- a/bip_utils/electrum/mnemonic_v1/electrum_v1_mnemonic_encoder.py +++ b/bip_utils/electrum/mnemonic_v1/electrum_v1_mnemonic_encoder.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/electrum/mnemonic_v1/electrum_v1_mnemonic_generator.py b/bip_utils/electrum/mnemonic_v1/electrum_v1_mnemonic_generator.py index 3a71250d..72a6b9af 100644 --- a/bip_utils/electrum/mnemonic_v1/electrum_v1_mnemonic_generator.py +++ b/bip_utils/electrum/mnemonic_v1/electrum_v1_mnemonic_generator.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/electrum/mnemonic_v1/electrum_v1_mnemonic_utils.py b/bip_utils/electrum/mnemonic_v1/electrum_v1_mnemonic_utils.py index 172eafb5..75022c88 100644 --- a/bip_utils/electrum/mnemonic_v1/electrum_v1_mnemonic_utils.py +++ b/bip_utils/electrum/mnemonic_v1/electrum_v1_mnemonic_utils.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/electrum/mnemonic_v1/electrum_v1_mnemonic_validator.py b/bip_utils/electrum/mnemonic_v1/electrum_v1_mnemonic_validator.py index 61180ccb..61ac3f69 100644 --- a/bip_utils/electrum/mnemonic_v1/electrum_v1_mnemonic_validator.py +++ b/bip_utils/electrum/mnemonic_v1/electrum_v1_mnemonic_validator.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/electrum/mnemonic_v1/electrum_v1_seed_generator.py b/bip_utils/electrum/mnemonic_v1/electrum_v1_seed_generator.py index 1b0b528d..8ac8e99b 100644 --- a/bip_utils/electrum/mnemonic_v1/electrum_v1_seed_generator.py +++ b/bip_utils/electrum/mnemonic_v1/electrum_v1_seed_generator.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/electrum/mnemonic_v2/electrum_v2_entropy_generator.py b/bip_utils/electrum/mnemonic_v2/electrum_v2_entropy_generator.py index 8e2f3f65..2c45d451 100644 --- a/bip_utils/electrum/mnemonic_v2/electrum_v2_entropy_generator.py +++ b/bip_utils/electrum/mnemonic_v2/electrum_v2_entropy_generator.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/electrum/mnemonic_v2/electrum_v2_mnemonic.py b/bip_utils/electrum/mnemonic_v2/electrum_v2_mnemonic.py index 02cbc4d6..c97d4bc9 100644 --- a/bip_utils/electrum/mnemonic_v2/electrum_v2_mnemonic.py +++ b/bip_utils/electrum/mnemonic_v2/electrum_v2_mnemonic.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/electrum/mnemonic_v2/electrum_v2_mnemonic_decoder.py b/bip_utils/electrum/mnemonic_v2/electrum_v2_mnemonic_decoder.py index fdc6eb9e..dc21dcee 100644 --- a/bip_utils/electrum/mnemonic_v2/electrum_v2_mnemonic_decoder.py +++ b/bip_utils/electrum/mnemonic_v2/electrum_v2_mnemonic_decoder.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/electrum/mnemonic_v2/electrum_v2_mnemonic_encoder.py b/bip_utils/electrum/mnemonic_v2/electrum_v2_mnemonic_encoder.py index 2f1cf868..70f60f0b 100644 --- a/bip_utils/electrum/mnemonic_v2/electrum_v2_mnemonic_encoder.py +++ b/bip_utils/electrum/mnemonic_v2/electrum_v2_mnemonic_encoder.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/electrum/mnemonic_v2/electrum_v2_mnemonic_generator.py b/bip_utils/electrum/mnemonic_v2/electrum_v2_mnemonic_generator.py index dcb650a1..38bcd13f 100644 --- a/bip_utils/electrum/mnemonic_v2/electrum_v2_mnemonic_generator.py +++ b/bip_utils/electrum/mnemonic_v2/electrum_v2_mnemonic_generator.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/electrum/mnemonic_v2/electrum_v2_mnemonic_utils.py b/bip_utils/electrum/mnemonic_v2/electrum_v2_mnemonic_utils.py index c24c15b7..bc89fea2 100644 --- a/bip_utils/electrum/mnemonic_v2/electrum_v2_mnemonic_utils.py +++ b/bip_utils/electrum/mnemonic_v2/electrum_v2_mnemonic_utils.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/electrum/mnemonic_v2/electrum_v2_mnemonic_validator.py b/bip_utils/electrum/mnemonic_v2/electrum_v2_mnemonic_validator.py index 8757018b..15fa74fc 100644 --- a/bip_utils/electrum/mnemonic_v2/electrum_v2_mnemonic_validator.py +++ b/bip_utils/electrum/mnemonic_v2/electrum_v2_mnemonic_validator.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/electrum/mnemonic_v2/electrum_v2_seed_generator.py b/bip_utils/electrum/mnemonic_v2/electrum_v2_seed_generator.py index 7db77a3b..58a643fa 100644 --- a/bip_utils/electrum/mnemonic_v2/electrum_v2_seed_generator.py +++ b/bip_utils/electrum/mnemonic_v2/electrum_v2_seed_generator.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/monero/conf/monero_coin_conf.py b/bip_utils/monero/conf/monero_coin_conf.py index 11eb233b..7453e2f4 100644 --- a/bip_utils/monero/conf/monero_coin_conf.py +++ b/bip_utils/monero/conf/monero_coin_conf.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/monero/conf/monero_coins.py b/bip_utils/monero/conf/monero_coins.py index 13b240d1..6f2fd0ae 100644 --- a/bip_utils/monero/conf/monero_coins.py +++ b/bip_utils/monero/conf/monero_coins.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/monero/conf/monero_conf.py b/bip_utils/monero/conf/monero_conf.py index eb55e7d8..74f3634b 100644 --- a/bip_utils/monero/conf/monero_conf.py +++ b/bip_utils/monero/conf/monero_conf.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/monero/conf/monero_conf_getter.py b/bip_utils/monero/conf/monero_conf_getter.py index 50c35392..b7558b7d 100644 --- a/bip_utils/monero/conf/monero_conf_getter.py +++ b/bip_utils/monero/conf/monero_conf_getter.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/monero/mnemonic/monero_entropy_generator.py b/bip_utils/monero/mnemonic/monero_entropy_generator.py index a9b4a061..4bc64683 100644 --- a/bip_utils/monero/mnemonic/monero_entropy_generator.py +++ b/bip_utils/monero/mnemonic/monero_entropy_generator.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/monero/mnemonic/monero_mnemonic.py b/bip_utils/monero/mnemonic/monero_mnemonic.py index b882a61f..405a7e0c 100644 --- a/bip_utils/monero/mnemonic/monero_mnemonic.py +++ b/bip_utils/monero/mnemonic/monero_mnemonic.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/monero/mnemonic/monero_mnemonic_decoder.py b/bip_utils/monero/mnemonic/monero_mnemonic_decoder.py index b421bbd6..9051c307 100644 --- a/bip_utils/monero/mnemonic/monero_mnemonic_decoder.py +++ b/bip_utils/monero/mnemonic/monero_mnemonic_decoder.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/monero/mnemonic/monero_mnemonic_encoder.py b/bip_utils/monero/mnemonic/monero_mnemonic_encoder.py index 582c8820..3d5d6097 100644 --- a/bip_utils/monero/mnemonic/monero_mnemonic_encoder.py +++ b/bip_utils/monero/mnemonic/monero_mnemonic_encoder.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/monero/mnemonic/monero_mnemonic_generator.py b/bip_utils/monero/mnemonic/monero_mnemonic_generator.py index 22e93044..34e9789d 100644 --- a/bip_utils/monero/mnemonic/monero_mnemonic_generator.py +++ b/bip_utils/monero/mnemonic/monero_mnemonic_generator.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/monero/mnemonic/monero_mnemonic_utils.py b/bip_utils/monero/mnemonic/monero_mnemonic_utils.py index cd33353b..5a518435 100644 --- a/bip_utils/monero/mnemonic/monero_mnemonic_utils.py +++ b/bip_utils/monero/mnemonic/monero_mnemonic_utils.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/monero/mnemonic/monero_mnemonic_validator.py b/bip_utils/monero/mnemonic/monero_mnemonic_validator.py index 7956309c..c5e46ea3 100644 --- a/bip_utils/monero/mnemonic/monero_mnemonic_validator.py +++ b/bip_utils/monero/mnemonic/monero_mnemonic_validator.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/monero/mnemonic/monero_seed_generator.py b/bip_utils/monero/mnemonic/monero_seed_generator.py index 35a2b476..dbc6e40c 100644 --- a/bip_utils/monero/mnemonic/monero_seed_generator.py +++ b/bip_utils/monero/mnemonic/monero_seed_generator.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/monero/monero.py b/bip_utils/monero/monero.py index 3584d9e1..e23ed0cf 100644 --- a/bip_utils/monero/monero.py +++ b/bip_utils/monero/monero.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/monero/monero_ex.py b/bip_utils/monero/monero_ex.py index 77607271..1359d406 100644 --- a/bip_utils/monero/monero_ex.py +++ b/bip_utils/monero/monero_ex.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/monero/monero_keys.py b/bip_utils/monero/monero_keys.py index 261c512c..c0e40552 100644 --- a/bip_utils/monero/monero_keys.py +++ b/bip_utils/monero/monero_keys.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/monero/monero_subaddr.py b/bip_utils/monero/monero_subaddr.py index 77dbc1af..7eb642fb 100644 --- a/bip_utils/monero/monero_subaddr.py +++ b/bip_utils/monero/monero_subaddr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/slip/slip173/slip173.py b/bip_utils/slip/slip173/slip173.py index c4ad835c..92f6d25c 100644 --- a/bip_utils/slip/slip173/slip173.py +++ b/bip_utils/slip/slip173/slip173.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/slip/slip32/slip32.py b/bip_utils/slip/slip32/slip32.py index 2166dad9..629cfda9 100644 --- a/bip_utils/slip/slip32/slip32.py +++ b/bip_utils/slip/slip32/slip32.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/slip/slip32/slip32_key_net_ver.py b/bip_utils/slip/slip32/slip32_key_net_ver.py index aa11c19a..5ea18bb7 100644 --- a/bip_utils/slip/slip32/slip32_key_net_ver.py +++ b/bip_utils/slip/slip32/slip32_key_net_ver.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/slip/slip44/slip44.py b/bip_utils/slip/slip44/slip44.py index e733c1d6..97b44f80 100644 --- a/bip_utils/slip/slip44/slip44.py +++ b/bip_utils/slip/slip44/slip44.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/solana/spl_token.py b/bip_utils/solana/spl_token.py index 4ee22211..1c63411d 100644 --- a/bip_utils/solana/spl_token.py +++ b/bip_utils/solana/spl_token.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/ss58/ss58.py b/bip_utils/ss58/ss58.py index d3da6758..38c6bb96 100644 --- a/bip_utils/ss58/ss58.py +++ b/bip_utils/ss58/ss58.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/ss58/ss58_ex.py b/bip_utils/ss58/ss58_ex.py index f239097f..efb5e255 100644 --- a/bip_utils/ss58/ss58_ex.py +++ b/bip_utils/ss58/ss58_ex.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/substrate/conf/substrate_coin_conf.py b/bip_utils/substrate/conf/substrate_coin_conf.py index ab7c5103..ec5b5e1a 100644 --- a/bip_utils/substrate/conf/substrate_coin_conf.py +++ b/bip_utils/substrate/conf/substrate_coin_conf.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/substrate/conf/substrate_coins.py b/bip_utils/substrate/conf/substrate_coins.py index ad6f8eb1..26b4acd4 100644 --- a/bip_utils/substrate/conf/substrate_coins.py +++ b/bip_utils/substrate/conf/substrate_coins.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/substrate/conf/substrate_conf.py b/bip_utils/substrate/conf/substrate_conf.py index 3575db41..274cf7e1 100644 --- a/bip_utils/substrate/conf/substrate_conf.py +++ b/bip_utils/substrate/conf/substrate_conf.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/substrate/conf/substrate_conf_getter.py b/bip_utils/substrate/conf/substrate_conf_getter.py index 4a653186..54a0933e 100644 --- a/bip_utils/substrate/conf/substrate_conf_getter.py +++ b/bip_utils/substrate/conf/substrate_conf_getter.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/substrate/mnemonic/substrate_bip39_seed_generator.py b/bip_utils/substrate/mnemonic/substrate_bip39_seed_generator.py index 1470cd97..642b2a83 100644 --- a/bip_utils/substrate/mnemonic/substrate_bip39_seed_generator.py +++ b/bip_utils/substrate/mnemonic/substrate_bip39_seed_generator.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/substrate/scale/substrate_scale_enc_base.py b/bip_utils/substrate/scale/substrate_scale_enc_base.py index 1acc3386..d47ba6bd 100644 --- a/bip_utils/substrate/scale/substrate_scale_enc_base.py +++ b/bip_utils/substrate/scale/substrate_scale_enc_base.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/substrate/scale/substrate_scale_enc_bytes.py b/bip_utils/substrate/scale/substrate_scale_enc_bytes.py index e00d5b0c..075db08d 100644 --- a/bip_utils/substrate/scale/substrate_scale_enc_bytes.py +++ b/bip_utils/substrate/scale/substrate_scale_enc_bytes.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/substrate/scale/substrate_scale_enc_cuint.py b/bip_utils/substrate/scale/substrate_scale_enc_cuint.py index c9597ab5..8cf1a442 100644 --- a/bip_utils/substrate/scale/substrate_scale_enc_cuint.py +++ b/bip_utils/substrate/scale/substrate_scale_enc_cuint.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/substrate/scale/substrate_scale_enc_uint.py b/bip_utils/substrate/scale/substrate_scale_enc_uint.py index 2404c094..6f6c84a6 100644 --- a/bip_utils/substrate/scale/substrate_scale_enc_uint.py +++ b/bip_utils/substrate/scale/substrate_scale_enc_uint.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/substrate/substrate.py b/bip_utils/substrate/substrate.py index c66ed139..70784f93 100644 --- a/bip_utils/substrate/substrate.py +++ b/bip_utils/substrate/substrate.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/substrate/substrate_ex.py b/bip_utils/substrate/substrate_ex.py index d907bea5..040eb508 100644 --- a/bip_utils/substrate/substrate_ex.py +++ b/bip_utils/substrate/substrate_ex.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/substrate/substrate_keys.py b/bip_utils/substrate/substrate_keys.py index 0aa6a11a..7bfe0091 100644 --- a/bip_utils/substrate/substrate_keys.py +++ b/bip_utils/substrate/substrate_keys.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/substrate/substrate_path.py b/bip_utils/substrate/substrate_path.py index bd025dda..a55c46ed 100644 --- a/bip_utils/substrate/substrate_path.py +++ b/bip_utils/substrate/substrate_path.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/ton/addr/ton_addr_versions.py b/bip_utils/ton/addr/ton_addr_versions.py index 492be040..7cd97a41 100644 --- a/bip_utils/ton/addr/ton_addr_versions.py +++ b/bip_utils/ton/addr/ton_addr_versions.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/ton/addr/ton_v3r1_addr_encoder.py b/bip_utils/ton/addr/ton_v3r1_addr_encoder.py index 762c93c2..9d57c4d3 100644 --- a/bip_utils/ton/addr/ton_v3r1_addr_encoder.py +++ b/bip_utils/ton/addr/ton_v3r1_addr_encoder.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/ton/addr/ton_v3r2_addr_encoder.py b/bip_utils/ton/addr/ton_v3r2_addr_encoder.py index f4a52060..940d526e 100644 --- a/bip_utils/ton/addr/ton_v3r2_addr_encoder.py +++ b/bip_utils/ton/addr/ton_v3r2_addr_encoder.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/ton/addr/ton_v4_addr_encoder.py b/bip_utils/ton/addr/ton_v4_addr_encoder.py index 67d234fc..68d912fc 100644 --- a/bip_utils/ton/addr/ton_v4_addr_encoder.py +++ b/bip_utils/ton/addr/ton_v4_addr_encoder.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/ton/addr/ton_v5r1_addr_encoder.py b/bip_utils/ton/addr/ton_v5r1_addr_encoder.py index 6933d7d0..c5b052f5 100644 --- a/bip_utils/ton/addr/ton_v5r1_addr_encoder.py +++ b/bip_utils/ton/addr/ton_v5r1_addr_encoder.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/ton/keys/ton_keys.py b/bip_utils/ton/keys/ton_keys.py index 3855c00f..c63d77a6 100644 --- a/bip_utils/ton/keys/ton_keys.py +++ b/bip_utils/ton/keys/ton_keys.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/ton/mnemonic/ton_mnemonic.py b/bip_utils/ton/mnemonic/ton_mnemonic.py index dae689a0..82333ce0 100644 --- a/bip_utils/ton/mnemonic/ton_mnemonic.py +++ b/bip_utils/ton/mnemonic/ton_mnemonic.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/ton/mnemonic/ton_mnemonic_generator.py b/bip_utils/ton/mnemonic/ton_mnemonic_generator.py index 48be2d07..7d55c01d 100644 --- a/bip_utils/ton/mnemonic/ton_mnemonic_generator.py +++ b/bip_utils/ton/mnemonic/ton_mnemonic_generator.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/ton/mnemonic/ton_mnemonic_validator.py b/bip_utils/ton/mnemonic/ton_mnemonic_validator.py index 76519de5..cfff24d7 100644 --- a/bip_utils/ton/mnemonic/ton_mnemonic_validator.py +++ b/bip_utils/ton/mnemonic/ton_mnemonic_validator.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/ton/mnemonic/ton_seed_generator.py b/bip_utils/ton/mnemonic/ton_seed_generator.py index 3992977b..d2bd115d 100644 --- a/bip_utils/ton/mnemonic/ton_seed_generator.py +++ b/bip_utils/ton/mnemonic/ton_seed_generator.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/ton/mnemonic/ton_seed_utils.py b/bip_utils/ton/mnemonic/ton_seed_utils.py index 93185149..23d7943b 100644 --- a/bip_utils/ton/mnemonic/ton_seed_utils.py +++ b/bip_utils/ton/mnemonic/ton_seed_utils.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/ton/ton.py b/bip_utils/ton/ton.py index fb172ef7..a2eda906 100644 --- a/bip_utils/ton/ton.py +++ b/bip_utils/ton/ton.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/ton/ton_ex.py b/bip_utils/ton/ton_ex.py index 0e21e7e4..d8d3dc5a 100644 --- a/bip_utils/ton/ton_ex.py +++ b/bip_utils/ton/ton_ex.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/utils/conf/coin_names.py b/bip_utils/utils/conf/coin_names.py index 1b458c00..a7e19052 100644 --- a/bip_utils/utils/conf/coin_names.py +++ b/bip_utils/utils/conf/coin_names.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/utils/crypto/aes_ecb.py b/bip_utils/utils/crypto/aes_ecb.py index 62ac596b..1ba43627 100644 --- a/bip_utils/utils/crypto/aes_ecb.py +++ b/bip_utils/utils/crypto/aes_ecb.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/utils/crypto/blake2.py b/bip_utils/utils/crypto/blake2.py index 3268d784..d2b92a06 100644 --- a/bip_utils/utils/crypto/blake2.py +++ b/bip_utils/utils/crypto/blake2.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/utils/crypto/chacha20_poly1305.py b/bip_utils/utils/crypto/chacha20_poly1305.py index fde8dc89..79324968 100644 --- a/bip_utils/utils/crypto/chacha20_poly1305.py +++ b/bip_utils/utils/crypto/chacha20_poly1305.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/utils/crypto/crc.py b/bip_utils/utils/crypto/crc.py index 9213c2c5..20fe45d4 100644 --- a/bip_utils/utils/crypto/crc.py +++ b/bip_utils/utils/crypto/crc.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/utils/crypto/hash160.py b/bip_utils/utils/crypto/hash160.py index 5b7e6f69..43bf139b 100644 --- a/bip_utils/utils/crypto/hash160.py +++ b/bip_utils/utils/crypto/hash160.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/utils/crypto/hmac.py b/bip_utils/utils/crypto/hmac.py index 1aa49275..9bc1c7f2 100644 --- a/bip_utils/utils/crypto/hmac.py +++ b/bip_utils/utils/crypto/hmac.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/utils/crypto/pbkdf2.py b/bip_utils/utils/crypto/pbkdf2.py index 458a31f3..9b1d0502 100644 --- a/bip_utils/utils/crypto/pbkdf2.py +++ b/bip_utils/utils/crypto/pbkdf2.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/utils/crypto/ripemd.py b/bip_utils/utils/crypto/ripemd.py index af4dd889..496b7de1 100644 --- a/bip_utils/utils/crypto/ripemd.py +++ b/bip_utils/utils/crypto/ripemd.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/utils/crypto/scrypt.py b/bip_utils/utils/crypto/scrypt.py index 8ab5e9ab..e143610c 100644 --- a/bip_utils/utils/crypto/scrypt.py +++ b/bip_utils/utils/crypto/scrypt.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/utils/crypto/sha2.py b/bip_utils/utils/crypto/sha2.py index d7eeaf20..a3bc369a 100644 --- a/bip_utils/utils/crypto/sha2.py +++ b/bip_utils/utils/crypto/sha2.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/utils/crypto/sha3.py b/bip_utils/utils/crypto/sha3.py index ab28a821..d2192bab 100644 --- a/bip_utils/utils/crypto/sha3.py +++ b/bip_utils/utils/crypto/sha3.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/utils/misc/algo.py b/bip_utils/utils/misc/algo.py index faec6d55..49c06230 100644 --- a/bip_utils/utils/misc/algo.py +++ b/bip_utils/utils/misc/algo.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/utils/misc/base32.py b/bip_utils/utils/misc/base32.py index c3065059..9c151d18 100644 --- a/bip_utils/utils/misc/base32.py +++ b/bip_utils/utils/misc/base32.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/utils/misc/base64.py b/bip_utils/utils/misc/base64.py index 52f24744..d5045e79 100644 --- a/bip_utils/utils/misc/base64.py +++ b/bip_utils/utils/misc/base64.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/utils/misc/bit.py b/bip_utils/utils/misc/bit.py index 950c3e51..0958de14 100644 --- a/bip_utils/utils/misc/bit.py +++ b/bip_utils/utils/misc/bit.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/utils/misc/bytes.py b/bip_utils/utils/misc/bytes.py index 50a544d1..555cad26 100644 --- a/bip_utils/utils/misc/bytes.py +++ b/bip_utils/utils/misc/bytes.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/utils/misc/cbor_indefinite_len_array.py b/bip_utils/utils/misc/cbor_indefinite_len_array.py index ed3f7f97..bec12edc 100644 --- a/bip_utils/utils/misc/cbor_indefinite_len_array.py +++ b/bip_utils/utils/misc/cbor_indefinite_len_array.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/utils/misc/data_bytes.py b/bip_utils/utils/misc/data_bytes.py index 5695a9b2..69709c89 100644 --- a/bip_utils/utils/misc/data_bytes.py +++ b/bip_utils/utils/misc/data_bytes.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/utils/misc/integer.py b/bip_utils/utils/misc/integer.py index 271d070c..a8a0e70f 100644 --- a/bip_utils/utils/misc/integer.py +++ b/bip_utils/utils/misc/integer.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/utils/misc/string.py b/bip_utils/utils/misc/string.py index 7f68c095..15356b0f 100644 --- a/bip_utils/utils/misc/string.py +++ b/bip_utils/utils/misc/string.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/utils/mnemonic/entropy_generator.py b/bip_utils/utils/mnemonic/entropy_generator.py index 3878cba7..4384d920 100644 --- a/bip_utils/utils/mnemonic/entropy_generator.py +++ b/bip_utils/utils/mnemonic/entropy_generator.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/utils/mnemonic/mnemonic.py b/bip_utils/utils/mnemonic/mnemonic.py index 5e88a738..756734ee 100644 --- a/bip_utils/utils/mnemonic/mnemonic.py +++ b/bip_utils/utils/mnemonic/mnemonic.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/utils/mnemonic/mnemonic_decoder_base.py b/bip_utils/utils/mnemonic/mnemonic_decoder_base.py index 7634c3d5..b597c853 100644 --- a/bip_utils/utils/mnemonic/mnemonic_decoder_base.py +++ b/bip_utils/utils/mnemonic/mnemonic_decoder_base.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/utils/mnemonic/mnemonic_encoder_base.py b/bip_utils/utils/mnemonic/mnemonic_encoder_base.py index b5cbc111..e622cd86 100644 --- a/bip_utils/utils/mnemonic/mnemonic_encoder_base.py +++ b/bip_utils/utils/mnemonic/mnemonic_encoder_base.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/utils/mnemonic/mnemonic_ex.py b/bip_utils/utils/mnemonic/mnemonic_ex.py index 24ac6049..a0cfcc2f 100644 --- a/bip_utils/utils/mnemonic/mnemonic_ex.py +++ b/bip_utils/utils/mnemonic/mnemonic_ex.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/utils/mnemonic/mnemonic_utils.py b/bip_utils/utils/mnemonic/mnemonic_utils.py index d2980b9c..001770f7 100644 --- a/bip_utils/utils/mnemonic/mnemonic_utils.py +++ b/bip_utils/utils/mnemonic/mnemonic_utils.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/utils/mnemonic/mnemonic_validator.py b/bip_utils/utils/mnemonic/mnemonic_validator.py index cc617f10..a6ae08d6 100644 --- a/bip_utils/utils/mnemonic/mnemonic_validator.py +++ b/bip_utils/utils/mnemonic/mnemonic_validator.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/utils/typing/literal.py b/bip_utils/utils/typing/literal.py index acb30db6..4efb97ac 100644 --- a/bip_utils/utils/typing/literal.py +++ b/bip_utils/utils/typing/literal.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/bip_utils/wif/wif.py b/bip_utils/wif/wif.py index 0099e9fc..2ace897a 100644 --- a/bip_utils/wif/wif.py +++ b/bip_utils/wif/wif.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/addr/test_P2PKH.py b/tests/addr/test_P2PKH.py index 1fddeefa..35e7992a 100644 --- a/tests/addr/test_P2PKH.py +++ b/tests/addr/test_P2PKH.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/addr/test_P2SH.py b/tests/addr/test_P2SH.py index c95bd960..381e2415 100644 --- a/tests/addr/test_P2SH.py +++ b/tests/addr/test_P2SH.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/addr/test_P2TR.py b/tests/addr/test_P2TR.py index 9d33b4f0..202444f5 100644 --- a/tests/addr/test_P2TR.py +++ b/tests/addr/test_P2TR.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/addr/test_P2WPKH.py b/tests/addr/test_P2WPKH.py index a24d2c51..8e36d798 100644 --- a/tests/addr/test_P2WPKH.py +++ b/tests/addr/test_P2WPKH.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/addr/test_ada_byron_addr.py b/tests/addr/test_ada_byron_addr.py index 88a42eb5..2b11181c 100644 --- a/tests/addr/test_ada_byron_addr.py +++ b/tests/addr/test_ada_byron_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/addr/test_ada_shelley_addr.py b/tests/addr/test_ada_shelley_addr.py index 004a7c21..0029b7aa 100644 --- a/tests/addr/test_ada_shelley_addr.py +++ b/tests/addr/test_ada_shelley_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/addr/test_addr_base.py b/tests/addr/test_addr_base.py index ee196bc4..ece4ca37 100644 --- a/tests/addr/test_addr_base.py +++ b/tests/addr/test_addr_base.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/addr/test_addr_const.py b/tests/addr/test_addr_const.py index fcb249ea..a8443087 100644 --- a/tests/addr/test_addr_const.py +++ b/tests/addr/test_addr_const.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/addr/test_algo_addr.py b/tests/addr/test_algo_addr.py index 3b862003..906d8883 100644 --- a/tests/addr/test_algo_addr.py +++ b/tests/addr/test_algo_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/addr/test_aptos_addr.py b/tests/addr/test_aptos_addr.py index a5ef9dac..5027b484 100644 --- a/tests/addr/test_aptos_addr.py +++ b/tests/addr/test_aptos_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/addr/test_atom_addr.py b/tests/addr/test_atom_addr.py index f9ab83ba..fb1b2f97 100644 --- a/tests/addr/test_atom_addr.py +++ b/tests/addr/test_atom_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/addr/test_avax_addr.py b/tests/addr/test_avax_addr.py index 1285dc29..631015de 100644 --- a/tests/addr/test_avax_addr.py +++ b/tests/addr/test_avax_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/addr/test_bch_P2PKH.py b/tests/addr/test_bch_P2PKH.py index a8de951a..a3f144f9 100644 --- a/tests/addr/test_bch_P2PKH.py +++ b/tests/addr/test_bch_P2PKH.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/addr/test_bch_P2SH.py b/tests/addr/test_bch_P2SH.py index 7da96f4a..ade54afa 100644 --- a/tests/addr/test_bch_P2SH.py +++ b/tests/addr/test_bch_P2SH.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/addr/test_bch_addr_converter.py b/tests/addr/test_bch_addr_converter.py index f9963633..c6370d28 100644 --- a/tests/addr/test_bch_addr_converter.py +++ b/tests/addr/test_bch_addr_converter.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/addr/test_egld_addr.py b/tests/addr/test_egld_addr.py index 3703c8f7..6e551fd7 100644 --- a/tests/addr/test_egld_addr.py +++ b/tests/addr/test_egld_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/addr/test_eos_addr.py b/tests/addr/test_eos_addr.py index 0a7005da..659331e0 100644 --- a/tests/addr/test_eos_addr.py +++ b/tests/addr/test_eos_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/addr/test_ergo_addr.py b/tests/addr/test_ergo_addr.py index c2f0aa27..ac13f236 100644 --- a/tests/addr/test_ergo_addr.py +++ b/tests/addr/test_ergo_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/addr/test_eth_addr.py b/tests/addr/test_eth_addr.py index db367cb9..d42e7a5a 100644 --- a/tests/addr/test_eth_addr.py +++ b/tests/addr/test_eth_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/addr/test_fil_addr.py b/tests/addr/test_fil_addr.py index 04eca27a..6d362908 100644 --- a/tests/addr/test_fil_addr.py +++ b/tests/addr/test_fil_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/addr/test_icx_addr.py b/tests/addr/test_icx_addr.py index 564f0369..cce1e760 100644 --- a/tests/addr/test_icx_addr.py +++ b/tests/addr/test_icx_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/addr/test_inj_addr.py b/tests/addr/test_inj_addr.py index c82e370d..366a5767 100644 --- a/tests/addr/test_inj_addr.py +++ b/tests/addr/test_inj_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/addr/test_mvrk_addr.py b/tests/addr/test_mvrk_addr.py index acdf17e6..a7adcae6 100644 --- a/tests/addr/test_mvrk_addr.py +++ b/tests/addr/test_mvrk_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/addr/test_nano_addr.py b/tests/addr/test_nano_addr.py index eb5e3858..c1c02ee4 100644 --- a/tests/addr/test_nano_addr.py +++ b/tests/addr/test_nano_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/addr/test_near_addr.py b/tests/addr/test_near_addr.py index 1e531177..292d165e 100644 --- a/tests/addr/test_near_addr.py +++ b/tests/addr/test_near_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/addr/test_neo_legacy_addr.py b/tests/addr/test_neo_legacy_addr.py index a7c9f343..3b22c546 100644 --- a/tests/addr/test_neo_legacy_addr.py +++ b/tests/addr/test_neo_legacy_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/addr/test_neo_n3_addr.py b/tests/addr/test_neo_n3_addr.py index e779e375..cb0dc4eb 100644 --- a/tests/addr/test_neo_n3_addr.py +++ b/tests/addr/test_neo_n3_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/addr/test_nim_addr.py b/tests/addr/test_nim_addr.py index f0427c03..6f91842c 100644 --- a/tests/addr/test_nim_addr.py +++ b/tests/addr/test_nim_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/addr/test_okex_addr.py b/tests/addr/test_okex_addr.py index 95af9cbe..e0b3ddf9 100644 --- a/tests/addr/test_okex_addr.py +++ b/tests/addr/test_okex_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/addr/test_one_addr.py b/tests/addr/test_one_addr.py index 68b2bf6b..1dd4e053 100644 --- a/tests/addr/test_one_addr.py +++ b/tests/addr/test_one_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/addr/test_sol_addr.py b/tests/addr/test_sol_addr.py index ea5f613c..387e732c 100644 --- a/tests/addr/test_sol_addr.py +++ b/tests/addr/test_sol_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/addr/test_substrate_addr.py b/tests/addr/test_substrate_addr.py index faf8f71b..eb98dabe 100644 --- a/tests/addr/test_substrate_addr.py +++ b/tests/addr/test_substrate_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/addr/test_sui_addr.py b/tests/addr/test_sui_addr.py index f5c8cfc6..55cb3adb 100644 --- a/tests/addr/test_sui_addr.py +++ b/tests/addr/test_sui_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2023 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/addr/test_trx_addr.py b/tests/addr/test_trx_addr.py index 9aca45f2..5daaacfb 100644 --- a/tests/addr/test_trx_addr.py +++ b/tests/addr/test_trx_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/addr/test_xlm_addr.py b/tests/addr/test_xlm_addr.py index b08dce23..47f47a6e 100644 --- a/tests/addr/test_xlm_addr.py +++ b/tests/addr/test_xlm_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/addr/test_xmr_addr.py b/tests/addr/test_xmr_addr.py index 27cca6ff..6a384212 100644 --- a/tests/addr/test_xmr_addr.py +++ b/tests/addr/test_xmr_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/addr/test_xrp_addr.py b/tests/addr/test_xrp_addr.py index 0565d2d1..07d7ed97 100644 --- a/tests/addr/test_xrp_addr.py +++ b/tests/addr/test_xrp_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/addr/test_xtz_addr.py b/tests/addr/test_xtz_addr.py index b37d5cd5..073b1364 100644 --- a/tests/addr/test_xtz_addr.py +++ b/tests/addr/test_xtz_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/addr/test_zil_addr.py b/tests/addr/test_zil_addr.py index d2dece69..f760e83e 100644 --- a/tests/addr/test_zil_addr.py +++ b/tests/addr/test_zil_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/algorand/mnemonic/test_algorand_mnemonic.py b/tests/algorand/mnemonic/test_algorand_mnemonic.py index af54ccf5..071b7bd8 100644 --- a/tests/algorand/mnemonic/test_algorand_mnemonic.py +++ b/tests/algorand/mnemonic/test_algorand_mnemonic.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/base58/test_base58.py b/tests/base58/test_base58.py index 358cc15d..fc43d5c1 100644 --- a/tests/base58/test_base58.py +++ b/tests/base58/test_base58.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/base58/test_base58_xmr.py b/tests/base58/test_base58_xmr.py index 33040c9f..81174a0a 100644 --- a/tests/base58/test_base58_xmr.py +++ b/tests/base58/test_base58_xmr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/bech32/test_bch_bech32.py b/tests/bech32/test_bch_bech32.py index ed7e1f87..44e15f23 100644 --- a/tests/bech32/test_bch_bech32.py +++ b/tests/bech32/test_bch_bech32.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/bech32/test_bech32.py b/tests/bech32/test_bech32.py index d7565ce8..50933e07 100644 --- a/tests/bech32/test_bech32.py +++ b/tests/bech32/test_bech32.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/bech32/test_segwit_bech32.py b/tests/bech32/test_segwit_bech32.py index ba56b9f9..f132a799 100644 --- a/tests/bech32/test_segwit_bech32.py +++ b/tests/bech32/test_segwit_bech32.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/bip/bip32/test_bip32_base.py b/tests/bip/bip32/test_bip32_base.py index cdd6dc08..43f23e25 100644 --- a/tests/bip/bip32/test_bip32_base.py +++ b/tests/bip/bip32/test_bip32_base.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/bip/bip32/test_bip32_ed25519_kholaw.py b/tests/bip/bip32/test_bip32_ed25519_kholaw.py index 1d879ab6..d3b409e7 100644 --- a/tests/bip/bip32/test_bip32_ed25519_kholaw.py +++ b/tests/bip/bip32/test_bip32_ed25519_kholaw.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/bip/bip32/test_bip32_key_data.py b/tests/bip/bip32/test_bip32_key_data.py index ceef91ca..6353ec55 100644 --- a/tests/bip/bip32/test_bip32_key_data.py +++ b/tests/bip/bip32/test_bip32_key_data.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/bip/bip32/test_bip32_key_net_ver.py b/tests/bip/bip32/test_bip32_key_net_ver.py index 83117793..38709ed7 100644 --- a/tests/bip/bip32/test_bip32_key_net_ver.py +++ b/tests/bip/bip32/test_bip32_key_net_ver.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/bip/bip32/test_bip32_keys.py b/tests/bip/bip32/test_bip32_keys.py index 5fe0c5e8..54be618c 100644 --- a/tests/bip/bip32/test_bip32_keys.py +++ b/tests/bip/bip32/test_bip32_keys.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/bip/bip32/test_bip32_path.py b/tests/bip/bip32/test_bip32_path.py index 2b8216bc..89ad9c40 100644 --- a/tests/bip/bip32/test_bip32_path.py +++ b/tests/bip/bip32/test_bip32_path.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/bip/bip32/test_bip32_slip10_ed25519.py b/tests/bip/bip32/test_bip32_slip10_ed25519.py index 091857aa..340b4fd7 100644 --- a/tests/bip/bip32/test_bip32_slip10_ed25519.py +++ b/tests/bip/bip32/test_bip32_slip10_ed25519.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/bip/bip32/test_bip32_slip10_ed25519_blake2b.py b/tests/bip/bip32/test_bip32_slip10_ed25519_blake2b.py index b0ff36fc..2b5af169 100644 --- a/tests/bip/bip32/test_bip32_slip10_ed25519_blake2b.py +++ b/tests/bip/bip32/test_bip32_slip10_ed25519_blake2b.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/bip/bip32/test_bip32_slip10_nist256p1.py b/tests/bip/bip32/test_bip32_slip10_nist256p1.py index 63ea21c3..e8a2068c 100644 --- a/tests/bip/bip32/test_bip32_slip10_nist256p1.py +++ b/tests/bip/bip32/test_bip32_slip10_nist256p1.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/bip/bip32/test_bip32_slip10_secp256k1.py b/tests/bip/bip32/test_bip32_slip10_secp256k1.py index 6a0b5483..8ad976b5 100644 --- a/tests/bip/bip32/test_bip32_slip10_secp256k1.py +++ b/tests/bip/bip32/test_bip32_slip10_secp256k1.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/bip/bip32/test_bip32_utils.py b/tests/bip/bip32/test_bip32_utils.py index f64ffc3e..5a7cb1dc 100644 --- a/tests/bip/bip32/test_bip32_utils.py +++ b/tests/bip/bip32/test_bip32_utils.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/bip/bip38/test_bip38_addr.py b/tests/bip/bip38/test_bip38_addr.py index 3a92b678..0254010f 100644 --- a/tests/bip/bip38/test_bip38_addr.py +++ b/tests/bip/bip38/test_bip38_addr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/bip/bip38/test_bip38_ec.py b/tests/bip/bip38/test_bip38_ec.py index ba1d7f90..3ab8ee9f 100644 --- a/tests/bip/bip38/test_bip38_ec.py +++ b/tests/bip/bip38/test_bip38_ec.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/bip/bip38/test_bip38_no_ec.py b/tests/bip/bip38/test_bip38_no_ec.py index 3efe29c9..24aecf78 100644 --- a/tests/bip/bip38/test_bip38_no_ec.py +++ b/tests/bip/bip38/test_bip38_no_ec.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/bip/bip39/test_bip39.py b/tests/bip/bip39/test_bip39.py index c7b72b0b..c290df7a 100644 --- a/tests/bip/bip39/test_bip39.py +++ b/tests/bip/bip39/test_bip39.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/bip/bip44/test_bip44.py b/tests/bip/bip44/test_bip44.py index 156bbe45..73bdc09a 100644 --- a/tests/bip/bip44/test_bip44.py +++ b/tests/bip/bip44/test_bip44.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/bip/bip44_base/test_bip44_base.py b/tests/bip/bip44_base/test_bip44_base.py index 7031305e..4dfd7732 100644 --- a/tests/bip/bip44_base/test_bip44_base.py +++ b/tests/bip/bip44_base/test_bip44_base.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/bip/bip44_base/test_bip44_keys.py b/tests/bip/bip44_base/test_bip44_keys.py index 828edfc9..aa1072dd 100644 --- a/tests/bip/bip44_base/test_bip44_keys.py +++ b/tests/bip/bip44_base/test_bip44_keys.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/bip/bip49/test_bip49.py b/tests/bip/bip49/test_bip49.py index 64341c57..080c628e 100644 --- a/tests/bip/bip49/test_bip49.py +++ b/tests/bip/bip49/test_bip49.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/bip/bip84/test_bip84.py b/tests/bip/bip84/test_bip84.py index edab85e7..48000ecb 100644 --- a/tests/bip/bip84/test_bip84.py +++ b/tests/bip/bip84/test_bip84.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/bip/bip86/test_bip86.py b/tests/bip/bip86/test_bip86.py index 9cd71102..c7a056bf 100644 --- a/tests/bip/bip86/test_bip86.py +++ b/tests/bip/bip86/test_bip86.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/brainwallet/test_brainwallet.py b/tests/brainwallet/test_brainwallet.py index b578cc44..ba66db3d 100644 --- a/tests/brainwallet/test_brainwallet.py +++ b/tests/brainwallet/test_brainwallet.py @@ -1,4 +1,4 @@ -# Copyright (c) 2023 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/cardano/bip32/test_cardano_byron_legacy_bip32.py b/tests/cardano/bip32/test_cardano_byron_legacy_bip32.py index 1f28ff9c..fffced78 100644 --- a/tests/cardano/bip32/test_cardano_byron_legacy_bip32.py +++ b/tests/cardano/bip32/test_cardano_byron_legacy_bip32.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/cardano/bip32/test_cardano_icarus_bip32.py b/tests/cardano/bip32/test_cardano_icarus_bip32.py index 35998257..b8302d06 100644 --- a/tests/cardano/bip32/test_cardano_icarus_bip32.py +++ b/tests/cardano/bip32/test_cardano_icarus_bip32.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/cardano/byron/test_cardano_byron_legacy.py b/tests/cardano/byron/test_cardano_byron_legacy.py index 6529f6b0..fec692fc 100644 --- a/tests/cardano/byron/test_cardano_byron_legacy.py +++ b/tests/cardano/byron/test_cardano_byron_legacy.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/cardano/cip1852/test_cip1852.py b/tests/cardano/cip1852/test_cip1852.py index 2a794433..489bbd65 100644 --- a/tests/cardano/cip1852/test_cip1852.py +++ b/tests/cardano/cip1852/test_cip1852.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/cardano/mnemonic/test_cardano_mnemonic.py b/tests/cardano/mnemonic/test_cardano_mnemonic.py index 0105ae4f..7c301dce 100644 --- a/tests/cardano/mnemonic/test_cardano_mnemonic.py +++ b/tests/cardano/mnemonic/test_cardano_mnemonic.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/cardano/shelley/test_cardano_shelley.py b/tests/cardano/shelley/test_cardano_shelley.py index cb2a7ac9..f849ed17 100644 --- a/tests/cardano/shelley/test_cardano_shelley.py +++ b/tests/cardano/shelley/test_cardano_shelley.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/cardano/shelley/test_cardano_shelley_keys.py b/tests/cardano/shelley/test_cardano_shelley_keys.py index 9e31fd0e..d5f7e1b7 100644 --- a/tests/cardano/shelley/test_cardano_shelley_keys.py +++ b/tests/cardano/shelley/test_cardano_shelley_keys.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/ecc/test_ecc.py b/tests/ecc/test_ecc.py index 8426afcc..6539df61 100644 --- a/tests/ecc/test_ecc.py +++ b/tests/ecc/test_ecc.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/electrum/mnemonic/test_electrum_v1_mnemonic.py b/tests/electrum/mnemonic/test_electrum_v1_mnemonic.py index b0438e18..5d71add4 100644 --- a/tests/electrum/mnemonic/test_electrum_v1_mnemonic.py +++ b/tests/electrum/mnemonic/test_electrum_v1_mnemonic.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/electrum/mnemonic/test_electrum_v2_mnemonic.py b/tests/electrum/mnemonic/test_electrum_v2_mnemonic.py index 8b0c0318..0f0d9960 100644 --- a/tests/electrum/mnemonic/test_electrum_v2_mnemonic.py +++ b/tests/electrum/mnemonic/test_electrum_v2_mnemonic.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/electrum/test_electrum_v1.py b/tests/electrum/test_electrum_v1.py index 5349dcc7..683b845b 100644 --- a/tests/electrum/test_electrum_v1.py +++ b/tests/electrum/test_electrum_v1.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/electrum/test_electrum_v2.py b/tests/electrum/test_electrum_v2.py index 7a858016..ee6b6674 100644 --- a/tests/electrum/test_electrum_v2.py +++ b/tests/electrum/test_electrum_v2.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/monero/mnemonic/test_monero_mnemonic.py b/tests/monero/mnemonic/test_monero_mnemonic.py index 61f8d897..1f42b512 100644 --- a/tests/monero/mnemonic/test_monero_mnemonic.py +++ b/tests/monero/mnemonic/test_monero_mnemonic.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/monero/test_monero.py b/tests/monero/test_monero.py index 4daeb689..17f59fdc 100644 --- a/tests/monero/test_monero.py +++ b/tests/monero/test_monero.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/monero/test_monero_keys.py b/tests/monero/test_monero_keys.py index 63200b11..989a4f43 100644 --- a/tests/monero/test_monero_keys.py +++ b/tests/monero/test_monero_keys.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/monero/test_monero_subaddr.py b/tests/monero/test_monero_subaddr.py index 1d7e899f..78b47438 100644 --- a/tests/monero/test_monero_subaddr.py +++ b/tests/monero/test_monero_subaddr.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/slip/slip32/test_slip32.py b/tests/slip/slip32/test_slip32.py index b9cd0006..41ec83ec 100644 --- a/tests/slip/slip32/test_slip32.py +++ b/tests/slip/slip32/test_slip32.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/solana/test_spl_token.py b/tests/solana/test_spl_token.py index 053bf04f..b5ba998b 100644 --- a/tests/solana/test_spl_token.py +++ b/tests/solana/test_spl_token.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/ss58/test_ss58.py b/tests/ss58/test_ss58.py index 237da424..a3e3a2b7 100644 --- a/tests/ss58/test_ss58.py +++ b/tests/ss58/test_ss58.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/substrate/mnemonic/test_substrate_mnemonic.py b/tests/substrate/mnemonic/test_substrate_mnemonic.py index f455b1aa..0d20b1da 100644 --- a/tests/substrate/mnemonic/test_substrate_mnemonic.py +++ b/tests/substrate/mnemonic/test_substrate_mnemonic.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/substrate/test_substrate.py b/tests/substrate/test_substrate.py index efd87555..e2e8e976 100644 --- a/tests/substrate/test_substrate.py +++ b/tests/substrate/test_substrate.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/substrate/test_substrate_keys.py b/tests/substrate/test_substrate_keys.py index 88840802..a37fbcf3 100644 --- a/tests/substrate/test_substrate_keys.py +++ b/tests/substrate/test_substrate_keys.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/substrate/test_substrate_path.py b/tests/substrate/test_substrate_path.py index 47573cc2..0ceb4c8f 100644 --- a/tests/substrate/test_substrate_path.py +++ b/tests/substrate/test_substrate_path.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/substrate/test_substrate_scale_enc.py b/tests/substrate/test_substrate_scale_enc.py index 359f166d..b57803e8 100644 --- a/tests/substrate/test_substrate_scale_enc.py +++ b/tests/substrate/test_substrate_scale_enc.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/utils/test_cbor_indefinite_len_array.py b/tests/utils/test_cbor_indefinite_len_array.py index 1de96baa..1f23d8ba 100644 --- a/tests/utils/test_cbor_indefinite_len_array.py +++ b/tests/utils/test_cbor_indefinite_len_array.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/utils/test_data_bytes.py b/tests/utils/test_data_bytes.py index 65c42154..a31165e6 100644 --- a/tests/utils/test_data_bytes.py +++ b/tests/utils/test_data_bytes.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/tests/wif/test_wif.py b/tests/wif/test_wif.py index a1a4274a..f2592b3d 100644 --- a/tests/wif/test_wif.py +++ b/tests/wif/test_wif.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Emanuele Bellocchia +# Copyright (c) 2026 Emanuele Bellocchia # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal From 2f5d5b3008cc0244a493a18850d9d8fa162b2711 Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Fri, 27 Feb 2026 09:10:57 +0100 Subject: [PATCH 38/66] Update test_min_reqs.yml --- .github/workflows/test_min_reqs.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/test_min_reqs.yml b/.github/workflows/test_min_reqs.yml index a77bf2df..0d8f5e8f 100644 --- a/.github/workflows/test_min_reqs.yml +++ b/.github/workflows/test_min_reqs.yml @@ -52,6 +52,7 @@ jobs: pip install pycryptodome==3.15 pip install pynacl==1.5 pip install py-sr25519-bindings==0.1.3 + pip install pytoniq_core==0.1.0 pip install typing_extensions - name: Run tests run: | @@ -84,6 +85,7 @@ jobs: pip install pycryptodome==3.15 pip install pynacl==1.5 pip install py-sr25519-bindings==0.1.3 + pip install pytoniq_core==0.1.0 - name: Run tests run: | pytest @@ -115,6 +117,7 @@ jobs: pip install pycryptodome==3.15 pip install pynacl==1.5 pip install py-sr25519-bindings==0.1.3 + pip install pytoniq_core==0.1.0 - name: Run tests run: | pytest @@ -147,6 +150,7 @@ jobs: pip install pycryptodome==3.15 pip install pynacl==1.5 pip install py-sr25519-bindings==0.1.4 + pip install pytoniq_core==0.1.0 - name: Run tests run: | pytest @@ -209,6 +213,7 @@ jobs: pip install pycryptodome==3.15 pip install pynacl==1.5 pip install py-sr25519-bindings==0.2.0 + pip install pytoniq_core==0.1.0 - name: Run tests run: | pytest @@ -240,6 +245,7 @@ jobs: pip install pycryptodome==3.15 pip install pynacl==1.5 pip install py-sr25519-bindings==0.2.2 + pip install pytoniq_core==0.1.0 - name: Run tests run: | pytest From 7b24cbd8d6bb5af68869102a6e3b040680b48a5b Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Fri, 27 Feb 2026 09:15:22 +0100 Subject: [PATCH 39/66] Add BIP44 TON tests --- tests/bip/bip44/test_bip44.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/bip/bip44/test_bip44.py b/tests/bip/bip44/test_bip44.py index 73bdc09a..b33c045f 100644 --- a/tests/bip/bip44/test_bip44.py +++ b/tests/bip/bip44/test_bip44.py @@ -1902,6 +1902,30 @@ "0x02f9C86C8dA95C6748d063AA00c6DCD581311C06", ], }, + # Ton + { + "coin": Bip44Coins.TON, + "names": ("The Open Network", "TON"), + "is_testnet": False, + "seed": b"5eb00bbddcf069084889a8ab9155568165f5c453ccb85e70811aaed6f6da5fc19a5ac40b389cd370d086206dec8aa6c43daea6690f20ad3d8d48b2d2ce9e38e4", + "ex_master": "xprv9s21ZrQH143K4GYBne6aGFZLHUSCPzQ3amKxfzz6kHpqDLBHk58dvPW7twcRFJeo1oQAvNeiYpZEeUkWCW3YgdvXHUcQQU6xjh8jBo4Y8xG", + "wif_master": "", + "account": { + "ex_pub": "xpub6CRHWanBuDYomVH6yPdHjzw4mReJ1HRH2i3dqPcNA222SfCimALj1r1FAriJ1rRyw68qMtAgREW62kCMVQCMhR7WBnA7atSHLpiNDUhYjQA", + "ex_priv": "xprv9yRw75FJ4qzWZ1CdsN6HNrzLDPoobphRfV8331CkbgV3ZrsaDd2UU3gmKg24hLkDZJU1YoZQrTV2zVe4r8ApqvMRxdi2uMjoxLfrF5YcgQY", + }, + "chain_ext": { + "ex_pub": "xpub6EYY9ZsAv6251ZQRrgZMu5ApdTegaR2YWd1Yv2UWLczb9EvuYSri5bPZWPeCCyo6LVX3uWQR2HpYa7xbiwJVhXaWXMN9qhf1AtKdJiKXNxq", + "ex_priv": "xprvA1ZBk4LH5iTmo5Kxkf2MXwE65RpCAxJh9Q5x7e4tnHTcGSbkzuYTXo55fCbG3jH5JWDrLj31S4PAYyxhN95YQJpzeZn9EfL27m9eG6pZ6dw", + }, + "addresses": [ + "UQDxAUFadQXDd3EXGa3TLF_EF66gMc9h3_aZ0j0zXNoIYUCc", + "UQBHJG1XpSPMRBaS6Ae-xcufra2eXnAKQadJaEPXfTi8xVWR", + "UQA-ooQWPu_E8R0PfBC4Urg5RtNaelw538RIKTlMqGhy6dhM", + "UQB2G4IoTJnMB9sdRZHKKHuVrsoTZ1fJFlwRI84gsyncBp1c", + "UQAPUP6gFteMDnS6iJnKHd5Wx-yK_nk35Pk8SNGOKcCVd_69", + ], + }, # Tron { "coin": Bip44Coins.TRON, @@ -2794,6 +2818,12 @@ "seed": b"5eb00bbddcf069084889a8ab9155568165f5c453ccb85e70811aaed6f6da5fc19a5ac40b389cd370d086206dec8aa6c43daea6690f20ad3d8d48b2d2ce9e38e4", "default_address": "0xB16f8D941d7D281aDCEf3e950aBF2147D7AC2D33", }, + # Ton + { + "coin": Bip44Coins.TON, + "seed": b"5eb00bbddcf069084889a8ab9155568165f5c453ccb85e70811aaed6f6da5fc19a5ac40b389cd370d086206dec8aa6c43daea6690f20ad3d8d48b2d2ce9e38e4", + "default_address": "UQAzWZa6nM5mJev91wGc7VCSfBoIsYRqKJpV78N8Add9-RKY", + }, # Tron { "coin": Bip44Coins.TRON, From 980bd37a7cc612708d653fbcd3110f5d9b38401d Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Fri, 27 Feb 2026 09:38:06 +0100 Subject: [PATCH 40/66] Update ton.py --- examples/ton.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/examples/ton.py b/examples/ton.py index 00cfd63d..77b05ffa 100644 --- a/examples/ton.py +++ b/examples/ton.py @@ -40,10 +40,9 @@ # Generate keypair and address ton = Ton.FromSeed(seed_bytes) -print(f"Public key: {ton.PublicKey().RawCompressed().ToHex()}") -print(f"Private key: {ton.PrivateKey().Raw().ToHex()}") -print(f"Address: {ton.GetAddress()}") - +print(f"Ton public key (ton-crypto): {ton.PublicKey().RawCompressed().ToHex()}") +print(f"Ton private key (ton-crypto): {ton.PrivateKey().Raw().ToHex()}") +print(f"Ton address (ton-crypto, V5R1): {ton.GetAddress(version=TonAddrVersions.V5R1)}") # From c6394a642e3eb8d6e3e58ed521f5f16f60255048 Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Fri, 27 Feb 2026 09:38:17 +0100 Subject: [PATCH 41/66] Check for parameters at the beginning --- bip_utils/addr/ton_addr.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/bip_utils/addr/ton_addr.py b/bip_utils/addr/ton_addr.py index 3dd744bc..5565737b 100644 --- a/bip_utils/addr/ton_addr.py +++ b/bip_utils/addr/ton_addr.py @@ -62,15 +62,14 @@ def EncodeKey(pub_key: Union[bytes, IPublicKey], ValueError: If the public key is not valid TypeError: If the public key is not ed25519 """ - pub_key_obj = AddrKeyValidator.ValidateAndGetEd25519Key(pub_key) - ton_pub_key_obj = TonPublicKey.FromBytesOrKeyObject(pub_key_obj) - version = kwargs.get("version", TonAddrVersions.V4) if not isinstance(version, TonAddrVersions): raise TypeError("Version is not an enumerative of TonAddrVersions") - is_bounceable = kwargs.get("is_bounceable", False) + pub_key_obj = AddrKeyValidator.ValidateAndGetEd25519Key(pub_key) + ton_pub_key_obj = TonPublicKey.FromBytesOrKeyObject(pub_key_obj) + if version == TonAddrVersions.V5R1: return TonV5R1AddrEncoder(ton_pub_key_obj).Encode(is_bounceable) elif version == TonAddrVersions.V4: From 51c4be88344d238812bcbdb73db34b162f571cee Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Fri, 27 Feb 2026 09:38:30 +0100 Subject: [PATCH 42/66] Add tests for TON addr --- tests/addr/test_ton_addr.py | 102 ++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 tests/addr/test_ton_addr.py diff --git a/tests/addr/test_ton_addr.py b/tests/addr/test_ton_addr.py new file mode 100644 index 00000000..73f979ea --- /dev/null +++ b/tests/addr/test_ton_addr.py @@ -0,0 +1,102 @@ +# Copyright (c) 2026 Emanuele Bellocchia +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +# Imports +from bip_utils import TonAddr, TonAddrEncoder, TonAddrVersions +from tests.addr.test_addr_base import AddrBaseTests +from tests.addr.test_addr_const import TEST_ED25519_ADDR_INVALID_KEY_TYPES +from tests.ecc.test_ecc import TEST_VECT_ED25519_PUB_KEY_INVALID, Ed25519PublicKey + + +# Some random public keys +TEST_VECT = [ + { + "pub_key": b"00c6ba5594e3334ff890d2ab1dcf6757099b3505fd802d9ca1b4fc8b883f89a9de", + "address_dec": b"", + "address_params": { + "version": TonAddrVersions.V3R1, + }, + "address": "UQCrT9wQSjIWfJIrWitT5dup79QzkHvKs8jWx_UOoKQlXvP_", + }, + { + "pub_key": b"00961411d8c9e817055fd615ad953cc0f87dad689ec23a1c48fc06e5472efecc55", + "address_dec": b"", + "address_params": { + "version": TonAddrVersions.V3R2, + }, + "address": "UQB-ejjqwZvzd8m7fcZbPTofsRbGbuw96bQ190Lgi198e1Gl", + }, + { + "pub_key": b"00479a59b16b5fe57fa99dd763a3de0908cdc05d8a72f1ae1b535545dc6514e2ac", + "address_dec": b"", + "address_params": { + "version": TonAddrVersions.V4, + }, + "address": "UQBhx8AhGyL7153Yaf8svkZkEKbG0JcsUcNpTwu2kOm5WaW7", + }, + { + "pub_key": b"1af97d53283a3c57f47db2b97263e86c93acc38853ca2246db5daa32cb7a1037", + "address_dec": b"", + "address_params": { + "version": TonAddrVersions.V4, + }, + "address": "UQD3dn7-3QdJT_36TEL16JYWDz0tWqkNbuEKyOEjy0-1NbfG", + }, + { + "pub_key": b"ad724aba20a7591624efee55eae11ec1f765d483544a9bf42ff7467d0f88a113", + "address_dec": b"", + "address_params": { + "version": TonAddrVersions.V5R1, + }, + "address": "UQB8E-CQxLds85ZPY8sXEYGe_EQ1qlY6q7l3BNbWQC1srNHe", + }, +] + + +# +# Tests +# +class TonAddrTests(AddrBaseTests): + # Test encode key + def test_encode_key(self): + self._test_encode_key(TonAddrEncoder, Ed25519PublicKey, TEST_VECT) + + # Test invalid keys + def test_invalid_keys(self): + self._test_invalid_keys( + TonAddrEncoder, + { + "version": TonAddrVersions.V4, + }, + TEST_ED25519_ADDR_INVALID_KEY_TYPES, + TEST_VECT_ED25519_PUB_KEY_INVALID + ) + + # Test invalid parameters + def test_invalid_params(self): + self._test_invalid_params_enc( + TonAddrEncoder, + {"version": 0}, + TypeError + ) + + # Test old address class + def test_old_addr_cls(self): + self.assertTrue(TonAddr is TonAddrEncoder) From 9d533bb18132018294ff043068b2b32bbfba94e0 Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Fri, 27 Feb 2026 09:46:27 +0100 Subject: [PATCH 43/66] Fix imports --- bip_utils/__init__.py | 8 ++++---- bip_utils/ton/__init__.py | 2 -- bip_utils/ton/keys/__init__.py | 1 + bip_utils/ton/{ton_ex.py => keys/ton_keys_ex.py} | 0 4 files changed, 5 insertions(+), 6 deletions(-) rename bip_utils/ton/{ton_ex.py => keys/ton_keys_ex.py} (100%) diff --git a/bip_utils/__init__.py b/bip_utils/__init__.py index dc9886de..8c28c394 100644 --- a/bip_utils/__init__.py +++ b/bip_utils/__init__.py @@ -387,10 +387,6 @@ ) # TON -from bip_utils.ton import ( - Ton, - TonKeyError, -) from bip_utils.ton.addr import ( TonAddrVersions, TonV3R1AddrEncoder, @@ -399,6 +395,7 @@ TonV5R1AddrEncoder, ) from bip_utils.ton.keys import ( + TonKeyError, TonPrivateKey, TonPublicKey, ) @@ -411,6 +408,9 @@ TonSeedTypes, TonWordsNum, ) +from bip_utils.ton.ton import ( + Ton, +) # Utils from bip_utils.utils.crypto import ( diff --git a/bip_utils/ton/__init__.py b/bip_utils/ton/__init__.py index 9f784b07..e69de29b 100644 --- a/bip_utils/ton/__init__.py +++ b/bip_utils/ton/__init__.py @@ -1,2 +0,0 @@ -from bip_utils.ton.ton import Ton -from bip_utils.ton.ton_ex import TonKeyError diff --git a/bip_utils/ton/keys/__init__.py b/bip_utils/ton/keys/__init__.py index a2fe1bd7..9854cac6 100644 --- a/bip_utils/ton/keys/__init__.py +++ b/bip_utils/ton/keys/__init__.py @@ -1 +1,2 @@ from bip_utils.ton.keys.ton_keys import TonPrivateKey, TonPublicKey +from bip_utils.ton.keys.ton_keys_ex import TonKeyError diff --git a/bip_utils/ton/ton_ex.py b/bip_utils/ton/keys/ton_keys_ex.py similarity index 100% rename from bip_utils/ton/ton_ex.py rename to bip_utils/ton/keys/ton_keys_ex.py From 1cece118b7031f189ff17420cd7c744782d6a032 Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Fri, 27 Feb 2026 09:47:26 +0100 Subject: [PATCH 44/66] Update ton_keys.py --- bip_utils/ton/keys/ton_keys.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bip_utils/ton/keys/ton_keys.py b/bip_utils/ton/keys/ton_keys.py index c63d77a6..34ac2df8 100644 --- a/bip_utils/ton/keys/ton_keys.py +++ b/bip_utils/ton/keys/ton_keys.py @@ -28,7 +28,7 @@ from bip_utils.ecc import IPrivateKey, IPublicKey from bip_utils.ecc.ed25519.ed25519_keys import Ed25519PrivateKey, Ed25519PublicKey -from bip_utils.ton.ton_ex import TonKeyError +from bip_utils.ton.keys.ton_keys_ex import TonKeyError from bip_utils.utils.misc import DataBytes From 75bb3cdfe6842cc161a7bfb680ed063d15e4819c Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Fri, 27 Feb 2026 11:02:38 +0100 Subject: [PATCH 45/66] Update pytoniq_core --- .github/workflows/test_min_reqs.yml | 12 ++++++------ README.md | 2 +- requirements.txt | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test_min_reqs.yml b/.github/workflows/test_min_reqs.yml index 0d8f5e8f..79690f31 100644 --- a/.github/workflows/test_min_reqs.yml +++ b/.github/workflows/test_min_reqs.yml @@ -52,7 +52,7 @@ jobs: pip install pycryptodome==3.15 pip install pynacl==1.5 pip install py-sr25519-bindings==0.1.3 - pip install pytoniq_core==0.1.0 + pip install pytoniq-core-fork==0.1.47 pip install typing_extensions - name: Run tests run: | @@ -85,7 +85,7 @@ jobs: pip install pycryptodome==3.15 pip install pynacl==1.5 pip install py-sr25519-bindings==0.1.3 - pip install pytoniq_core==0.1.0 + pip install pytoniq-core-fork==0.1.47 - name: Run tests run: | pytest @@ -117,7 +117,7 @@ jobs: pip install pycryptodome==3.15 pip install pynacl==1.5 pip install py-sr25519-bindings==0.1.3 - pip install pytoniq_core==0.1.0 + pip install pytoniq-core-fork==0.1.47 - name: Run tests run: | pytest @@ -150,7 +150,7 @@ jobs: pip install pycryptodome==3.15 pip install pynacl==1.5 pip install py-sr25519-bindings==0.1.4 - pip install pytoniq_core==0.1.0 + pip install pytoniq-core-fork==0.1.47 - name: Run tests run: | pytest @@ -213,7 +213,7 @@ jobs: pip install pycryptodome==3.15 pip install pynacl==1.5 pip install py-sr25519-bindings==0.2.0 - pip install pytoniq_core==0.1.0 + pip install pytoniq-core-fork==0.1.47 - name: Run tests run: | pytest @@ -245,7 +245,7 @@ jobs: pip install pycryptodome==3.15 pip install pynacl==1.5 pip install py-sr25519-bindings==0.2.2 - pip install pytoniq_core==0.1.0 + pip install pytoniq-core-fork==0.1.47 - name: Run tests run: | pytest diff --git a/README.md b/README.md index ba5a8d81..88f8578c 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ Package dependencies: - [ed25519-blake2b](https://pypi.org/project/ed25519-blake2b/) for ed25519-blake2b curve - [pynacl](https://pypi.org/project/PyNaCl/) for ed25519 curve - [py-sr25519-bindings](https://pypi.org/project/py-sr25519-bindings/) for sr25519 curve -- [pytoniq_core](https://pypi.org/project/pytoniq-core/) for TON primitives +- [pytoniq-core-fork](https://github.com/ebellocchia/pytoniq-core) for TON primitives (my fork to extend compatibility to Python >= 3.7) Please note that, for the py-sr25519-bindings library, Rust is required to be installed. diff --git a/requirements.txt b/requirements.txt index f1b43501..9ae908c5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -16,5 +16,5 @@ py-sr25519-bindings>=0.1.3,<2.0.0; python_version < '3.10' py-sr25519-bindings>=0.1.4,<2.0.0; python_version == '3.10' py-sr25519-bindings>=0.2.0,<2.0.0; python_version >= '3.11' py-sr25519-bindings>=0.2.2,<2.0.0; python_version >= '3.13' -pytoniq_core>=0.1.0,<0.2.0 +pytoniq-core-fork>=0.1.47,<0.2.0 typing_extensions; python_version == '3.7' From 4a357f49fe20c1b896cce5796195af7fdfd1637e Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Fri, 27 Feb 2026 11:06:00 +0100 Subject: [PATCH 46/66] Update test_min_reqs.yml --- .github/workflows/test_min_reqs.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test_min_reqs.yml b/.github/workflows/test_min_reqs.yml index 79690f31..464d2ea1 100644 --- a/.github/workflows/test_min_reqs.yml +++ b/.github/workflows/test_min_reqs.yml @@ -182,6 +182,7 @@ jobs: pip install pycryptodome==3.15 pip install pynacl==1.5 pip install py-sr25519-bindings==0.2.0 + pip install pytoniq-core-fork==0.1.47 - name: Run tests run: | pytest From cf7bf721d6e22309812932ccf2e1248ce5e3f16e Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Fri, 27 Feb 2026 11:48:00 +0100 Subject: [PATCH 47/66] Update test.yml --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ceefd917..649bdafc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -117,7 +117,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.11", "3.12", "3.13"] + python-version: ["3.11", "3.12", "3.13", "3.14"] os: - ubuntu-latest - macOS-latest From 98ee943a7b96ebe975844a05e1dfc76661432f3a Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Fri, 27 Feb 2026 13:24:13 +0100 Subject: [PATCH 48/66] Update test.yml --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 649bdafc..ceefd917 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -117,7 +117,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.11", "3.12", "3.13", "3.14"] + python-version: ["3.11", "3.12", "3.13"] os: - ubuntu-latest - macOS-latest From a033563b026c1346d3255826a0f3ced9d707dcbd Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Fri, 27 Feb 2026 13:24:34 +0100 Subject: [PATCH 49/66] Move passphrase to constructor --- bip_utils/ton/mnemonic/ton_seed_generator.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/bip_utils/ton/mnemonic/ton_seed_generator.py b/bip_utils/ton/mnemonic/ton_seed_generator.py index d2bd115d..aae20434 100644 --- a/bip_utils/ton/mnemonic/ton_seed_generator.py +++ b/bip_utils/ton/mnemonic/ton_seed_generator.py @@ -48,33 +48,35 @@ class TonSeedGenerator: """ m_mnemonic: str + m_passphrase: str def __init__(self, mnemonic: Union[str, Mnemonic], + passphrase: str = "", lang: TonLanguages = TonLanguages.ENGLISH) -> None: """ Construct class. Args: mnemonic (str or Mnemonic object): Mnemonic + passphrase (str, optional) : Passphrase (empty by default) lang (TonLanguages, optional) : Language (default: English) Raises: ValueError: If the mnemonic is not valid """ mnemonic_str = mnemonic if isinstance(mnemonic, str) else mnemonic.ToStr() - if not TonMnemonicValidator(lang).IsValid(mnemonic_str): + if not TonMnemonicValidator(lang).IsValid(mnemonic_str, passphrase): raise ValueError(f"Invalid mnemonic {mnemonic_str}") self.m_mnemonic = mnemonic_str + self.m_passphrase = passphrase def Generate(self, - passphrase: str = "", seed_type: TonSeedTypes = TonSeedTypes.PRIVATE_KEY) -> bytes: """ Generate seed. Args: - passphrase (str, optional) : Passphrase (empty by default) seed_type (TonSeedTypes, optional): Seed type (PRIVATE_KEY by default) Returns: @@ -86,7 +88,7 @@ def Generate(self, if not isinstance(seed_type, TonSeedTypes): raise TypeError("Seed type is not an enumerative of TonSeedTypes") - entropy_bytes = TonSeedUtils.GetEntropyBytes(self.m_mnemonic, passphrase) + entropy_bytes = TonSeedUtils.GetEntropyBytes(self.m_mnemonic, self.m_passphrase) if seed_type == TonSeedTypes.PRIVATE_KEY: return TonSeedUtils.GetPrivateKeySeed(entropy_bytes) return TonSeedUtils.GetHdKeySeed(entropy_bytes) From c6de8494bf8ab9fed026128b055feaf63a59308f Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Fri, 27 Feb 2026 13:24:37 +0100 Subject: [PATCH 50/66] Update test_ton_addr.py --- tests/addr/test_ton_addr.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tests/addr/test_ton_addr.py b/tests/addr/test_ton_addr.py index 73f979ea..8b49c6d0 100644 --- a/tests/addr/test_ton_addr.py +++ b/tests/addr/test_ton_addr.py @@ -29,7 +29,6 @@ TEST_VECT = [ { "pub_key": b"00c6ba5594e3334ff890d2ab1dcf6757099b3505fd802d9ca1b4fc8b883f89a9de", - "address_dec": b"", "address_params": { "version": TonAddrVersions.V3R1, }, @@ -37,7 +36,6 @@ }, { "pub_key": b"00961411d8c9e817055fd615ad953cc0f87dad689ec23a1c48fc06e5472efecc55", - "address_dec": b"", "address_params": { "version": TonAddrVersions.V3R2, }, @@ -45,7 +43,6 @@ }, { "pub_key": b"00479a59b16b5fe57fa99dd763a3de0908cdc05d8a72f1ae1b535545dc6514e2ac", - "address_dec": b"", "address_params": { "version": TonAddrVersions.V4, }, @@ -53,7 +50,6 @@ }, { "pub_key": b"1af97d53283a3c57f47db2b97263e86c93acc38853ca2246db5daa32cb7a1037", - "address_dec": b"", "address_params": { "version": TonAddrVersions.V4, }, @@ -61,7 +57,6 @@ }, { "pub_key": b"ad724aba20a7591624efee55eae11ec1f765d483544a9bf42ff7467d0f88a113", - "address_dec": b"", "address_params": { "version": TonAddrVersions.V5R1, }, From 24c9525dd9ca90b6c9cff8b82e92ee4cdf3e1b79 Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Fri, 27 Feb 2026 13:24:45 +0100 Subject: [PATCH 51/66] Add tests for TON mnemonics --- tests/ton/__init__.py | 0 tests/ton/mnemonic/test_ton_mnemonic.py | 147 ++++++++++++++++++++++++ 2 files changed, 147 insertions(+) create mode 100644 tests/ton/__init__.py create mode 100644 tests/ton/mnemonic/test_ton_mnemonic.py diff --git a/tests/ton/__init__.py b/tests/ton/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/ton/mnemonic/test_ton_mnemonic.py b/tests/ton/mnemonic/test_ton_mnemonic.py new file mode 100644 index 00000000..94c71d25 --- /dev/null +++ b/tests/ton/mnemonic/test_ton_mnemonic.py @@ -0,0 +1,147 @@ +# Copyright (c) 2026 Emanuele Bellocchia +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +# Imports +import binascii +import unittest + +from bip_utils import ( + TonLanguages, + TonMnemonic, + TonMnemonicGenerator, + TonMnemonicValidator, + TonSeedGenerator, + TonSeedTypes, + TonWordsNum, +) + + +TEST_VECT = [ + { + "mnemonic": "ask fossil tragic dune session prize own bundle element shift pony trouble hamster topple mammal estate strike impulse post moment club hard step lamp", + "passphrase": "", + "seed_hd": b"1ebeff074cfc42d61e4819f48f86d4a8740c90acd5b515884a2ea58187fe16aa227ab03764349e7942136354c060f2074ed8dceeee45cfdabf0205cf476fb9fc", + "seed_priv": b"ef1c1bce29e7497157699b1b5365d69f02b30a567f9cc0ab74962c9a466106698909a23c6c00ea8426c40562c21868314496bfe10622a6016333efea30d51562", + "lang": TonLanguages.ENGLISH, + }, + { + "mnemonic": "polar regular twist rose satisfy dove allow prepare frown appear neck ready entry island win turkey consider social muffin door rough maze impact online", + "passphrase": "", + "seed_hd": b"fd26ff9457cfbe32f353a76ece6dd81894663ba9b403f29a17d1e836643269d2781b7c76f775c8dea90905d3673551046b46d01aa9a5f255d8d4729cae58aa7c", + "seed_priv": b"f5c79f584790dd71bb0517c2d25a7106120bda1a50e77cbf50676b922bbef2501b22306bc64d6ce02734ec86368430c83390976d63e1553417efe68f87cd0470", + "lang": TonLanguages.ENGLISH, + }, + { + "mnemonic": "enlist rhythm fortune stove enact effort step labor myself brand clay exercise easy copper chaos gospel holiday enrich stuff twist cement oblige core travel", + "passphrase": "test", + "seed_hd": b"f841fb6cf6dbd4fb2d6783057802253b21980f0a96d55f44dbf20725e648fe4b08bf2378a819d8fddf44cc9b1364483a767134abfa442f8e0c29ad8a91935d1f", + "seed_priv": b"2ae1035120d67a1fa6f69f5c816efcbb9bcbcfb778424dc30a3cbb24612ed3d25d55e30110ceecc5d63503d1410ac8be10eb020d6707c4af9274b337e4f1b08d", + "lang": TonLanguages.ENGLISH, + }, + { + "mnemonic": "wasp salad dice grit crew legal address peanut kingdom demise park patrol caution search usual stumble author inside ginger announce track reunion walnut sausage", + "passphrase": "test", + "seed_hd": b"f28193511e5c784674de0652d41d6625064483aa05eca360c55e44572f013a4ead501144dfbb42aad75340824307d34641d2a8091d41f4fce7def987ff954b68", + "seed_priv": b"2566dacf043a453fc142b7cbdd047001683e79d0df759aa6a841b5077bf7008b2fe71fde062126384e36da9a37c9790467ea1d51d2297d5d9297f13460827d99", + "lang": TonLanguages.ENGLISH, + }, +] + +# Tests for invalid mnemonics +TEST_VECT_MNEMONIC_INVALID = [ + # Wrong length + { + "mnemonic": "ask fossil tragic dune session prize own bundle element shift pony trouble hamster topple mammal estate strike impulse post moment club hard step", + "exception": ValueError, + }, + { + "mnemonic": "ask fossil tragic dune session prize own bundle element shift pony trouble hamster topple mammal estate strike impulse post moment club hard step lamp step", + "exception": ValueError, + }, + # Not existent word + { + "mnemonic": "ask fossil tragic dune session prize own bundle element shift pony trouble hamster topple mammal estate strike impulse post moment club hard step notexistent", + "exception": ValueError, + }, +] + + +# +# Tests +# +class TonMnemonicTests(unittest.TestCase): + # Run all tests in test vector + def test_vector(self): + for test in TEST_VECT: + lang = test["lang"] + mnemonic = test["mnemonic"] + passphrase = test["passphrase"] + + # Test mnemonic validator (language specified) + mnemonic_validator = TonMnemonicValidator(lang) + self.assertTrue(mnemonic_validator.IsValid(mnemonic, passphrase)) + # Test mnemonic validator (automatic language detection) + mnemonic_validator = TonMnemonicValidator() + self.assertTrue(mnemonic_validator.IsValid(mnemonic, passphrase)) + + # Test seed generator + seed_hd = TonSeedGenerator(mnemonic, passphrase, lang).Generate(TonSeedTypes.HD_KEY) + self.assertEqual(test["seed_hd"], binascii.hexlify(seed_hd)) + + seed_priv = TonSeedGenerator(mnemonic, passphrase, lang).Generate(TonSeedTypes.PRIVATE_KEY) + self.assertEqual(test["seed_priv"], binascii.hexlify(seed_priv)) + + # Test mnemonic generator + def test_generator(self): + for lang in TonLanguages: + for words_num in TonWordsNum: + for passphrase in ["", "test"]: + mnemonic = TonMnemonicGenerator(lang).FromWordsNumber(words_num, passphrase) + + self.assertTrue(isinstance(mnemonic, TonMnemonic)) + self.assertEqual(words_num, mnemonic.WordsCount()) + self.assertTrue(TonMnemonicValidator(lang).IsValid(mnemonic, passphrase)) + + # Test validation of a mnemonic with/without a passphrase + def test_passphrase_validation(self): + mnemonic = TonMnemonicGenerator().FromWordsNumber(TonWordsNum.WORDS_NUM_24) + self.assertFalse(TonMnemonicValidator().IsValid(mnemonic, "test")) + self.assertRaises(ValueError, TonSeedGenerator, mnemonic, "test") + + mnemonic = TonMnemonicGenerator().FromWordsNumber(TonWordsNum.WORDS_NUM_24, "test") + self.assertFalse(TonMnemonicValidator().IsValid(mnemonic)) + self.assertRaises(ValueError, TonSeedGenerator, mnemonic) + + # Tests invalid mnemonic + def test_invalid_mnemonic(self): + for test in TEST_VECT_MNEMONIC_INVALID: + lang = test["lang"] if "lang" in test else TonLanguages.ENGLISH + + self.assertFalse(TonMnemonicValidator(lang).IsValid(test["mnemonic"])) + self.assertRaises(test["exception"], TonSeedGenerator, test["mnemonic"], "", lang) + + # Tests invalid parameters + def test_invalid_params(self): + self.assertRaises(TypeError, TonMnemonicGenerator, 0) + self.assertRaises(TypeError, TonMnemonicValidator, 0) + self.assertRaises(TypeError, TonSeedGenerator, "", "", 0) + + mnemonic = TonMnemonicGenerator().FromWordsNumber(TonWordsNum.WORDS_NUM_24) + self.assertRaises(TypeError, TonSeedGenerator(mnemonic).Generate, 0) From f6f162ba9704f2f055d76acb31f4274351c45b40 Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Fri, 27 Feb 2026 13:29:57 +0100 Subject: [PATCH 52/66] Create __init__.py --- tests/ton/mnemonic/__init__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 tests/ton/mnemonic/__init__.py diff --git a/tests/ton/mnemonic/__init__.py b/tests/ton/mnemonic/__init__.py new file mode 100644 index 00000000..e69de29b From 4d7a712920554be29fee1a2275607e75b9ae6d18 Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Fri, 27 Feb 2026 13:30:01 +0100 Subject: [PATCH 53/66] Reformat imports --- tests/addr/test_ada_byron_addr.py | 12 +++++- tests/addr/test_ada_shelley_addr.py | 13 +++++-- tests/addr/test_avax_addr.py | 8 +++- tests/addr/test_substrate_addr.py | 13 +++++-- tests/addr/test_xmr_addr.py | 9 ++++- .../mnemonic/test_algorand_mnemonic.py | 14 +++++-- tests/bip/bip32/test_bip32_base.py | 12 +++++- tests/bip/bip32/test_bip32_keys.py | 10 ++++- tests/bip/bip32/test_bip32_path.py | 10 ++++- .../test_bip32_slip10_ed25519_blake2b.py | 6 ++- tests/bip/bip38/test_bip38_no_ec.py | 8 +++- tests/bip/bip39/test_bip39.py | 11 +++++- tests/bip/bip44_base/test_bip44_base.py | 14 ++++++- tests/bip/bip44_base/test_bip44_keys.py | 23 +++++++++--- tests/cardano/shelley/test_cardano_shelley.py | 10 ++++- .../shelley/test_cardano_shelley_keys.py | 8 +++- tests/ecc/test_ecc.py | 37 ++++++++++++++++--- .../mnemonic/test_electrum_v1_mnemonic.py | 11 +++++- .../mnemonic/test_electrum_v2_mnemonic.py | 15 ++++++-- tests/electrum/test_electrum_v1.py | 8 +++- tests/electrum/test_electrum_v2.py | 10 ++++- tests/monero/mnemonic/test_monero_mnemonic.py | 12 +++++- tests/monero/test_monero.py | 9 ++++- tests/monero/test_monero_keys.py | 27 +++++++++++--- tests/slip/slip32/test_slip32.py | 8 +++- tests/substrate/test_substrate.py | 16 ++++++-- tests/substrate/test_substrate_keys.py | 25 ++++++++++--- tests/substrate/test_substrate_path.py | 7 +++- tests/substrate/test_substrate_scale_enc.py | 10 ++++- tests/wif/test_wif.py | 7 +++- 30 files changed, 307 insertions(+), 76 deletions(-) diff --git a/tests/addr/test_ada_byron_addr.py b/tests/addr/test_ada_byron_addr.py index 2b11181c..7ea6dbc7 100644 --- a/tests/addr/test_ada_byron_addr.py +++ b/tests/addr/test_ada_byron_addr.py @@ -22,8 +22,16 @@ import binascii from bip_utils import ( - AdaByronAddrDecoder, AdaByronAddrTypes, AdaByronIcarusAddr, AdaByronIcarusAddrEncoder, AdaByronLegacyAddr, - AdaByronLegacyAddrEncoder, Bip32ChainCode, Bip32PathError, Bip32PathParser, ChaCha20Poly1305 + AdaByronAddrDecoder, + AdaByronAddrTypes, + AdaByronIcarusAddr, + AdaByronIcarusAddrEncoder, + AdaByronLegacyAddr, + AdaByronLegacyAddrEncoder, + Bip32ChainCode, + Bip32PathError, + Bip32PathParser, + ChaCha20Poly1305, ) from tests.addr.test_addr_base import AddrBaseTests from tests.addr.test_addr_const import TEST_ED25519_ADDR_INVALID_KEY_TYPES diff --git a/tests/addr/test_ada_shelley_addr.py b/tests/addr/test_ada_shelley_addr.py index 0029b7aa..87badd76 100644 --- a/tests/addr/test_ada_shelley_addr.py +++ b/tests/addr/test_ada_shelley_addr.py @@ -22,9 +22,16 @@ import binascii from bip_utils import ( - AdaShelleyAddr, AdaShelleyAddrDecoder, AdaShelleyAddrEncoder, AdaShelleyAddrNetworkTags, AdaShelleyRewardAddr, - AdaShelleyRewardAddrDecoder, AdaShelleyRewardAddrEncoder, AdaShelleyStakingAddr, AdaShelleyStakingAddrDecoder, - AdaShelleyStakingAddrEncoder + AdaShelleyAddr, + AdaShelleyAddrDecoder, + AdaShelleyAddrEncoder, + AdaShelleyAddrNetworkTags, + AdaShelleyRewardAddr, + AdaShelleyRewardAddrDecoder, + AdaShelleyRewardAddrEncoder, + AdaShelleyStakingAddr, + AdaShelleyStakingAddrDecoder, + AdaShelleyStakingAddrEncoder, ) from tests.addr.test_addr_base import AddrBaseTests from tests.addr.test_addr_const import TEST_ED25519_ADDR_INVALID_KEY_TYPES diff --git a/tests/addr/test_avax_addr.py b/tests/addr/test_avax_addr.py index 631015de..bcdcfa62 100644 --- a/tests/addr/test_avax_addr.py +++ b/tests/addr/test_avax_addr.py @@ -20,8 +20,12 @@ # Imports from bip_utils import ( - AvaxPChainAddr, AvaxPChainAddrDecoder, AvaxPChainAddrEncoder, AvaxXChainAddr, AvaxXChainAddrDecoder, - AvaxXChainAddrEncoder + AvaxPChainAddr, + AvaxPChainAddrDecoder, + AvaxPChainAddrEncoder, + AvaxXChainAddr, + AvaxXChainAddrDecoder, + AvaxXChainAddrEncoder, ) from tests.addr.test_addr_base import AddrBaseTests from tests.addr.test_addr_const import TEST_SECP256K1_ADDR_INVALID_KEY_TYPES diff --git a/tests/addr/test_substrate_addr.py b/tests/addr/test_substrate_addr.py index eb98dabe..90b27cc2 100644 --- a/tests/addr/test_substrate_addr.py +++ b/tests/addr/test_substrate_addr.py @@ -20,13 +20,20 @@ # Imports from bip_utils import ( - SubstrateEd25519Addr, SubstrateEd25519AddrDecoder, SubstrateEd25519AddrEncoder, SubstrateSr25519Addr, - SubstrateSr25519AddrDecoder, SubstrateSr25519AddrEncoder + SubstrateEd25519Addr, + SubstrateEd25519AddrDecoder, + SubstrateEd25519AddrEncoder, + SubstrateSr25519Addr, + SubstrateSr25519AddrDecoder, + SubstrateSr25519AddrEncoder, ) from tests.addr.test_addr_base import AddrBaseTests from tests.addr.test_addr_const import TEST_ED25519_ADDR_INVALID_KEY_TYPES, TEST_SR25519_ADDR_INVALID_KEY_TYPES from tests.ecc.test_ecc import ( - TEST_VECT_ED25519_PUB_KEY_INVALID, TEST_VECT_SR25519_PUB_KEY_INVALID, Ed25519PublicKey, Sr25519PublicKey + TEST_VECT_ED25519_PUB_KEY_INVALID, + TEST_VECT_SR25519_PUB_KEY_INVALID, + Ed25519PublicKey, + Sr25519PublicKey, ) diff --git a/tests/addr/test_xmr_addr.py b/tests/addr/test_xmr_addr.py index 6a384212..ed98fdbe 100644 --- a/tests/addr/test_xmr_addr.py +++ b/tests/addr/test_xmr_addr.py @@ -22,8 +22,13 @@ import binascii from bip_utils import ( - CoinsConf, XmrAddr, XmrAddrDecoder, XmrAddrEncoder, XmrIntegratedAddr, XmrIntegratedAddrDecoder, - XmrIntegratedAddrEncoder + CoinsConf, + XmrAddr, + XmrAddrDecoder, + XmrAddrEncoder, + XmrIntegratedAddr, + XmrIntegratedAddrDecoder, + XmrIntegratedAddrEncoder, ) from bip_utils.addr.xmr_addr import XmrAddrConst from tests.addr.test_addr_base import AddrBaseTests diff --git a/tests/algorand/mnemonic/test_algorand_mnemonic.py b/tests/algorand/mnemonic/test_algorand_mnemonic.py index 071b7bd8..7418e519 100644 --- a/tests/algorand/mnemonic/test_algorand_mnemonic.py +++ b/tests/algorand/mnemonic/test_algorand_mnemonic.py @@ -23,9 +23,17 @@ import unittest from bip_utils import ( - AlgorandEntropyBitLen, AlgorandEntropyGenerator, AlgorandLanguages, AlgorandMnemonicDecoder, - AlgorandMnemonicGenerator, AlgorandMnemonicValidator, AlgorandSeedGenerator, AlgorandWordsNum, Bip44, Bip44Coins, - MnemonicChecksumError + AlgorandEntropyBitLen, + AlgorandEntropyGenerator, + AlgorandLanguages, + AlgorandMnemonicDecoder, + AlgorandMnemonicGenerator, + AlgorandMnemonicValidator, + AlgorandSeedGenerator, + AlgorandWordsNum, + Bip44, + Bip44Coins, + MnemonicChecksumError, ) diff --git a/tests/bip/bip32/test_bip32_base.py b/tests/bip/bip32/test_bip32_base.py index 43f23e25..06dd45e2 100644 --- a/tests/bip/bip32/test_bip32_base.py +++ b/tests/bip/bip32/test_bip32_base.py @@ -23,8 +23,16 @@ import unittest from bip_utils import ( - Bip32ChainCode, Bip32Depth, Bip32FingerPrint, Bip32KeyData, Bip32KeyError, Bip32KeyIndex, Bip32KeyNetVersions, - Bip32PrivateKey, Bip32PublicKey, EllipticCurveGetter + Bip32ChainCode, + Bip32Depth, + Bip32FingerPrint, + Bip32KeyData, + Bip32KeyError, + Bip32KeyIndex, + Bip32KeyNetVersions, + Bip32PrivateKey, + Bip32PublicKey, + EllipticCurveGetter, ) from bip_utils.bip.bip32.bip32_key_data import Bip32KeyDataConst from bip_utils.bip.bip32.slip10.bip32_slip10_mst_key_generator import Bip32Slip10MstKeyGeneratorConst diff --git a/tests/bip/bip32/test_bip32_keys.py b/tests/bip/bip32/test_bip32_keys.py index 54be618c..96bf0603 100644 --- a/tests/bip/bip32/test_bip32_keys.py +++ b/tests/bip/bip32/test_bip32_keys.py @@ -20,8 +20,14 @@ # Imports from bip_utils import ( - Bip32ChainCode, Bip32Depth, Bip32FingerPrint, Bip32KeyData, Bip32KeyError, Bip32KeyIndex, Bip32PrivateKey, - Bip32PublicKey + Bip32ChainCode, + Bip32Depth, + Bip32FingerPrint, + Bip32KeyData, + Bip32KeyError, + Bip32KeyIndex, + Bip32PrivateKey, + Bip32PublicKey, ) from bip_utils.bip.bip32.bip32_const import Bip32Const from tests.ecc.test_ecc import * diff --git a/tests/bip/bip32/test_bip32_path.py b/tests/bip/bip32/test_bip32_path.py index 89ad9c40..f05d78ce 100644 --- a/tests/bip/bip32/test_bip32_path.py +++ b/tests/bip/bip32/test_bip32_path.py @@ -23,8 +23,14 @@ import unittest from bip_utils import ( - Bip32KeyIndex, Bip32Path, Bip32PathError, Bip32PathParser, Bip32Slip10Ed25519, Bip32Slip10Ed25519Blake2b, - Bip32Slip10Nist256p1, Bip32Slip10Secp256k1 + Bip32KeyIndex, + Bip32Path, + Bip32PathError, + Bip32PathParser, + Bip32Slip10Ed25519, + Bip32Slip10Ed25519Blake2b, + Bip32Slip10Nist256p1, + Bip32Slip10Secp256k1, ) diff --git a/tests/bip/bip32/test_bip32_slip10_ed25519_blake2b.py b/tests/bip/bip32/test_bip32_slip10_ed25519_blake2b.py index 2b5af169..27b32edf 100644 --- a/tests/bip/bip32/test_bip32_slip10_ed25519_blake2b.py +++ b/tests/bip/bip32/test_bip32_slip10_ed25519_blake2b.py @@ -20,7 +20,11 @@ # Imports from bip_utils import ( - Bip32Ed25519Blake2bSlip, Bip32KeyError, Bip32KeyIndex, Bip32Slip10Ed25519Blake2b, EllipticCurveTypes + Bip32Ed25519Blake2bSlip, + Bip32KeyError, + Bip32KeyIndex, + Bip32Slip10Ed25519Blake2b, + EllipticCurveTypes, ) from bip_utils.bip.bip32.slip10.bip32_slip10_mst_key_generator import Bip32Slip10MstKeyGeneratorConst from tests.bip.bip32.test_bip32_base import TEST_SEED, Bip32BaseTests diff --git a/tests/bip/bip38/test_bip38_no_ec.py b/tests/bip/bip38/test_bip38_no_ec.py index 24aecf78..0cd5184c 100644 --- a/tests/bip/bip38/test_bip38_no_ec.py +++ b/tests/bip/bip38/test_bip38_no_ec.py @@ -24,8 +24,12 @@ from bip_utils import Base58ChecksumError, Bip38Decrypter, Bip38Encrypter, Bip38PubKeyModes from tests.ecc.test_ecc import ( - TEST_ED25519_BLAKE2B_PRIV_KEY, TEST_ED25519_MONERO_PRIV_KEY, TEST_ED25519_PRIV_KEY, TEST_NIST256P1_PRIV_KEY, - TEST_SR25519_PRIV_KEY, TEST_VECT_SECP256K1_PRIV_KEY_INVALID + TEST_ED25519_BLAKE2B_PRIV_KEY, + TEST_ED25519_MONERO_PRIV_KEY, + TEST_ED25519_PRIV_KEY, + TEST_NIST256P1_PRIV_KEY, + TEST_SR25519_PRIV_KEY, + TEST_VECT_SECP256K1_PRIV_KEY_INVALID, ) diff --git a/tests/bip/bip39/test_bip39.py b/tests/bip/bip39/test_bip39.py index c290df7a..13841b09 100644 --- a/tests/bip/bip39/test_bip39.py +++ b/tests/bip/bip39/test_bip39.py @@ -23,8 +23,15 @@ import unittest from bip_utils import ( - Bip39EntropyBitLen, Bip39EntropyGenerator, Bip39Languages, Bip39MnemonicDecoder, Bip39MnemonicGenerator, - Bip39MnemonicValidator, Bip39SeedGenerator, Bip39WordsNum, MnemonicChecksumError + Bip39EntropyBitLen, + Bip39EntropyGenerator, + Bip39Languages, + Bip39MnemonicDecoder, + Bip39MnemonicGenerator, + Bip39MnemonicValidator, + Bip39SeedGenerator, + Bip39WordsNum, + MnemonicChecksumError, ) diff --git a/tests/bip/bip44_base/test_bip44_base.py b/tests/bip/bip44_base/test_bip44_base.py index 4dfd7732..96fd97af 100644 --- a/tests/bip/bip44_base/test_bip44_base.py +++ b/tests/bip/bip44_base/test_bip44_base.py @@ -23,8 +23,18 @@ import unittest from bip_utils import ( - Bip32KeyData, Bip32KeyError, Bip44Changes, Bip44Coins, Bip44DepthError, Bip44Levels, Bip44PrivateKey, - Bip44PublicKey, Bip49Coins, CardanoShelley, Cip1852Coins, Monero + Bip32KeyData, + Bip32KeyError, + Bip44Changes, + Bip44Coins, + Bip44DepthError, + Bip44Levels, + Bip44PrivateKey, + Bip44PublicKey, + Bip49Coins, + CardanoShelley, + Cip1852Coins, + Monero, ) from bip_utils.bip.bip32.bip32_key_data import Bip32KeyDataConst from bip_utils.bip.conf.common import BipCoinConf diff --git a/tests/bip/bip44_base/test_bip44_keys.py b/tests/bip/bip44_base/test_bip44_keys.py index aa1072dd..03fdab3a 100644 --- a/tests/bip/bip44_base/test_bip44_keys.py +++ b/tests/bip/bip44_base/test_bip44_keys.py @@ -22,15 +22,28 @@ import unittest from bip_utils import ( - Bip32PrivateKey, Bip32PublicKey, Bip44Conf, Bip44PrivateKey, Bip44PublicKey, Cip1852Coins, Cip1852ConfGetter, - DataBytes + Bip32PrivateKey, + Bip32PublicKey, + Bip44Conf, + Bip44PrivateKey, + Bip44PublicKey, + Cip1852Coins, + Cip1852ConfGetter, + DataBytes, ) from bip_utils.bip.bip32.bip32_const import Bip32Const from tests.bip.bip32.test_bip32_keys import TEST_BIP32_KEY_DATA from tests.ecc.test_ecc import ( - TEST_ED25519_BLAKE2B_PRIV_KEY, TEST_ED25519_BLAKE2B_PUB_KEY, TEST_ED25519_KHOLAW_PRIV_KEY, - TEST_ED25519_KHOLAW_PUB_KEY, TEST_ED25519_PRIV_KEY, TEST_ED25519_PUB_KEY, TEST_NIST256P1_PRIV_KEY, - TEST_NIST256P1_PUB_KEY, TEST_SECP256K1_PRIV_KEY, TEST_SECP256K1_PUB_KEY + TEST_ED25519_BLAKE2B_PRIV_KEY, + TEST_ED25519_BLAKE2B_PUB_KEY, + TEST_ED25519_KHOLAW_PRIV_KEY, + TEST_ED25519_KHOLAW_PUB_KEY, + TEST_ED25519_PRIV_KEY, + TEST_ED25519_PUB_KEY, + TEST_NIST256P1_PRIV_KEY, + TEST_NIST256P1_PUB_KEY, + TEST_SECP256K1_PRIV_KEY, + TEST_SECP256K1_PUB_KEY, ) diff --git a/tests/cardano/shelley/test_cardano_shelley.py b/tests/cardano/shelley/test_cardano_shelley.py index f849ed17..593fc040 100644 --- a/tests/cardano/shelley/test_cardano_shelley.py +++ b/tests/cardano/shelley/test_cardano_shelley.py @@ -23,8 +23,14 @@ import unittest from bip_utils import ( - Bip44, Bip44Changes, Bip44Coins, CardanoShelley, CardanoShelleyPrivateKeys, CardanoShelleyPublicKeys, Cip1852, - Cip1852Coins + Bip44, + Bip44Changes, + Bip44Coins, + CardanoShelley, + CardanoShelleyPrivateKeys, + CardanoShelleyPublicKeys, + Cip1852, + Cip1852Coins, ) diff --git a/tests/cardano/shelley/test_cardano_shelley_keys.py b/tests/cardano/shelley/test_cardano_shelley_keys.py index d5f7e1b7..e79c7e39 100644 --- a/tests/cardano/shelley/test_cardano_shelley_keys.py +++ b/tests/cardano/shelley/test_cardano_shelley_keys.py @@ -23,8 +23,12 @@ import unittest from bip_utils import ( - Bip32PrivateKey, Bip32PublicKey, CardanoShelleyPrivateKeys, CardanoShelleyPublicKeys, Cip1852Conf, - EllipticCurveTypes + Bip32PrivateKey, + Bip32PublicKey, + CardanoShelleyPrivateKeys, + CardanoShelleyPublicKeys, + Cip1852Conf, + EllipticCurveTypes, ) from bip_utils.bip.bip32.bip32_const import Bip32Const from tests.bip.bip32.test_bip32_keys import TEST_BIP32_KEY_DATA diff --git a/tests/ecc/test_ecc.py b/tests/ecc/test_ecc.py index 6539df61..f98b221c 100644 --- a/tests/ecc/test_ecc.py +++ b/tests/ecc/test_ecc.py @@ -30,12 +30,37 @@ from nacl import signing from bip_utils import ( - DataBytes, Ed25519, Ed25519Blake2b, Ed25519Blake2bPoint, Ed25519Blake2bPrivateKey, Ed25519Blake2bPublicKey, - Ed25519Kholaw, Ed25519KholawPoint, Ed25519KholawPrivateKey, Ed25519KholawPublicKey, Ed25519Monero, - Ed25519MoneroPoint, Ed25519MoneroPrivateKey, Ed25519MoneroPublicKey, Ed25519Point, Ed25519PrivateKey, - Ed25519PublicKey, EllipticCurveGetter, EllipticCurveTypes, Nist256p1, Nist256p1Point, Nist256p1PrivateKey, - Nist256p1PublicKey, Secp256k1, Secp256k1Point, Secp256k1PrivateKey, Secp256k1PublicKey, Sr25519, Sr25519Point, - Sr25519PrivateKey, Sr25519PublicKey + DataBytes, + Ed25519, + Ed25519Blake2b, + Ed25519Blake2bPoint, + Ed25519Blake2bPrivateKey, + Ed25519Blake2bPublicKey, + Ed25519Kholaw, + Ed25519KholawPoint, + Ed25519KholawPrivateKey, + Ed25519KholawPublicKey, + Ed25519Monero, + Ed25519MoneroPoint, + Ed25519MoneroPrivateKey, + Ed25519MoneroPublicKey, + Ed25519Point, + Ed25519PrivateKey, + Ed25519PublicKey, + EllipticCurveGetter, + EllipticCurveTypes, + Nist256p1, + Nist256p1Point, + Nist256p1PrivateKey, + Nist256p1PublicKey, + Secp256k1, + Secp256k1Point, + Secp256k1PrivateKey, + Secp256k1PublicKey, + Sr25519, + Sr25519Point, + Sr25519PrivateKey, + Sr25519PublicKey, ) from bip_utils.ecc.conf import EccConf from bip_utils.utils.misc import IntegerUtils diff --git a/tests/electrum/mnemonic/test_electrum_v1_mnemonic.py b/tests/electrum/mnemonic/test_electrum_v1_mnemonic.py index 5d71add4..ea63363f 100644 --- a/tests/electrum/mnemonic/test_electrum_v1_mnemonic.py +++ b/tests/electrum/mnemonic/test_electrum_v1_mnemonic.py @@ -23,8 +23,15 @@ import unittest from bip_utils import ( - ElectrumV1, ElectrumV1EntropyBitLen, ElectrumV1EntropyGenerator, ElectrumV1Languages, ElectrumV1MnemonicDecoder, - ElectrumV1MnemonicGenerator, ElectrumV1MnemonicValidator, ElectrumV1SeedGenerator, ElectrumV1WordsNum + ElectrumV1, + ElectrumV1EntropyBitLen, + ElectrumV1EntropyGenerator, + ElectrumV1Languages, + ElectrumV1MnemonicDecoder, + ElectrumV1MnemonicGenerator, + ElectrumV1MnemonicValidator, + ElectrumV1SeedGenerator, + ElectrumV1WordsNum, ) diff --git a/tests/electrum/mnemonic/test_electrum_v2_mnemonic.py b/tests/electrum/mnemonic/test_electrum_v2_mnemonic.py index 0f0d9960..7cd422e3 100644 --- a/tests/electrum/mnemonic/test_electrum_v2_mnemonic.py +++ b/tests/electrum/mnemonic/test_electrum_v2_mnemonic.py @@ -24,9 +24,18 @@ import unittest from bip_utils import ( - BytesUtils, ElectrumV2EntropyBitLen, ElectrumV2EntropyGenerator, ElectrumV2Languages, ElectrumV2MnemonicDecoder, - ElectrumV2MnemonicGenerator, ElectrumV2MnemonicTypes, ElectrumV2MnemonicValidator, ElectrumV2SeedGenerator, - ElectrumV2Segwit, ElectrumV2Standard, ElectrumV2WordsNum + BytesUtils, + ElectrumV2EntropyBitLen, + ElectrumV2EntropyGenerator, + ElectrumV2Languages, + ElectrumV2MnemonicDecoder, + ElectrumV2MnemonicGenerator, + ElectrumV2MnemonicTypes, + ElectrumV2MnemonicValidator, + ElectrumV2SeedGenerator, + ElectrumV2Segwit, + ElectrumV2Standard, + ElectrumV2WordsNum, ) from bip_utils.electrum.mnemonic_v2.electrum_v2_mnemonic import ElectrumV2MnemonicConst diff --git a/tests/electrum/test_electrum_v1.py b/tests/electrum/test_electrum_v1.py index 683b845b..09586f22 100644 --- a/tests/electrum/test_electrum_v1.py +++ b/tests/electrum/test_electrum_v1.py @@ -23,7 +23,13 @@ import unittest from bip_utils import ( - CoinsConf, ElectrumV1, Secp256k1PrivateKey, Secp256k1PublicKey, WifDecoder, WifEncoder, WifPubKeyModes + CoinsConf, + ElectrumV1, + Secp256k1PrivateKey, + Secp256k1PublicKey, + WifDecoder, + WifEncoder, + WifPubKeyModes, ) from bip_utils.bip.bip32.bip32_key_data import Bip32KeyDataConst from tests.ecc.test_ecc import TEST_ED25519_PRIV_KEY, TEST_ED25519_PUB_KEY diff --git a/tests/electrum/test_electrum_v2.py b/tests/electrum/test_electrum_v2.py index ee6b6674..3804a9e1 100644 --- a/tests/electrum/test_electrum_v2.py +++ b/tests/electrum/test_electrum_v2.py @@ -23,8 +23,14 @@ import unittest from bip_utils import ( - Bip32PrivateKey, Bip32PublicKey, Bip32Slip10Ed25519, Bip32Slip10Secp256k1, CoinsConf, ElectrumV2Segwit, - ElectrumV2Standard, WifEncoder + Bip32PrivateKey, + Bip32PublicKey, + Bip32Slip10Ed25519, + Bip32Slip10Secp256k1, + CoinsConf, + ElectrumV2Segwit, + ElectrumV2Standard, + WifEncoder, ) from tests.bip.bip32.test_bip32_base import TEST_SEED diff --git a/tests/monero/mnemonic/test_monero_mnemonic.py b/tests/monero/mnemonic/test_monero_mnemonic.py index 1f42b512..6bebd815 100644 --- a/tests/monero/mnemonic/test_monero_mnemonic.py +++ b/tests/monero/mnemonic/test_monero_mnemonic.py @@ -23,8 +23,16 @@ import unittest from bip_utils import ( - MnemonicChecksumError, Monero, MoneroEntropyBitLen, MoneroEntropyGenerator, MoneroLanguages, MoneroMnemonicDecoder, - MoneroMnemonicGenerator, MoneroMnemonicValidator, MoneroSeedGenerator, MoneroWordsNum + MnemonicChecksumError, + Monero, + MoneroEntropyBitLen, + MoneroEntropyGenerator, + MoneroLanguages, + MoneroMnemonicDecoder, + MoneroMnemonicGenerator, + MoneroMnemonicValidator, + MoneroSeedGenerator, + MoneroWordsNum, ) diff --git a/tests/monero/test_monero.py b/tests/monero/test_monero.py index 17f59fdc..c9ee2603 100644 --- a/tests/monero/test_monero.py +++ b/tests/monero/test_monero.py @@ -23,8 +23,13 @@ import unittest from bip_utils import ( - Ed25519MoneroPrivateKey, Ed25519MoneroPublicKey, Monero, MoneroCoins, MoneroKeyError, MoneroPrivateKey, - MoneroPublicKey + Ed25519MoneroPrivateKey, + Ed25519MoneroPublicKey, + Monero, + MoneroCoins, + MoneroKeyError, + MoneroPrivateKey, + MoneroPublicKey, ) from bip_utils.monero.conf import MoneroCoinConf from bip_utils.monero.monero_subaddr import MoneroSubaddressConst diff --git a/tests/monero/test_monero_keys.py b/tests/monero/test_monero_keys.py index 989a4f43..2f879524 100644 --- a/tests/monero/test_monero_keys.py +++ b/tests/monero/test_monero_keys.py @@ -23,14 +23,29 @@ import unittest from bip_utils import ( - DataBytes, Ed25519MoneroPrivateKey, Ed25519MoneroPublicKey, MoneroKeyError, MoneroPrivateKey, MoneroPublicKey + DataBytes, + Ed25519MoneroPrivateKey, + Ed25519MoneroPublicKey, + MoneroKeyError, + MoneroPrivateKey, + MoneroPublicKey, ) from tests.ecc.test_ecc import ( - TEST_ED25519_BLAKE2B_PRIV_KEY, TEST_ED25519_BLAKE2B_PUB_KEY, TEST_ED25519_MONERO_POINT, - TEST_ED25519_MONERO_PRIV_KEY, TEST_ED25519_MONERO_PUB_KEY, TEST_ED25519_PRIV_KEY, TEST_ED25519_PUB_KEY, - TEST_NIST256P1_PRIV_KEY, TEST_NIST256P1_PUB_KEY, TEST_SECP256K1_PRIV_KEY, TEST_SECP256K1_PUB_KEY, - TEST_SR25519_PRIV_KEY, TEST_SR25519_PUB_KEY, TEST_VECT_ED25519_MONERO_PRIV_KEY_INVALID, - TEST_VECT_ED25519_PUB_KEY_INVALID + TEST_ED25519_BLAKE2B_PRIV_KEY, + TEST_ED25519_BLAKE2B_PUB_KEY, + TEST_ED25519_MONERO_POINT, + TEST_ED25519_MONERO_PRIV_KEY, + TEST_ED25519_MONERO_PUB_KEY, + TEST_ED25519_PRIV_KEY, + TEST_ED25519_PUB_KEY, + TEST_NIST256P1_PRIV_KEY, + TEST_NIST256P1_PUB_KEY, + TEST_SECP256K1_PRIV_KEY, + TEST_SECP256K1_PUB_KEY, + TEST_SR25519_PRIV_KEY, + TEST_SR25519_PUB_KEY, + TEST_VECT_ED25519_MONERO_PRIV_KEY_INVALID, + TEST_VECT_ED25519_PUB_KEY_INVALID, ) diff --git a/tests/slip/slip32/test_slip32.py b/tests/slip/slip32/test_slip32.py index 41ec83ec..f4d79ceb 100644 --- a/tests/slip/slip32/test_slip32.py +++ b/tests/slip/slip32/test_slip32.py @@ -22,8 +22,12 @@ import unittest from bip_utils import ( - Bip32PathParser, Bip32Slip10Secp256k1, Bip39SeedGenerator, Slip32KeyDeserializer, Slip32PrivateKeySerializer, - Slip32PublicKeySerializer + Bip32PathParser, + Bip32Slip10Secp256k1, + Bip39SeedGenerator, + Slip32KeyDeserializer, + Slip32PrivateKeySerializer, + Slip32PublicKeySerializer, ) diff --git a/tests/substrate/test_substrate.py b/tests/substrate/test_substrate.py index e2e8e976..32879647 100644 --- a/tests/substrate/test_substrate.py +++ b/tests/substrate/test_substrate.py @@ -23,13 +23,23 @@ import unittest from bip_utils import ( - Sr25519PrivateKey, Sr25519PublicKey, Substrate, SubstrateCoins, SubstrateKeyError, SubstratePath, SubstratePathElem, - SubstratePrivateKey, SubstratePublicKey + Sr25519PrivateKey, + Sr25519PublicKey, + Substrate, + SubstrateCoins, + SubstrateKeyError, + SubstratePath, + SubstratePathElem, + SubstratePrivateKey, + SubstratePublicKey, ) from bip_utils.substrate.conf import SubstrateCoinConf from bip_utils.substrate.substrate import SubstrateConst from tests.ecc.test_ecc import ( - TEST_SR25519_PRIV_KEY, TEST_SR25519_PUB_KEY, TEST_VECT_SR25519_PRIV_KEY_INVALID, TEST_VECT_SR25519_PUB_KEY_INVALID + TEST_SR25519_PRIV_KEY, + TEST_SR25519_PUB_KEY, + TEST_VECT_SR25519_PRIV_KEY_INVALID, + TEST_VECT_SR25519_PUB_KEY_INVALID, ) diff --git a/tests/substrate/test_substrate_keys.py b/tests/substrate/test_substrate_keys.py index a37fbcf3..29a1edbd 100644 --- a/tests/substrate/test_substrate_keys.py +++ b/tests/substrate/test_substrate_keys.py @@ -23,14 +23,29 @@ import unittest from bip_utils import ( - DataBytes, Sr25519PrivateKey, Sr25519PublicKey, SubstrateKeyError, SubstratePrivateKey, SubstratePublicKey + DataBytes, + Sr25519PrivateKey, + Sr25519PublicKey, + SubstrateKeyError, + SubstratePrivateKey, + SubstratePublicKey, ) from bip_utils.substrate.conf.substrate_conf import SubstrateConf from tests.ecc.test_ecc import ( - TEST_ED25519_BLAKE2B_PRIV_KEY, TEST_ED25519_BLAKE2B_PUB_KEY, TEST_ED25519_MONERO_PRIV_KEY, - TEST_ED25519_MONERO_PUB_KEY, TEST_ED25519_PRIV_KEY, TEST_ED25519_PUB_KEY, TEST_NIST256P1_PRIV_KEY, - TEST_NIST256P1_PUB_KEY, TEST_SECP256K1_PRIV_KEY, TEST_SECP256K1_PUB_KEY, TEST_SR25519_PRIV_KEY, - TEST_SR25519_PUB_KEY, TEST_VECT_SR25519_PRIV_KEY_INVALID, TEST_VECT_SR25519_PUB_KEY_INVALID + TEST_ED25519_BLAKE2B_PRIV_KEY, + TEST_ED25519_BLAKE2B_PUB_KEY, + TEST_ED25519_MONERO_PRIV_KEY, + TEST_ED25519_MONERO_PUB_KEY, + TEST_ED25519_PRIV_KEY, + TEST_ED25519_PUB_KEY, + TEST_NIST256P1_PRIV_KEY, + TEST_NIST256P1_PUB_KEY, + TEST_SECP256K1_PRIV_KEY, + TEST_SECP256K1_PUB_KEY, + TEST_SR25519_PRIV_KEY, + TEST_SR25519_PUB_KEY, + TEST_VECT_SR25519_PRIV_KEY_INVALID, + TEST_VECT_SR25519_PUB_KEY_INVALID, ) diff --git a/tests/substrate/test_substrate_path.py b/tests/substrate/test_substrate_path.py index 0ceb4c8f..096f877d 100644 --- a/tests/substrate/test_substrate_path.py +++ b/tests/substrate/test_substrate_path.py @@ -23,7 +23,12 @@ import unittest from bip_utils import ( - Substrate, SubstrateCoins, SubstratePath, SubstratePathElem, SubstratePathError, SubstratePathParser + Substrate, + SubstrateCoins, + SubstratePath, + SubstratePathElem, + SubstratePathError, + SubstratePathParser, ) from tests.substrate.test_substrate import TEST_SEED diff --git a/tests/substrate/test_substrate_scale_enc.py b/tests/substrate/test_substrate_scale_enc.py index b57803e8..d96546a2 100644 --- a/tests/substrate/test_substrate_scale_enc.py +++ b/tests/substrate/test_substrate_scale_enc.py @@ -23,8 +23,14 @@ import unittest from bip_utils import ( - SubstrateScaleBytesEncoder, SubstrateScaleCUintEncoder, SubstrateScaleU8Encoder, SubstrateScaleU16Encoder, - SubstrateScaleU32Encoder, SubstrateScaleU64Encoder, SubstrateScaleU128Encoder, SubstrateScaleU256Encoder + SubstrateScaleBytesEncoder, + SubstrateScaleCUintEncoder, + SubstrateScaleU8Encoder, + SubstrateScaleU16Encoder, + SubstrateScaleU32Encoder, + SubstrateScaleU64Encoder, + SubstrateScaleU128Encoder, + SubstrateScaleU256Encoder, ) diff --git a/tests/wif/test_wif.py b/tests/wif/test_wif.py index f2592b3d..77566d3b 100644 --- a/tests/wif/test_wif.py +++ b/tests/wif/test_wif.py @@ -24,8 +24,11 @@ from bip_utils import Base58ChecksumError, CoinsConf, Secp256k1PrivateKey, WifDecoder, WifEncoder, WifPubKeyModes from tests.ecc.test_ecc import ( - TEST_ED25519_BLAKE2B_PRIV_KEY, TEST_ED25519_PRIV_KEY, TEST_NIST256P1_PRIV_KEY, TEST_SR25519_PRIV_KEY, - TEST_VECT_SECP256K1_PRIV_KEY_INVALID + TEST_ED25519_BLAKE2B_PRIV_KEY, + TEST_ED25519_PRIV_KEY, + TEST_NIST256P1_PRIV_KEY, + TEST_SR25519_PRIV_KEY, + TEST_VECT_SECP256K1_PRIV_KEY_INVALID, ) From 891329b85b3cac8bd96577aafefd9abbb66a24a0 Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Fri, 27 Feb 2026 13:32:30 +0100 Subject: [PATCH 54/66] Minor change --- bip_utils/ton/mnemonic/ton_mnemonic_generator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bip_utils/ton/mnemonic/ton_mnemonic_generator.py b/bip_utils/ton/mnemonic/ton_mnemonic_generator.py index 7d55c01d..964ca02c 100644 --- a/bip_utils/ton/mnemonic/ton_mnemonic_generator.py +++ b/bip_utils/ton/mnemonic/ton_mnemonic_generator.py @@ -81,7 +81,7 @@ def FromWordsNumber(self, ValueError: If words number is not valid or if unable to generate a valid mnemonic """ # Check words number - if words_num not in TonMnemonicConst. MNEMONIC_WORD_NUM: + if words_num not in TonMnemonicConst.MNEMONIC_WORD_NUM: raise ValueError(f"Words number for mnemonic ({words_num}) is not valid") words_list = Bip39WordsListGetter().GetByLanguage(self.m_lang.value) From 24aece037ca3a2634d3dd5160dece9306abed70b Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Fri, 27 Feb 2026 13:32:50 +0100 Subject: [PATCH 55/66] Add --- tests/ton/mnemonic/test_ton_mnemonic.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/ton/mnemonic/test_ton_mnemonic.py b/tests/ton/mnemonic/test_ton_mnemonic.py index 94c71d25..714557cf 100644 --- a/tests/ton/mnemonic/test_ton_mnemonic.py +++ b/tests/ton/mnemonic/test_ton_mnemonic.py @@ -119,6 +119,9 @@ def test_generator(self): self.assertEqual(words_num, mnemonic.WordsCount()) self.assertTrue(TonMnemonicValidator(lang).IsValid(mnemonic, passphrase)) + self.assertRaises(ValueError, TonMnemonicGenerator(lang).FromWordsNumber, words_num - 1) + self.assertRaises(ValueError, TonMnemonicGenerator(lang).FromWordsNumber, words_num + 1) + # Test validation of a mnemonic with/without a passphrase def test_passphrase_validation(self): mnemonic = TonMnemonicGenerator().FromWordsNumber(TonWordsNum.WORDS_NUM_24) From daebd1ba5d5e634da77dae5ffb84c59fad7a5b1b Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Fri, 27 Feb 2026 13:47:04 +0100 Subject: [PATCH 56/66] Reorganize ton folder --- bip_utils/__init__.py | 10 ++++------ bip_utils/addr/ton_addr.py | 2 +- bip_utils/ton/__init__.py | 3 +++ bip_utils/ton/addr/ton_v3r1_addr_encoder.py | 2 +- bip_utils/ton/addr/ton_v3r2_addr_encoder.py | 2 +- bip_utils/ton/addr/ton_v4_addr_encoder.py | 2 +- bip_utils/ton/addr/ton_v5r1_addr_encoder.py | 2 +- bip_utils/ton/keys/__init__.py | 2 -- bip_utils/ton/ton.py | 20 +++++++++++++++---- .../ton/{keys/ton_keys_ex.py => ton_ex.py} | 0 bip_utils/ton/{keys => }/ton_keys.py | 2 +- 11 files changed, 29 insertions(+), 18 deletions(-) delete mode 100644 bip_utils/ton/keys/__init__.py rename bip_utils/ton/{keys/ton_keys_ex.py => ton_ex.py} (100%) rename bip_utils/ton/{keys => }/ton_keys.py (99%) diff --git a/bip_utils/__init__.py b/bip_utils/__init__.py index 8c28c394..0cd0e50d 100644 --- a/bip_utils/__init__.py +++ b/bip_utils/__init__.py @@ -394,11 +394,6 @@ TonV4AddrEncoder, TonV5R1AddrEncoder, ) -from bip_utils.ton.keys import ( - TonKeyError, - TonPrivateKey, - TonPublicKey, -) from bip_utils.ton.mnemonic import ( TonLanguages, TonMnemonic, @@ -408,8 +403,11 @@ TonSeedTypes, TonWordsNum, ) -from bip_utils.ton.ton import ( +from bip_utils.ton import ( Ton, + TonKeyError, + TonPrivateKey, + TonPublicKey, ) # Utils diff --git a/bip_utils/addr/ton_addr.py b/bip_utils/addr/ton_addr.py index 5565737b..b7c82a41 100644 --- a/bip_utils/addr/ton_addr.py +++ b/bip_utils/addr/ton_addr.py @@ -33,7 +33,7 @@ TonV4AddrEncoder, TonV5R1AddrEncoder, ) -from bip_utils.ton.keys import TonPublicKey +from bip_utils.ton.ton_keys import TonPublicKey class TonAddrEncoder(IAddrEncoder): diff --git a/bip_utils/ton/__init__.py b/bip_utils/ton/__init__.py index e69de29b..9a790932 100644 --- a/bip_utils/ton/__init__.py +++ b/bip_utils/ton/__init__.py @@ -0,0 +1,3 @@ +from bip_utils.ton.ton import Ton +from bip_utils.ton.ton_keys import TonPublicKey, TonPrivateKey +from bip_utils.ton.ton_ex import TonKeyError diff --git a/bip_utils/ton/addr/ton_v3r1_addr_encoder.py b/bip_utils/ton/addr/ton_v3r1_addr_encoder.py index 9d57c4d3..822458be 100644 --- a/bip_utils/ton/addr/ton_v3r1_addr_encoder.py +++ b/bip_utils/ton/addr/ton_v3r1_addr_encoder.py @@ -27,7 +27,7 @@ # Imports from pytoniq_core import Address, Cell, begin_cell -from bip_utils.ton.keys import TonPublicKey +from bip_utils.ton.ton_keys import TonPublicKey from bip_utils.utils.misc import Base64Decoder diff --git a/bip_utils/ton/addr/ton_v3r2_addr_encoder.py b/bip_utils/ton/addr/ton_v3r2_addr_encoder.py index 940d526e..78906438 100644 --- a/bip_utils/ton/addr/ton_v3r2_addr_encoder.py +++ b/bip_utils/ton/addr/ton_v3r2_addr_encoder.py @@ -27,7 +27,7 @@ # Imports from pytoniq_core import Address, Cell, begin_cell -from bip_utils.ton.keys import TonPublicKey +from bip_utils.ton.ton_keys import TonPublicKey from bip_utils.utils.misc import Base64Decoder diff --git a/bip_utils/ton/addr/ton_v4_addr_encoder.py b/bip_utils/ton/addr/ton_v4_addr_encoder.py index 68d912fc..24a8124c 100644 --- a/bip_utils/ton/addr/ton_v4_addr_encoder.py +++ b/bip_utils/ton/addr/ton_v4_addr_encoder.py @@ -27,7 +27,7 @@ # Imports from pytoniq_core import Address, Cell, begin_cell -from bip_utils.ton.keys import TonPublicKey +from bip_utils.ton.ton_keys import TonPublicKey from bip_utils.utils.misc import Base64Decoder diff --git a/bip_utils/ton/addr/ton_v5r1_addr_encoder.py b/bip_utils/ton/addr/ton_v5r1_addr_encoder.py index c5b052f5..823026fd 100644 --- a/bip_utils/ton/addr/ton_v5r1_addr_encoder.py +++ b/bip_utils/ton/addr/ton_v5r1_addr_encoder.py @@ -27,7 +27,7 @@ # Imports from pytoniq_core import Address, Cell, begin_cell -from bip_utils.ton.keys import TonPublicKey +from bip_utils.ton.ton_keys import TonPublicKey class TonV5R1AddrEncoderConst: diff --git a/bip_utils/ton/keys/__init__.py b/bip_utils/ton/keys/__init__.py deleted file mode 100644 index 9854cac6..00000000 --- a/bip_utils/ton/keys/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -from bip_utils.ton.keys.ton_keys import TonPrivateKey, TonPublicKey -from bip_utils.ton.keys.ton_keys_ex import TonKeyError diff --git a/bip_utils/ton/ton.py b/bip_utils/ton/ton.py index a2eda906..b2de8f4a 100644 --- a/bip_utils/ton/ton.py +++ b/bip_utils/ton/ton.py @@ -25,10 +25,15 @@ from typing import Union -from bip_utils.addr.ton_addr import TonAddrEncoder from bip_utils.ecc.common.ikeys import IPrivateKey -from bip_utils.ton.addr import TonAddrVersions -from bip_utils.ton.keys import TonPrivateKey, TonPublicKey +from bip_utils.ton.addr import ( + TonAddrVersions, + TonV3R1AddrEncoder, + TonV3R2AddrEncoder, + TonV4AddrEncoder, + TonV5R1AddrEncoder, +) +from bip_utils.ton.ton_keys import TonPrivateKey, TonPublicKey class Ton: @@ -103,4 +108,11 @@ def GetAddress(self, Returns: str: Address string """ - return TonAddrEncoder.EncodeKey(self.m_pub_key.KeyObject(), version=version, is_bounceable=is_bounceable) + if version == TonAddrVersions.V5R1: + return TonV5R1AddrEncoder(self.m_pub_key).Encode(is_bounceable) + elif version == TonAddrVersions.V4: + return TonV4AddrEncoder(self.m_pub_key).Encode(is_bounceable) + elif version == TonAddrVersions.V3R2: + return TonV3R2AddrEncoder(self.m_pub_key).Encode(is_bounceable) + else: + return TonV3R1AddrEncoder(self.m_pub_key).Encode(is_bounceable) diff --git a/bip_utils/ton/keys/ton_keys_ex.py b/bip_utils/ton/ton_ex.py similarity index 100% rename from bip_utils/ton/keys/ton_keys_ex.py rename to bip_utils/ton/ton_ex.py diff --git a/bip_utils/ton/keys/ton_keys.py b/bip_utils/ton/ton_keys.py similarity index 99% rename from bip_utils/ton/keys/ton_keys.py rename to bip_utils/ton/ton_keys.py index 34ac2df8..c63d77a6 100644 --- a/bip_utils/ton/keys/ton_keys.py +++ b/bip_utils/ton/ton_keys.py @@ -28,7 +28,7 @@ from bip_utils.ecc import IPrivateKey, IPublicKey from bip_utils.ecc.ed25519.ed25519_keys import Ed25519PrivateKey, Ed25519PublicKey -from bip_utils.ton.keys.ton_keys_ex import TonKeyError +from bip_utils.ton.ton_ex import TonKeyError from bip_utils.utils.misc import DataBytes From ef301ed634572bec352bc3f09132b1b024865787 Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Fri, 27 Feb 2026 13:51:02 +0100 Subject: [PATCH 57/66] Update docs --- docs/bip_utils/ton/index.rst | 2 +- docs/bip_utils/ton/keys/index.rst | 6 ------ docs/bip_utils/ton/{keys => }/ton_keys.rst | 2 +- 3 files changed, 2 insertions(+), 8 deletions(-) delete mode 100644 docs/bip_utils/ton/keys/index.rst rename docs/bip_utils/ton/{keys => }/ton_keys.rst (62%) diff --git a/docs/bip_utils/ton/index.rst b/docs/bip_utils/ton/index.rst index 85875f68..15ee7085 100644 --- a/docs/bip_utils/ton/index.rst +++ b/docs/bip_utils/ton/index.rst @@ -4,7 +4,7 @@ ton :maxdepth: 10 addr/index.rst - keys/index.rst mnemonic/index.rst ton ton_ex + ton_keys diff --git a/docs/bip_utils/ton/keys/index.rst b/docs/bip_utils/ton/keys/index.rst deleted file mode 100644 index 67041a25..00000000 --- a/docs/bip_utils/ton/keys/index.rst +++ /dev/null @@ -1,6 +0,0 @@ -keys -==== -.. toctree:: - :maxdepth: 10 - - ton_keys diff --git a/docs/bip_utils/ton/keys/ton_keys.rst b/docs/bip_utils/ton/ton_keys.rst similarity index 62% rename from docs/bip_utils/ton/keys/ton_keys.rst rename to docs/bip_utils/ton/ton_keys.rst index a9e21d71..5a524a24 100644 --- a/docs/bip_utils/ton/keys/ton_keys.rst +++ b/docs/bip_utils/ton/ton_keys.rst @@ -1,7 +1,7 @@ ton_keys ======== -.. automodule:: bip_utils.ton.keys.ton_keys +.. automodule:: bip_utils.ton.ton_keys :members: :undoc-members: :show-inheritance: From 68c04ad426bdea194a2191bfeb1ee2aba426dfdf Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Fri, 27 Feb 2026 15:55:08 +0100 Subject: [PATCH 58/66] Update ton.py --- bip_utils/ton/ton.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/bip_utils/ton/ton.py b/bip_utils/ton/ton.py index b2de8f4a..b7fad70a 100644 --- a/bip_utils/ton/ton.py +++ b/bip_utils/ton/ton.py @@ -18,7 +18,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -"""Module containing utility classes for Ton keys derivation.""" +"""Module containing utility classes for Ton keys derivation (ton-crypto style).""" # Imports from __future__ import annotations @@ -39,8 +39,7 @@ class Ton: """ TON class. - It allows to generate keys and addresses for TON wallets such as Tonkeeper. - It also allows to generate addresses based on bip44 such as Trustwallet or Ledger. + It allows to generate keys and addresses for TON wallets like ton-crypto. """ m_priv_key: TonPrivateKey From e4c6652000592f5081fd02a5a55a77e5a764de90 Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Fri, 27 Feb 2026 15:55:22 +0100 Subject: [PATCH 59/66] Complete ton tests --- tests/addr/test_ton_addr.py | 5 ++ tests/ton/mnemonic/test_ton_mnemonic.py | 3 + tests/ton/test_ton.py | 94 +++++++++++++++++++ tests/ton/test_ton_keys.py | 115 ++++++++++++++++++++++++ 4 files changed, 217 insertions(+) create mode 100644 tests/ton/test_ton.py create mode 100644 tests/ton/test_ton_keys.py diff --git a/tests/addr/test_ton_addr.py b/tests/addr/test_ton_addr.py index 8b49c6d0..137e0686 100644 --- a/tests/addr/test_ton_addr.py +++ b/tests/addr/test_ton_addr.py @@ -55,6 +55,11 @@ }, "address": "UQD3dn7-3QdJT_36TEL16JYWDz0tWqkNbuEKyOEjy0-1NbfG", }, + { + "pub_key": b"1af97d53283a3c57f47db2b97263e86c93acc38853ca2246db5daa32cb7a1037", + "address_params": {}, # Default: V4 + "address": "UQD3dn7-3QdJT_36TEL16JYWDz0tWqkNbuEKyOEjy0-1NbfG", + }, { "pub_key": b"ad724aba20a7591624efee55eae11ec1f765d483544a9bf42ff7467d0f88a113", "address_params": { diff --git a/tests/ton/mnemonic/test_ton_mnemonic.py b/tests/ton/mnemonic/test_ton_mnemonic.py index 714557cf..9b1977b8 100644 --- a/tests/ton/mnemonic/test_ton_mnemonic.py +++ b/tests/ton/mnemonic/test_ton_mnemonic.py @@ -108,6 +108,9 @@ def test_vector(self): seed_priv = TonSeedGenerator(mnemonic, passphrase, lang).Generate(TonSeedTypes.PRIVATE_KEY) self.assertEqual(test["seed_priv"], binascii.hexlify(seed_priv)) + seed_priv = TonSeedGenerator(mnemonic, passphrase, lang).Generate() + self.assertEqual(test["seed_priv"], binascii.hexlify(seed_priv)) + # Test mnemonic generator def test_generator(self): for lang in TonLanguages: diff --git a/tests/ton/test_ton.py b/tests/ton/test_ton.py new file mode 100644 index 00000000..7fe2db34 --- /dev/null +++ b/tests/ton/test_ton.py @@ -0,0 +1,94 @@ +# Copyright (c) 2026 Emanuele Bellocchia +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +# Imports +import binascii +import unittest + +from bip_utils import ( + Ton, + TonAddrVersions, + TonMnemonicGenerator, + TonSeedGenerator, + TonPrivateKey, + TonPublicKey, +) + + +TEST_VECT = [ + { + "mnemonic": "flash garden eagle south occur hair believe pigeon shell later awake evoke club bundle humble just alarm start shoe depth curve sadness coast cruel", + "passphrase": "", + "seed": b"6dca2b6bae5495c9b32ad0e21585893393f49593b46528cf4364e2ce3de9fbc4d5d260f6e64db115a3116e3bcde1eda36272ade47d5f458a1224f8a6b82c725d", + "priv_key": "6dca2b6bae5495c9b32ad0e21585893393f49593b46528cf4364e2ce3de9fbc4", + "pub_key": "00b20e72a472a091f2d6e5c8daae89acffc1725796ecfdecb91028473227cccd40", + "address_v3r1": "UQBO7J5N3SRX5C36PjcLszc6mjtldjDO8399z2M_WFReD_Y6", + "address_v3r2": "UQC4isU1Xv7IG26fVJW_EuJvfyPMdjio6U5AOX_1ItZMdvvY", + "address_v4": "UQAL2-1_ypx8LjJq4kYrQCIHi4BiFoLzEtnoU6pnBxT0dlIW", + "address_v5r1": "UQBnsrgS6CQgUrSPbSsH8E2NqeJu_jcHHc7UMBgCYYy42mCT", + "address_def": "UQBnsrgS6CQgUrSPbSsH8E2NqeJu_jcHHc7UMBgCYYy42mCT", + }, + { + "mnemonic": "trip rude dry sand ahead pole spice knife lobster spider rather canyon caution catalog design process awesome garage coil climb daughter assault grab latin", + "passphrase": "", + "seed": b"bdeeedc743b2e0c7235b45b2247de18c7982f6f484c551ff21034cc761668e8513e53b519f187d5939d319525be16250890caa7ecc4781b8884c9eb444d2bcb6", + "priv_key": "bdeeedc743b2e0c7235b45b2247de18c7982f6f484c551ff21034cc761668e85", + "pub_key": "007b3a7c45f3889e7fcffa79f9508b1f0d4eb3e8e127f5e954e5b7b8c8bf3df2ac", + "address_v3r1": "UQCcn8mY71L7KdN0zZ34iQZBFmf8CEfS3sKMSXUHOhJt8hTC", + "address_v3r2": "UQAN8uYVEct8z7bR7jaqONOvFX4hiNAqCOMEBClc0W-h3q6f", + "address_v4": "UQDwRUWRenS3SdqOQlgzjXfh8pLmi6BHcycSRnjK356uEtmh", + "address_v5r1": "UQDBXf5dtEWokmn7H9i8DGF1hlFW9C0FTPn1-Lu6TU3dCcU9", + "address_def": "UQDBXf5dtEWokmn7H9i8DGF1hlFW9C0FTPn1-Lu6TU3dCcU9", + }, + { + "mnemonic": "one throw battle section gauge admit aware alarm shine van wreck record battle cancel advice kitten quote panther vault page degree march whisper truly", + "passphrase": "test", + "seed": b"00915030dbc91ca64e4384d6d1b743b50332d9741f60a844230d20dff5232708a714247a1ddc7b031ce0c414da40b156eefb968dc86b7b65c950a91f237d2ca9", + "priv_key": "00915030dbc91ca64e4384d6d1b743b50332d9741f60a844230d20dff5232708", + "pub_key": "0001da83e896f14a9ba71ba11b42199a2e814b64ef0f831c6b67d8ca31235da69c", + "address_v3r1": "UQBkw9A2EJ3mQyZMgSlNjti0iGaNf3iDzXt6sgvHE6sBtZXP", + "address_v3r2": "UQDANpdHk9f8kyosO62qczm3hYCWlPAE-w73lmEaoeLg2nnS", + "address_v4": "UQD4YDreaPB9VdhnicmMet4Xta6CAVK_pF1M_4_MHk4okPUR", + "address_v5r1": "UQBKpLgvvceEXGIH6IkzilTp5c0RPXYZWqq9G7ONVqc-lWPV", + "address_def": "UQBKpLgvvceEXGIH6IkzilTp5c0RPXYZWqq9G7ONVqc-lWPV", + }, +] + + +# +# Tests +# +class TonTests(unittest.TestCase): + # Run all tests in test vector + def test_vector(self): + for test in TEST_VECT: + # Generate seed + seed = TonSeedGenerator(test["mnemonic"], test["passphrase"]).Generate() + self.assertEqual(test["seed"], binascii.hexlify(seed)) + + # Test Ton class + ton = Ton.FromSeed(seed) + self.assertEqual(test["priv_key"], ton.PrivateKey().Raw().ToHex()) + self.assertEqual(test["pub_key"], ton.PublicKey().RawCompressed().ToHex()) + self.assertEqual(test["address_v3r1"], ton.GetAddress(TonAddrVersions.V3R1)) + self.assertEqual(test["address_v3r2"], ton.GetAddress(TonAddrVersions.V3R2)) + self.assertEqual(test["address_v4"], ton.GetAddress(TonAddrVersions.V4)) + self.assertEqual(test["address_v5r1"], ton.GetAddress(TonAddrVersions.V5R1)) + self.assertEqual(test["address_def"], ton.GetAddress()) diff --git a/tests/ton/test_ton_keys.py b/tests/ton/test_ton_keys.py new file mode 100644 index 00000000..cf2eb9c9 --- /dev/null +++ b/tests/ton/test_ton_keys.py @@ -0,0 +1,115 @@ +# Copyright (c) 2026 Emanuele Bellocchia +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +# Imports +import binascii +import unittest + +from bip_utils import ( + DataBytes, + Ed25519PrivateKey, + Ed25519PublicKey, + TonKeyError, + TonPrivateKey, + TonPublicKey, +) +from tests.ecc.test_ecc import ( + TEST_ED25519_BLAKE2B_PRIV_KEY, + TEST_ED25519_BLAKE2B_PUB_KEY, + TEST_ED25519_PRIV_KEY, + TEST_ED25519_PUB_KEY, + TEST_NIST256P1_PRIV_KEY, + TEST_NIST256P1_PUB_KEY, + TEST_SECP256K1_PRIV_KEY, + TEST_SECP256K1_PUB_KEY, + TEST_SR25519_PRIV_KEY, + TEST_SR25519_PUB_KEY, + TEST_VECT_ED25519_PRIV_KEY_INVALID, + TEST_VECT_ED25519_PUB_KEY_INVALID, +) + + +# +# Tests +# +class TonKeysTests(unittest.TestCase): + # Test private key + def test_priv_key(self): + # FromBytesOrKeyObject (object) + self.__test_priv_key_obj(TonPrivateKey.FromBytesOrKeyObject(TEST_ED25519_PRIV_KEY)) + # FromBytesOrKeyObject (bytes) + self.__test_priv_key_obj(TonPrivateKey.FromBytesOrKeyObject(TEST_ED25519_PRIV_KEY.Raw().ToBytes())) + # FromBytes + self.__test_priv_key_obj(TonPrivateKey.FromBytes(TEST_ED25519_PRIV_KEY.Raw().ToBytes())) + + # Test public key + def test_pub_key(self): + # FromBytesOrKeyObject (object) + self.__test_pub_key_obj(TonPublicKey.FromBytesOrKeyObject(TEST_ED25519_PUB_KEY)) + # FromBytesOrKeyObject (compressed) + self.__test_pub_key_obj(TonPublicKey.FromBytesOrKeyObject(TEST_ED25519_PUB_KEY.RawCompressed().ToBytes())) + # FromBytesOrKeyObject (uncompressed) + self.__test_pub_key_obj(TonPublicKey.FromBytesOrKeyObject(TEST_ED25519_PUB_KEY.RawUncompressed().ToBytes())) + # FromBytes (compressed) + self.__test_pub_key_obj(TonPublicKey.FromBytes(TEST_ED25519_PUB_KEY.RawCompressed().ToBytes())) + # FromBytes (uncompressed) + self.__test_pub_key_obj(TonPublicKey.FromBytes(TEST_ED25519_PUB_KEY.RawUncompressed().ToBytes())) + + # Test invalid keys + def test_invalid_keys(self): + # Invalid private keys + for test in TEST_VECT_ED25519_PRIV_KEY_INVALID: + self.assertRaises(TonKeyError, TonPrivateKey.FromBytesOrKeyObject, binascii.unhexlify(test)) + self.assertRaises(TonKeyError, TonPrivateKey.FromBytes, binascii.unhexlify(test)) + # Invalid public keys + for test in TEST_VECT_ED25519_PUB_KEY_INVALID: + self.assertRaises(TonKeyError, TonPublicKey.FromBytesOrKeyObject, binascii.unhexlify(test)) + self.assertRaises(TonKeyError, TonPublicKey.FromBytes, binascii.unhexlify(test)) + + # Test invalid parameters + def test_invalid_params(self): + # Private key + for key in (TEST_ED25519_BLAKE2B_PRIV_KEY, TEST_NIST256P1_PRIV_KEY, + TEST_SECP256K1_PRIV_KEY, TEST_SR25519_PRIV_KEY): + self.assertRaises(TypeError, TonPrivateKey, key) + # Public key + for key in (TEST_ED25519_BLAKE2B_PUB_KEY, TEST_NIST256P1_PUB_KEY, + TEST_SECP256K1_PUB_KEY, TEST_SR25519_PUB_KEY): + self.assertRaises(TypeError, TonPublicKey, key) + + # Test private key object + def __test_priv_key_obj(self, priv_key): + # Object + self.assertTrue(isinstance(priv_key.KeyObject(), Ed25519PrivateKey)) + self.assertTrue(isinstance(priv_key.Raw(), DataBytes)) + # Keys + self.assertEqual(TEST_ED25519_PRIV_KEY.Raw().ToBytes(), priv_key.Raw().ToBytes()) + # Public key associated to the private one + self.__test_pub_key_obj(priv_key.PublicKey()) + + # Test public key object + def __test_pub_key_obj(self, pub_key): + # Object + self.assertTrue(isinstance(pub_key.KeyObject(), Ed25519PublicKey)) + self.assertTrue(isinstance(pub_key.RawCompressed(), DataBytes)) + self.assertTrue(isinstance(pub_key.RawUncompressed(), DataBytes)) + # Keys + self.assertEqual(TEST_ED25519_PUB_KEY.RawCompressed().ToBytes(), pub_key.RawCompressed().ToBytes()) + self.assertEqual(TEST_ED25519_PUB_KEY.RawUncompressed().ToBytes(), pub_key.RawUncompressed().ToBytes()) From 5f30d61b2a8f005e3d301474251208e658b6b805 Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Fri, 27 Feb 2026 16:27:00 +0100 Subject: [PATCH 60/66] Fix docstring --- bip_utils/utils/mnemonic/mnemonic_validator.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bip_utils/utils/mnemonic/mnemonic_validator.py b/bip_utils/utils/mnemonic/mnemonic_validator.py index a6ae08d6..8d7ef132 100644 --- a/bip_utils/utils/mnemonic/mnemonic_validator.py +++ b/bip_utils/utils/mnemonic/mnemonic_validator.py @@ -46,7 +46,7 @@ def __init__(self, def Validate(self, mnemonic: Union[str, Mnemonic]) -> None: """ - Validate the mnemonic specified at construction. + Validate the specified mnemonic. Args: mnemonic (str or Mnemonic object): Mnemonic @@ -62,7 +62,7 @@ def Validate(self, def IsValid(self, mnemonic: Union[str, Mnemonic]) -> bool: """ - Get if the mnemonic specified at construction is valid. + Get if the specified mnemonic is valid. Args: mnemonic (str or Mnemonic object): Mnemonic From b1339abc9640c5e2084d88c552fe399d9e25f31f Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Fri, 27 Feb 2026 16:27:13 +0100 Subject: [PATCH 61/66] Add Validate method --- .../ton/mnemonic/ton_mnemonic_validator.py | 18 +++++++++++++++++- tests/ton/mnemonic/test_ton_mnemonic.py | 3 +++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/bip_utils/ton/mnemonic/ton_mnemonic_validator.py b/bip_utils/ton/mnemonic/ton_mnemonic_validator.py index cfff24d7..2c2d5ee6 100644 --- a/bip_utils/ton/mnemonic/ton_mnemonic_validator.py +++ b/bip_utils/ton/mnemonic/ton_mnemonic_validator.py @@ -60,7 +60,7 @@ def IsValid(self, mnemonic: Union[str, Mnemonic], passphrase: str = "") -> bool: """ - Get if the specified mnemonic is valid. + Get if the specified mnemonic is valid. Args: mnemonic (str or Mnemonic object): Mnemonic @@ -83,3 +83,19 @@ def IsValid(self, if passphrase != "": return TonSeedUtils.IsPasswordNeeded(mnemonic_obj.ToStr()) return TonSeedUtils.IsBasicSeed(TonSeedUtils.GetEntropyBytes(mnemonic_obj.ToStr(), passphrase)) + + def Validate(self, + mnemonic: Union[str, Mnemonic], + passphrase: str = "") -> None: + """ + Validate the specified mnemonic. + + Args: + mnemonic (str or Mnemonic object): Mnemonic + passphrase (str, optional) : Passphrase (empty by default) + + Raises: + ValueError: If the mnemonic is not valid + """ + if not self.IsValid(mnemonic, passphrase): + raise ValueError("Invalid mnemonic") diff --git a/tests/ton/mnemonic/test_ton_mnemonic.py b/tests/ton/mnemonic/test_ton_mnemonic.py index 9b1977b8..5d4d3a36 100644 --- a/tests/ton/mnemonic/test_ton_mnemonic.py +++ b/tests/ton/mnemonic/test_ton_mnemonic.py @@ -97,9 +97,11 @@ def test_vector(self): # Test mnemonic validator (language specified) mnemonic_validator = TonMnemonicValidator(lang) self.assertTrue(mnemonic_validator.IsValid(mnemonic, passphrase)) + mnemonic_validator.Validate(mnemonic, passphrase) # Test mnemonic validator (automatic language detection) mnemonic_validator = TonMnemonicValidator() self.assertTrue(mnemonic_validator.IsValid(mnemonic, passphrase)) + mnemonic_validator.Validate(mnemonic, passphrase) # Test seed generator seed_hd = TonSeedGenerator(mnemonic, passphrase, lang).Generate(TonSeedTypes.HD_KEY) @@ -141,6 +143,7 @@ def test_invalid_mnemonic(self): lang = test["lang"] if "lang" in test else TonLanguages.ENGLISH self.assertFalse(TonMnemonicValidator(lang).IsValid(test["mnemonic"])) + self.assertRaises(test["exception"], TonMnemonicValidator(lang).Validate, test["mnemonic"]) self.assertRaises(test["exception"], TonSeedGenerator, test["mnemonic"], "", lang) # Tests invalid parameters From de83c346e19b123b0d62a483ebf91b8a045072d5 Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Fri, 27 Feb 2026 16:27:29 +0100 Subject: [PATCH 62/66] Add positive test for Validate method --- tests/algorand/mnemonic/test_algorand_mnemonic.py | 2 ++ tests/bip/bip39/test_bip39.py | 2 ++ tests/electrum/mnemonic/test_electrum_v1_mnemonic.py | 2 ++ tests/electrum/mnemonic/test_electrum_v2_mnemonic.py | 3 +++ tests/monero/mnemonic/test_monero_mnemonic.py | 2 ++ 5 files changed, 11 insertions(+) diff --git a/tests/algorand/mnemonic/test_algorand_mnemonic.py b/tests/algorand/mnemonic/test_algorand_mnemonic.py index 7418e519..b54797d7 100644 --- a/tests/algorand/mnemonic/test_algorand_mnemonic.py +++ b/tests/algorand/mnemonic/test_algorand_mnemonic.py @@ -149,9 +149,11 @@ def test_vector(self): # Test mnemonic validator (language specified) mnemonic_validator = AlgorandMnemonicValidator(lang) self.assertTrue(mnemonic_validator.IsValid(mnemonic)) + mnemonic_validator.Validate(mnemonic) # Test mnemonic validator (automatic language detection) mnemonic_validator = AlgorandMnemonicValidator() self.assertTrue(mnemonic_validator.IsValid(mnemonic)) + mnemonic_validator.Validate(mnemonic) # Test decoder (language specified) entropy = AlgorandMnemonicDecoder(lang).Decode(mnemonic) diff --git a/tests/bip/bip39/test_bip39.py b/tests/bip/bip39/test_bip39.py index 13841b09..78f8f036 100644 --- a/tests/bip/bip39/test_bip39.py +++ b/tests/bip/bip39/test_bip39.py @@ -365,9 +365,11 @@ def test_vector(self): # Test mnemonic validator (language specified) mnemonic_validator = Bip39MnemonicValidator(lang) self.assertTrue(mnemonic_validator.IsValid(mnemonic)) + mnemonic_validator.Validate(mnemonic) # Test mnemonic validator (automatic language detection) mnemonic_validator = Bip39MnemonicValidator() self.assertTrue(mnemonic_validator.IsValid(mnemonic)) + mnemonic_validator.Validate(mnemonic) # Test decoder (language specified) entropy = Bip39MnemonicDecoder(lang).Decode(mnemonic) diff --git a/tests/electrum/mnemonic/test_electrum_v1_mnemonic.py b/tests/electrum/mnemonic/test_electrum_v1_mnemonic.py index ea63363f..cb9fd5d3 100644 --- a/tests/electrum/mnemonic/test_electrum_v1_mnemonic.py +++ b/tests/electrum/mnemonic/test_electrum_v1_mnemonic.py @@ -155,9 +155,11 @@ def test_vector(self): # Test mnemonic validator (language specified) mnemonic_validator = ElectrumV1MnemonicValidator(lang) self.assertTrue(mnemonic_validator.IsValid(mnemonic)) + mnemonic_validator.Validate(mnemonic) # Test mnemonic validator (automatic language detection) mnemonic_validator = ElectrumV1MnemonicValidator() self.assertTrue(mnemonic_validator.IsValid(mnemonic)) + mnemonic_validator.Validate(mnemonic) # Test decoder (language specified) entropy = ElectrumV1MnemonicDecoder(lang).Decode(mnemonic) diff --git a/tests/electrum/mnemonic/test_electrum_v2_mnemonic.py b/tests/electrum/mnemonic/test_electrum_v2_mnemonic.py index 7cd422e3..9a30c489 100644 --- a/tests/electrum/mnemonic/test_electrum_v2_mnemonic.py +++ b/tests/electrum/mnemonic/test_electrum_v2_mnemonic.py @@ -179,12 +179,15 @@ def test_vector(self): # Test mnemonic validator (language specified, all mnemonic types) mnemonic_validator = ElectrumV2MnemonicValidator(lang=lang) self.assertTrue(mnemonic_validator.IsValid(mnemonic)) + mnemonic_validator.Validate(mnemonic) # Test mnemonic validator (automatic language detection, all mnemonic types) mnemonic_validator = ElectrumV2MnemonicValidator() self.assertTrue(mnemonic_validator.IsValid(mnemonic)) + mnemonic_validator.Validate(mnemonic) # Test mnemonic validator (mnemonic type specified) mnemonic_validator = ElectrumV2MnemonicValidator(mnemonic_type=test["mnemonic_type"]) self.assertTrue(mnemonic_validator.IsValid(mnemonic)) + mnemonic_validator.Validate(mnemonic) # Test decoder (language specified, all mnemonic types) entropy = ElectrumV2MnemonicDecoder(lang=lang).Decode(mnemonic) diff --git a/tests/monero/mnemonic/test_monero_mnemonic.py b/tests/monero/mnemonic/test_monero_mnemonic.py index 6bebd815..14ab0232 100644 --- a/tests/monero/mnemonic/test_monero_mnemonic.py +++ b/tests/monero/mnemonic/test_monero_mnemonic.py @@ -288,9 +288,11 @@ def test_vector(self): # Test mnemonic validator (language specified) mnemonic_validator = MoneroMnemonicValidator(lang) self.assertTrue(mnemonic_validator.IsValid(mnemonic)) + mnemonic_validator.Validate(mnemonic) # Test mnemonic validator (automatic language detection) mnemonic_validator = MoneroMnemonicValidator() self.assertTrue(mnemonic_validator.IsValid(mnemonic)) + mnemonic_validator.Validate(mnemonic) # Test decoder with no checksum (language specified) entropy = MoneroMnemonicDecoder(lang).Decode(mnemonic) From f1b240b91d1b0d8d7fe60cf3cf70ec6fa0fee72a Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Fri, 27 Feb 2026 16:40:17 +0100 Subject: [PATCH 63/66] Add TON docs --- README.md | 1 + readme/ton.md | 105 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 106 insertions(+) create mode 100644 readme/ton.md diff --git a/README.md b/README.md index 88f8578c..ea9eab07 100644 --- a/README.md +++ b/README.md @@ -200,6 +200,7 @@ To run code analysis: - [Electrum](https://github.com/ebellocchia/bip_utils/tree/master/readme/electrum.md) - [Monero](https://github.com/ebellocchia/bip_utils/tree/master/readme/monero.md) - [Substrate](https://github.com/ebellocchia/bip_utils/tree/master/readme/substrate.md) +- [Ton](https://github.com/ebellocchia/bip_utils/tree/master/readme/ton.md) - [Utility libraries](https://github.com/ebellocchia/bip_utils/tree/master/readme/utility_libs.md) ## Documentation diff --git a/readme/ton.md b/readme/ton.md new file mode 100644 index 00000000..39e14e55 --- /dev/null +++ b/readme/ton.md @@ -0,0 +1,105 @@ +## TON library + +The TON library allows to generate and validate mnemonics, generate seeds and keys with the same algorithm of `ton-crypto`. + +### TON Mnemonics + +The usage of TON mnemonics is much simpler than other mnemonic modules, since there is no decoder/encoder but only generation and validation. + +Supported words number: + +|Words number|Enum| +|---|---| +|25|`TonWordsNum.WORDS_NUM_24`| + +Supported languages: + +|Language|Enum| +|---|---| +|English|`TonLanguages.ENGLISH`| + +**Code example (mnemonic generation)** + + from bip_utils import TonLanguages, TonWordsNum, TonMnemonicGenerator + + # Generate a random mnemonic string of 24 words with default language (English) + # A Mnemonic object will be returned + mnemonic = TonMnemonicGenerator().FromWordsNumber(TonWordsNum.WORDS_NUM_24) + + # Get words count + print(mnemonic.WordsCount()) + # Get as string + print(mnemonic.ToStr()) + print(str(mnemonic)) + # Get as list of strings + print(mnemonic.ToList()) + + # Generate a random mnemonic string of 24 words by specifying the language + mnemonic = TonMnemonicGenerator(TonLanguages.ENGLISH).FromWordsNumber(TonWordsNum.WORDS_NUM_24) + +**Code example (mnemonic validation)** + + from bip_utils import ( + TonLanguages, TonWordsNum, TonMnemonic, TonMnemonicGenerator, TonMnemonicValidator, + ) + + # Mnemonic can be generated with TonMnemonicGenerator + mnemonic = TonMnemonicGenerator().FromWordsNumber(TonWordsNum.WORDS_NUM_24) + # Or it can be a string + mnemonic = "dove option fame breeze orchard ecology pizza flight miracle film lemon dwarf axis tone soldier nut flavor wheat dish express path private sea ladder" + # Or from a list + mnemonic = TonMnemonic.FromList(mnemonic.split()) + + # Get if a mnemonic is valid with automatic language detection, return bool + is_valid = TonMnemonicValidator().IsValid(mnemonic) + # Same but specifying the language + is_valid = TonMnemonicValidator(TonLanguages.ENGLISH).IsValid(mnemonic) + # Validate a mnemonic, raise exceptions + try: + TonMnemonicValidator().Validate(mnemonic) + # Valid... + except ValueError: + # Invalid length or language... + pass + +**Code example (mnemonic seed generation)** + + from bip_utils import TonLanguages, TonWordsNum, TonMnemonicGenerator, TonSeedGenerator, TonSeedTypes + + # Mnemonic can be generated with TonMnemonicGenerator + mnemonic = TonMnemonicGenerator().FromWordsNumber(TonWordsNum.WORDS_NUM_24) + # Or it can be a string + mnemonic = "dove option fame breeze orchard ecology pizza flight miracle film lemon dwarf axis tone soldier nut flavor wheat dish express path private sea ladder" + + # Generate seed for private key (automatic language detection) + seed_bytes = TonSeedGenerator(mnemonic).Generate() + seed_bytes = TonSeedGenerator(mnemonic).Generate(TonSeedTypes.PRIVATE_KEY) + # Generate seed for HD keys (automatic language detection) + seed_bytes = TonSeedGenerator(mnemonic).Generate(TonSeedTypes.HD_KEY) + # Generate specifying the language + seed_bytes = TonSeedGenerator(mnemonic, lang=TonLanguages.ENGLISH).Generate() + +### TON Keys Derivation + +For deriving keys and getting addresses, a `Ton` class shall be created. + +**Code example** + + from bip_utils import Ton, TonAddrVersions, TonMnemonicGenerator, TonSeedGenerator, TonWordsNum + + # Generate mnemonic and seed for private key + mnemonic = TonMnemonicGenerator().FromWordsNumber(TonWordsNum.WORDS_NUM_24) + seed_bytes = TonSeedGenerator(mnemonic).Generate() + + # Create TON class + ton = Ton.FromSeed(seed_bytes) + # Get keys + print(ton.PublicKey().RawCompressed().ToHex()) + print(ton.PrivateKey().Raw().ToHex()) + # Get address (default: V5R1) + print(ton.GetAddress()) + # Get address specifying version + print(ton.GetAddress(version=TonAddrVersions.V3R1)) + print(ton.GetAddress(version=TonAddrVersions.V3R2)) + print(ton.GetAddress(version=TonAddrVersions.V4)) + print(ton.GetAddress(version=TonAddrVersions.V5R1)) From 35dec01b066de7e1fede08a5afb2853d10523faa Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Fri, 27 Feb 2026 16:41:14 +0100 Subject: [PATCH 64/66] Update ton.md --- readme/ton.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme/ton.md b/readme/ton.md index 39e14e55..702a2bcd 100644 --- a/readme/ton.md +++ b/readme/ton.md @@ -10,7 +10,7 @@ Supported words number: |Words number|Enum| |---|---| -|25|`TonWordsNum.WORDS_NUM_24`| +|24|`TonWordsNum.WORDS_NUM_24`| Supported languages: From a0bc845907b1182b820426b64da80510f17eb2ce Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Fri, 27 Feb 2026 17:38:59 +0100 Subject: [PATCH 65/66] Fix ruff errors --- bip_utils/__init__.py | 12 ++++++------ bip_utils/ton/__init__.py | 2 +- bip_utils/ton/mnemonic/ton_mnemonic_validator.py | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/bip_utils/__init__.py b/bip_utils/__init__.py index 0cd0e50d..c7815ab5 100644 --- a/bip_utils/__init__.py +++ b/bip_utils/__init__.py @@ -387,6 +387,12 @@ ) # TON +from bip_utils.ton import ( + Ton, + TonKeyError, + TonPrivateKey, + TonPublicKey, +) from bip_utils.ton.addr import ( TonAddrVersions, TonV3R1AddrEncoder, @@ -403,12 +409,6 @@ TonSeedTypes, TonWordsNum, ) -from bip_utils.ton import ( - Ton, - TonKeyError, - TonPrivateKey, - TonPublicKey, -) # Utils from bip_utils.utils.crypto import ( diff --git a/bip_utils/ton/__init__.py b/bip_utils/ton/__init__.py index 9a790932..f754e99c 100644 --- a/bip_utils/ton/__init__.py +++ b/bip_utils/ton/__init__.py @@ -1,3 +1,3 @@ from bip_utils.ton.ton import Ton -from bip_utils.ton.ton_keys import TonPublicKey, TonPrivateKey from bip_utils.ton.ton_ex import TonKeyError +from bip_utils.ton.ton_keys import TonPrivateKey, TonPublicKey diff --git a/bip_utils/ton/mnemonic/ton_mnemonic_validator.py b/bip_utils/ton/mnemonic/ton_mnemonic_validator.py index 2c2d5ee6..c153e6f4 100644 --- a/bip_utils/ton/mnemonic/ton_mnemonic_validator.py +++ b/bip_utils/ton/mnemonic/ton_mnemonic_validator.py @@ -60,7 +60,7 @@ def IsValid(self, mnemonic: Union[str, Mnemonic], passphrase: str = "") -> bool: """ - Get if the specified mnemonic is valid. + Get if the specified mnemonic is valid. Args: mnemonic (str or Mnemonic object): Mnemonic From 3528eec0ed10dc919e064145a54732742107faaf Mon Sep 17 00:00:00 2001 From: Emanuele Bellocchia <54482000+ebellocchia@users.noreply.github.com> Date: Fri, 27 Feb 2026 17:42:15 +0100 Subject: [PATCH 66/66] Update to setup-python v5 --- .github/workflows/code-analysis.yml | 2 +- .github/workflows/code-coverage.yml | 2 +- .github/workflows/test.yml | 8 ++++---- .github/workflows/test_min_reqs.yml | 14 +++++++------- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/code-analysis.yml b/.github/workflows/code-analysis.yml index 3df8eb01..ba7eaa70 100644 --- a/.github/workflows/code-analysis.yml +++ b/.github/workflows/code-analysis.yml @@ -31,7 +31,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Set up Python 3.13 - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: "3.13" - name: Install dependencies diff --git a/.github/workflows/code-coverage.yml b/.github/workflows/code-coverage.yml index e3ab3e4b..c94e5972 100644 --- a/.github/workflows/code-coverage.yml +++ b/.github/workflows/code-coverage.yml @@ -31,7 +31,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Set up Python 3.13 - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: "3.13" - name: Install dependencies diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ceefd917..91941234 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -38,7 +38,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install dependencies @@ -68,7 +68,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install dependencies @@ -98,7 +98,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install dependencies @@ -126,7 +126,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install dependencies diff --git a/.github/workflows/test_min_reqs.yml b/.github/workflows/test_min_reqs.yml index 464d2ea1..63c9db8c 100644 --- a/.github/workflows/test_min_reqs.yml +++ b/.github/workflows/test_min_reqs.yml @@ -37,7 +37,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Set up Python 3.7 - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: "3.7" - name: Install minimum dependencies @@ -70,7 +70,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Set up Python 3.8 - uses: actions/setup-python@v3 + uses: actions/setup-python@v5 with: python-version: "3.8" - name: Install minimum dependencies @@ -102,7 +102,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Set up Python 3.9 - uses: actions/setup-python@v3 + uses: actions/setup-python@v5 with: python-version: "3.9" - name: Install minimum dependencies @@ -135,7 +135,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Set up Python 3.10 - uses: actions/setup-python@v3 + uses: actions/setup-python@v5 with: python-version: "3.10" - name: Install minimum dependencies @@ -167,7 +167,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Set up Python 3.11 - uses: actions/setup-python@v3 + uses: actions/setup-python@v5 with: python-version: "3.11" - name: Install minimum dependencies @@ -199,7 +199,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Set up Python 3.12 - uses: actions/setup-python@v3 + uses: actions/setup-python@v5 with: python-version: "3.12" - name: Install minimum dependencies @@ -231,7 +231,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Set up Python 3.13 - uses: actions/setup-python@v3 + uses: actions/setup-python@v5 with: python-version: "3.13" - name: Install minimum dependencies