|
| 1 | + |
| 2 | +# Libit |
| 3 | + |
| 4 | +--- |
| 5 | + |
| 6 | +Fast and easy converted and generated utils for bitcoin , ethereum and tron wallet in python |
| 7 | + |
| 8 | +--- |
| 9 | + |
| 10 | +## install & use |
| 11 | + |
| 12 | +### windows |
| 13 | +```batch |
| 14 | +pip install libit |
| 15 | +``` |
| 16 | +### linux & mac |
| 17 | +```shell |
| 18 | +pip3 install libit |
| 19 | +``` |
| 20 | + |
| 21 | +generated and convert base utils key for wallet information and public , private data |
| 22 | + |
| 23 | +## how to |
| 24 | + |
| 25 | +### bytes to wif |
| 26 | + |
| 27 | +```python |
| 28 | +from libit import bytes_wif |
| 29 | +seed_bytes = b"Bytes data (32 bytes)" |
| 30 | +# wif compressed |
| 31 | +wif_compress = bytes_wif(seed_bytes, True) |
| 32 | +wif_decompress = bytes_wif(seed_bytes) |
| 33 | +``` |
| 34 | +### bytes to address |
| 35 | + |
| 36 | +```python |
| 37 | +from libit import bytes_addr |
| 38 | +seed_bytes = b"Bytes data (32 bytes)" |
| 39 | +# compressed |
| 40 | +caddr = bytes_addr(seed_bytes, True) |
| 41 | +# uncompressed |
| 42 | +uaddr = bytes_addr(seed_bytes) |
| 43 | +``` |
| 44 | + |
| 45 | +### Ethereum address |
| 46 | + |
| 47 | +```python |
| 48 | +import libit |
| 49 | +eth = libit.Ethereum(private_key=private_key) |
| 50 | +# Ethereum Address |
| 51 | +eth_addr = eth.get_address() |
| 52 | +# Ethereum Address Hex |
| 53 | +eth_hash = eth.get_hexAddress() |
| 54 | + |
| 55 | +``` |
| 56 | + |
| 57 | +### Tron |
| 58 | + |
| 59 | +Generate and Converted Private Key to Tron (TRX) Address Wallet + Hex |
| 60 | + |
| 61 | +```python |
| 62 | +import libit |
| 63 | +# Tron |
| 64 | +tron = libit.tron(private_key) |
| 65 | +# Address Wallet |
| 66 | +tron_addr = tron.get_address() |
| 67 | +# TVzMud6edfxrdiyfa6ymEh7huQfWHjtiSK |
| 68 | +# Tron Hex |
| 69 | +tron_hex = tron.get_hexAddress() |
| 70 | +# 41db9a5dc0e70338da631da168f8fe4d503de9c8c5 |
| 71 | +``` |
| 72 | +--- |
| 73 | +### wif to address: |
| 74 | + |
| 75 | +convert wif key to compressed and uncompressed address wallet |
| 76 | + |
| 77 | +```python |
| 78 | +import libit |
| 79 | + |
| 80 | +wif_str = "Wif Data String" |
| 81 | +# compressed |
| 82 | +caddr = libit.wif_addr(wif, True) |
| 83 | +# uncompressed |
| 84 | +uaddr = libit.wif_addr(wif) |
| 85 | +``` |
| 86 | +--- |
| 87 | +### Passphrase |
| 88 | + |
| 89 | +Generated and Convereted Passphrase (string) to Compressed and Uncompressed Bitcoin Address Wallet |
| 90 | + |
| 91 | +```python |
| 92 | +import libit |
| 93 | + |
| 94 | +# Passphrase |
| 95 | +pass_target = "libit" |
| 96 | + |
| 97 | +compressed_address = libit.passphrase_addr(pass_target, True) |
| 98 | +# output: 1MpWosiCM7PYubsi6h1QEgcHPAk3STbyzd |
| 99 | +uncompressed_address = libit.passphrase_addr(pass_target, False) |
| 100 | +# output: 1Dmaa5Rc3nbCq6XyQ7ytK2XTXKuNZqdGzV |
| 101 | +``` |
| 102 | + |
| 103 | +--- |
| 104 | + |
| 105 | +### Private Key (HEX) |
| 106 | + |
| 107 | +```python |
| 108 | +import libit |
| 109 | + |
| 110 | +private_key = "3e891d92f1c2af69e0f38a354247c4cc99ed39c690649a784b28eeed26a33c60" |
| 111 | + |
| 112 | +# Decimal |
| 113 | +decimal = libit.privatekey_decimal(private_key) |
| 114 | +# Output: 28285658772293776204563833849098122629211544261487479808490805808188778298464 |
| 115 | + |
| 116 | +# Wif Compress and Uncompress |
| 117 | +wif_compress = libit.privatekey_wif(private_key, True) |
| 118 | +# output: KyKGj2ZHFv7atucKxGTTsmyCY5ZoPfanvzPd8Ev6w1SM4saVTss7 |
| 119 | +wif_decompress = libit.privatekey_wif(private_key, False) |
| 120 | +# output: 5JHpyCECqh8PBQFM9tzCXY2rjqcXSymp7LoMsaWhmQfNKAnrt9z |
| 121 | + |
| 122 | +# Bitcoin Address Compress and Uncompress |
| 123 | +btc_compress = libit.privatekey_addr(private_key, True) |
| 124 | +# output: 1EwmhfQhsMsYWSd2VwgmxmcSPjVXuovPVa |
| 125 | +btc_decompress = libit.privatekey_addr(private_key, False) |
| 126 | +# output: 16KuHiP42KTxbPJc3y4DmjToRZXX9ePEyH |
| 127 | + |
| 128 | +# Ethereum Address and Hex Address |
| 129 | +eth = libit.Ethereum(private_key=private_key) |
| 130 | +eth_addr = eth.get_address() |
| 131 | +# output: 0xdb9a5dc0e70338da631da168f8fe4d503de9c8c5 |
| 132 | +eth_hex = eth.get_hexAddress() |
| 133 | +# output: 3e891d92f1c2af69e0f38a354247c4cc99ed39c690649a784b28eeed26a33c60 |
| 134 | + |
| 135 | +# Tron Address and Hex Address (Hash) |
| 136 | +tron = libit.tron(private_key=private_key) |
| 137 | +tron_addr = tron.get_address() |
| 138 | +# output: TVzMud6edfxrdiyfa6ymEh7huQfWHjtiSK |
| 139 | +tron_hex = tron.get_hexAddress() |
| 140 | +# output: 41db9a5dc0e70338da631da168f8fe4d503de9c8c5 |
| 141 | +``` |
| 142 | + |
| 143 | +### Reuse Method |
| 144 | + |
| 145 | +Extract Private Key and Public Key From Transaction ID (hash) for reuse type wallet. |
| 146 | + |
| 147 | +```python |
| 148 | +import libit |
| 149 | +from libit import reuse |
| 150 | + |
| 151 | +r = 0x0861cce1da15fc2dd79f1164c4f7b3e6c1526e7e8d85716578689ca9a5dc349d |
| 152 | +s1 = 0x6cf26e2776f7c94cafcee05cc810471ddca16fa864d13d57bee1c06ce39a3188 |
| 153 | +s2 = 0x4ba75bdda43b3aab84b895cfd9ef13a477182657faaf286a7b0d25f0cb9a7de2 |
| 154 | +z1 = 0x01b125d18422cdfa7b153f5bcf5b01927cf59791d1d9810009c70cd37b14f4e6 |
| 155 | +z2 = 0x339ff7b1ced3a45c988b3e4e239ea745db3b2b3fda6208134691bd2e4a37d6e1 |
| 156 | + |
| 157 | +pvk, pub = reuse.extract_key(r, s1, s2, z1, z2) |
| 158 | +# pvk: e773cf35fce567d0622203c28f67478a3361bae7e6eb4366b50e1d27eb1ed82e |
| 159 | +# pub: eaa57720a5b012351d42b2d9ed6409af2b7cff11d2b8631684c1c97f49685fbb |
| 160 | +# convert private key to bitcoin address |
| 161 | +address = libit.privatekey_addr(pvk, True) |
| 162 | +# output: 1FCpHq81nNLPkppTmidmoHAUy8xApTZ292 |
| 163 | +# (Total Transaction: 8 | Received: 1.56534788 BTC | Total Sent: 1.56534788 BTC) |
| 164 | + |
| 165 | +``` |
0 commit comments