tencoinlib 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,69 @@
1
+ Metadata-Version: 2.4
2
+ Name: tencoinlib
3
+ Version: 0.1.0
4
+ Summary: Official Python library for Tencoin – HD wallets, SegWit, BIP39, RPC client
5
+ Author: Tencoin Development Team
6
+ License: MIT
7
+ Project-URL: Homepage, https://tencoin.org
8
+ Project-URL: Repository, https://github.com/tencoinorg/tencoin
9
+ Project-URL: Issues, https://github.com/tencoinorg/tencoin/issues
10
+ Project-URL: Documentation, https://tencoin-core.readthedocs.io
11
+ Keywords: tencoin,blockchain,cryptocurrency,hd-wallet,bip39,segwit,rpc
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.8
18
+ Classifier: Programming Language :: Python :: 3.9
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
+ Classifier: Topic :: Utilities
24
+ Requires-Python: >=3.8
25
+ Description-Content-Type: text/markdown
26
+ Requires-Dist: ecdsa>=0.18.0
27
+ Requires-Dist: requests>=2.28.0
28
+ Requires-Dist: bech32>=1.2.0
29
+ Provides-Extra: dev
30
+ Requires-Dist: pytest>=7.0; extra == "dev"
31
+ Requires-Dist: pytest-cov; extra == "dev"
32
+ Requires-Dist: black; extra == "dev"
33
+ Requires-Dist: ruff; extra == "dev"
34
+ Provides-Extra: async
35
+ Requires-Dist: aiohttp>=3.8.0; extra == "async"
36
+ Provides-Extra: mnemonic
37
+ Requires-Dist: mnemonic>=0.20; extra == "mnemonic"
38
+
39
+ # Tencoinlib
40
+
41
+ Official Python library for Tencoin – HD wallets, transactions, and RPC client.
42
+
43
+ ## Features
44
+
45
+ - **HD Wallets**: BIP-39 (seed phrases) + BIP-84 (SegWit native addresses)
46
+ - **Full BIP-32 Support**: Standard xprv/xpub extended keys with master/account-level derivation
47
+ - **Watch-Only Wallets**: Create wallets directly from xpub (no seed/private key required)
48
+ - **Multiple Address Types**:
49
+ - **SegWit v0** (P2WPKH): Native SegWit addresses (`tc1q...`)
50
+ - **Legacy P2PKH**: Pay-to-pubkey-hash addresses (`T...`)
51
+ - **Legacy P2SH**: Pay-to-script-hash addresses (`M...`)
52
+ - **P2WSH**: SegWit script addresses (`tc1q...` with 32-byte program)
53
+ - **Custom Scripts**: Support for multisig and custom redeem/witness scripts
54
+ - **Transaction Signing**: Automatic detection and signing for SegWit (BIP-143) and Legacy (P2PKH/P2SH) inputs
55
+ - **Key Derivation**:
56
+ - **BIP-84 (P2WPKH)**: `m/84'/5353'/0'/0/0` for native SegWit addresses
57
+ - **BIP-44 (P2PKH)**: `m/44'/5353'/0'/0/0` for legacy P2PKH addresses
58
+ - Additional custom BIP-32 paths supported via the BIP-32 API
59
+ - **Seed Phrases**: 12–24 word English mnemonics (full BIP-39 compliance)
60
+ - **Wallet Recovery**: From mnemonic phrases – compatible with standard BIP-39 implementations
61
+ - **Full BIP-39 Compatibility**: Mnemonics generated by other standard libraries (e.g., bip-utils, Electrum, MetaMask, Ian Coleman's tool) are validated and recovered
62
+ - **Secure Seed Generation**: PBKDF2-HMAC-SHA512 with official 2048-word English wordlist
63
+
64
+
65
+
66
+ ## Installation
67
+
68
+ ```bash
69
+ pip install tencoinlib
@@ -0,0 +1,31 @@
1
+ # Tencoinlib
2
+
3
+ Official Python library for Tencoin – HD wallets, transactions, and RPC client.
4
+
5
+ ## Features
6
+
7
+ - **HD Wallets**: BIP-39 (seed phrases) + BIP-84 (SegWit native addresses)
8
+ - **Full BIP-32 Support**: Standard xprv/xpub extended keys with master/account-level derivation
9
+ - **Watch-Only Wallets**: Create wallets directly from xpub (no seed/private key required)
10
+ - **Multiple Address Types**:
11
+ - **SegWit v0** (P2WPKH): Native SegWit addresses (`tc1q...`)
12
+ - **Legacy P2PKH**: Pay-to-pubkey-hash addresses (`T...`)
13
+ - **Legacy P2SH**: Pay-to-script-hash addresses (`M...`)
14
+ - **P2WSH**: SegWit script addresses (`tc1q...` with 32-byte program)
15
+ - **Custom Scripts**: Support for multisig and custom redeem/witness scripts
16
+ - **Transaction Signing**: Automatic detection and signing for SegWit (BIP-143) and Legacy (P2PKH/P2SH) inputs
17
+ - **Key Derivation**:
18
+ - **BIP-84 (P2WPKH)**: `m/84'/5353'/0'/0/0` for native SegWit addresses
19
+ - **BIP-44 (P2PKH)**: `m/44'/5353'/0'/0/0` for legacy P2PKH addresses
20
+ - Additional custom BIP-32 paths supported via the BIP-32 API
21
+ - **Seed Phrases**: 12–24 word English mnemonics (full BIP-39 compliance)
22
+ - **Wallet Recovery**: From mnemonic phrases – compatible with standard BIP-39 implementations
23
+ - **Full BIP-39 Compatibility**: Mnemonics generated by other standard libraries (e.g., bip-utils, Electrum, MetaMask, Ian Coleman's tool) are validated and recovered
24
+ - **Secure Seed Generation**: PBKDF2-HMAC-SHA512 with official 2048-word English wordlist
25
+
26
+
27
+
28
+ ## Installation
29
+
30
+ ```bash
31
+ pip install tencoinlib
@@ -0,0 +1,52 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "tencoinlib"
7
+ version = "0.1.0"
8
+ description = "Official Python library for Tencoin – HD wallets, SegWit, BIP39, RPC client"
9
+ readme = "README.md"
10
+ authors = [{ name = "Tencoin Development Team" }]
11
+ license = { text = "MIT" }
12
+ keywords = ["tencoin", "blockchain", "cryptocurrency", "hd-wallet", "bip39", "segwit", "rpc"]
13
+ classifiers = [
14
+ "Development Status :: 4 - Beta",
15
+ "Intended Audience :: Developers",
16
+ "License :: OSI Approved :: MIT License",
17
+ "Operating System :: OS Independent",
18
+ "Programming Language :: Python :: 3",
19
+ "Programming Language :: Python :: 3.8",
20
+ "Programming Language :: Python :: 3.9",
21
+ "Programming Language :: Python :: 3.10",
22
+ "Programming Language :: Python :: 3.11",
23
+ "Programming Language :: Python :: 3.12",
24
+ "Topic :: Software Development :: Libraries :: Python Modules",
25
+ "Topic :: Utilities",
26
+ ]
27
+ requires-python = ">=3.8"
28
+ dependencies = [
29
+ "ecdsa>=0.18.0",
30
+ "requests>=2.28.0",
31
+ "bech32>=1.2.0",
32
+ ]
33
+
34
+ [project.optional-dependencies]
35
+ dev = [
36
+ "pytest>=7.0",
37
+ "pytest-cov",
38
+ "black",
39
+ "ruff",
40
+ ]
41
+ async = ["aiohttp>=3.8.0"]
42
+ mnemonic = ["mnemonic>=0.20"]
43
+
44
+ [project.urls]
45
+ Homepage = "https://tencoin.org"
46
+ Repository = "https://github.com/tencoinorg/tencoin"
47
+ Issues = "https://github.com/tencoinorg/tencoin/issues"
48
+ Documentation = "https://tencoin-core.readthedocs.io"
49
+
50
+ [tool.setuptools.packages.find]
51
+ where = ["."]
52
+ include = ["tencoinlib*"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,68 @@
1
+ # tencoin/tencoinlib/__init__.py
2
+ """
3
+ tencoinlib - Official Python library for Tencoin
4
+ """
5
+
6
+ from .constants import (
7
+ MAINNET_HRP,
8
+ TENOS_PER_TEC,
9
+ DUST_LIMIT,
10
+ DEFAULT_RPC_PORT,
11
+ COIN_TYPE,
12
+ DERIVATION_PATH,
13
+ DEFAULT_RPC_TOKEN
14
+ )
15
+
16
+ from .wallet import Wallet, WalletError
17
+ from .rpc import RPCClient, RPCError
18
+ from .transaction import (
19
+ Transaction, TxIn, TxOut, parse_transaction,
20
+ TransactionBuilder, TransactionBuilderError,
21
+ SegWitSigner, LegacySigner, TransactionSigner, SigningError,
22
+ FeeCalculator,
23
+ decode_address, address_to_script, is_valid_address,
24
+ get_address_type, AddressError
25
+ )
26
+
27
+ # Version
28
+ __version__ = "0.1.0"
29
+
30
+ __all__ = [
31
+ # Constants
32
+ "MAINNET_HRP",
33
+ "TENOS_PER_TEC",
34
+ "DUST_LIMIT",
35
+ "DEFAULT_RPC_PORT",
36
+ "DEFAULT_RPC_TOKEN",
37
+ "COIN_TYPE",
38
+ "DERIVATION_PATH",
39
+
40
+ # Wallet
41
+ "Wallet",
42
+ "WalletError",
43
+
44
+ # RPC
45
+ "RPCClient",
46
+ "RPCError",
47
+
48
+ # Transaction
49
+ "Transaction",
50
+ "TxIn",
51
+ "TxOut",
52
+ "parse_transaction",
53
+ "TransactionBuilder",
54
+ "TransactionBuilderError",
55
+ "SegWitSigner",
56
+ "LegacySigner",
57
+ "TransactionSigner",
58
+ "SigningError",
59
+ "FeeCalculator",
60
+ "decode_address",
61
+ "address_to_script",
62
+ "is_valid_address",
63
+ "get_address_type",
64
+ "AddressError",
65
+
66
+ # Version
67
+ "__version__",
68
+ ]
@@ -0,0 +1 @@
1
+ __version__ = "0.1.0"
@@ -0,0 +1,59 @@
1
+ # tencoinlib/constants.py
2
+
3
+
4
+ MAINNET_HRP = "tc"
5
+
6
+
7
+ COIN_TYPE = 5353
8
+
9
+
10
+ # BIP purposes
11
+ BIP44_PURPOSE = 44 # Legacy P2PKH
12
+ BIP49_PURPOSE = 49 # Nested SegWit (reserved for future use)
13
+ BIP84_PURPOSE = 84 # Native SegWit (P2WPKH)
14
+
15
+
16
+ # Default BIP84 derivation path for the primary SegWit address
17
+ DERIVATION_PATH = f"m/{BIP84_PURPOSE}'/{COIN_TYPE}'/0'/0/0"
18
+
19
+
20
+ BIP39_ENTROPY_BITS = 128
21
+ BIP39_CHECKSUM_BITS = 4
22
+
23
+
24
+ P2PKH_VERSION = 0x41
25
+ P2SH_VERSION = 0x32
26
+ P2WPKH_VERSION = 0
27
+
28
+
29
+ TENOS_PER_TEC = 100_000_000
30
+ DUST_LIMIT = 546
31
+
32
+
33
+ DEFAULT_RPC_PORT = 10111
34
+ DEFAULT_P2P_PORT = 10110
35
+
36
+
37
+ DEFAULT_RPC_TOKEN = ""
38
+
39
+
40
+ DEFAULT_SEED_NODES = [
41
+ "seed.tencoin.org",
42
+ ]
43
+
44
+
45
+ DEFAULT_FEE_RATE = 10
46
+ PRIORITY_FEE_RATE = 20
47
+ ECONOMY_FEE_RATE = 5
48
+ MIN_RELAY_FEE = 1000
49
+
50
+
51
+ MAINNET_MAGIC = b'\x0a\x0d\x0e\x10'
52
+ TESTNET_MAGIC = b'\x0b\x11\x09\x07'
53
+
54
+
55
+ OP_DUP = 0x76
56
+ OP_HASH160 = 0xa9
57
+ OP_EQUALVERIFY = 0x88
58
+ OP_CHECKSIG = 0xac
59
+ OP_EQUAL = 0x87