Skip to content

Commit d494a8e

Browse files
committed
Switch dependency from bitcoin => cryptos (#168)
* switch from bitcoin library to cryptos * update .gitignore to exclude VSCode files * remove unused imports * reformat batch imports * add __all__ to __init__.py * update version to 1.0.94 * use stdlib binascii module
1 parent dac3bc6 commit d494a8e

File tree

6 files changed

+202
-108
lines changed

6 files changed

+202
-108
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,6 @@ coverage.xml
4848
*.log
4949
*.pot
5050
.idea/
51+
52+
# IDEs
53+
.vscode/

blockcypher/__init__.py

Lines changed: 170 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -6,85 +6,174 @@
66
"""
77

88
# Main methods used
9-
from .api import get_token_info
10-
from .api import get_address_details
11-
from .api import get_addresses_details
12-
from .api import get_address_overview
13-
from .api import get_address_full
14-
from .api import get_transaction_details
15-
from .api import get_transactions_details
16-
from .api import get_block_overview
17-
from .api import get_blocks_overview
18-
from .api import get_block_details
19-
from .api import get_blockchain_overview
20-
from .api import get_blockchain_fee_estimates
21-
from .api import get_blockchain_high_fee
22-
from .api import get_blockchain_medium_fee
23-
from .api import get_blockchain_low_fee
24-
from .api import get_latest_block_height
25-
from .api import get_latest_block_hash
26-
from .api import get_total_balance
27-
from .api import get_unconfirmed_balance
28-
from .api import get_confirmed_balance
29-
from .api import get_num_confirmed_transactions
30-
from .api import get_num_unconfirmed_transactions
31-
from .api import get_total_num_transactions
32-
from .api import generate_new_address
33-
from .api import derive_hd_address
34-
from .api import get_num_confirmations
35-
from .api import get_confidence
36-
from .api import get_miner_preference
37-
from .api import get_receive_count
38-
from .api import get_satoshis_transacted
39-
from .api import get_satoshis_in_fees
40-
from .api import get_merkle_root
41-
from .api import get_bits
42-
from .api import get_nonce
43-
from .api import get_prev_block_hash
44-
from .api import get_block_hash
45-
from .api import get_block_height
46-
from .api import get_broadcast_transactions
47-
from .api import get_broadcast_transaction_hashes
48-
from .api import subscribe_to_address_webhook
49-
from .api import subscribe_to_wallet_webhook
50-
from .api import list_webhooks
51-
from .api import get_webhook_info
52-
from .api import unsubscribe_from_webhook
53-
from .api import pushtx
54-
from .api import decodetx
55-
from .api import get_forwarding_address
56-
from .api import create_forwarding_address
57-
from .api import create_forwarding_address_with_details
58-
from .api import get_forwarding_address_details
59-
from .api import list_forwarding_addresses
60-
from .api import delete_forwarding_address
61-
from .api import send_faucet_coins
62-
from .api import list_wallet_names
63-
from .api import create_wallet_from_address
64-
from .api import create_hd_wallet
65-
from .api import get_wallet_addresses
66-
from .api import get_wallet_balance
67-
from .api import get_wallet_transactions
68-
from .api import get_latest_paths_from_hd_wallet_addresses
69-
from .api import add_address_to_wallet
70-
from .api import remove_address_from_wallet
71-
from .api import delete_wallet
72-
from .api import generate_multisig_address
73-
from .api import create_unsigned_tx
74-
from .api import verify_unsigned_tx
75-
from .api import get_input_addresses
76-
from .api import make_tx_signatures
77-
from .api import broadcast_signed_transaction
78-
from .api import simple_spend
79-
from .api import simple_spend_p2sh
80-
from .api import embed_data
81-
from .api import get_metadata
82-
from .api import put_metadata
83-
from .api import delete_metadata
9+
from .api import (
10+
get_token_info,
11+
get_address_details,
12+
get_addresses_details,
13+
get_address_overview,
14+
get_address_full,
15+
get_transaction_details,
16+
get_transactions_details,
17+
get_block_overview,
18+
get_blocks_overview,
19+
get_block_details,
20+
get_blockchain_overview,
21+
get_blockchain_fee_estimates,
22+
get_blockchain_high_fee,
23+
get_blockchain_medium_fee,
24+
get_blockchain_low_fee,
25+
get_latest_block_height,
26+
get_latest_block_hash,
27+
get_total_balance,
28+
get_unconfirmed_balance,
29+
get_confirmed_balance,
30+
get_num_confirmed_transactions,
31+
get_num_unconfirmed_transactions,
32+
get_total_num_transactions,
33+
generate_new_address,
34+
derive_hd_address,
35+
get_num_confirmations,
36+
get_confidence,
37+
get_miner_preference,
38+
get_receive_count,
39+
get_satoshis_transacted,
40+
get_satoshis_in_fees,
41+
get_merkle_root,
42+
get_bits,
43+
get_nonce,
44+
get_prev_block_hash,
45+
get_block_hash,
46+
get_block_height,
47+
get_broadcast_transactions,
48+
get_broadcast_transaction_hashes,
49+
subscribe_to_address_webhook,
50+
subscribe_to_wallet_webhook,
51+
list_webhooks,
52+
get_webhook_info,
53+
unsubscribe_from_webhook,
54+
pushtx,
55+
decodetx,
56+
get_forwarding_address,
57+
create_forwarding_address,
58+
create_forwarding_address_with_details,
59+
get_forwarding_address_details,
60+
list_forwarding_addresses,
61+
delete_forwarding_address,
62+
send_faucet_coins,
63+
list_wallet_names,
64+
create_wallet_from_address,
65+
create_hd_wallet,
66+
get_wallet_addresses,
67+
get_wallet_balance,
68+
get_wallet_transactions,
69+
get_latest_paths_from_hd_wallet_addresses,
70+
add_address_to_wallet,
71+
remove_address_from_wallet,
72+
delete_wallet,
73+
generate_multisig_address,
74+
create_unsigned_tx,
75+
verify_unsigned_tx,
76+
get_input_addresses,
77+
make_tx_signatures,
78+
broadcast_signed_transaction,
79+
simple_spend,
80+
simple_spend_p2sh,
81+
embed_data,
82+
get_metadata,
83+
put_metadata,
84+
delete_metadata,
85+
)
8486

85-
from .utils import from_base_unit
86-
from .utils import satoshis_to_btc
87-
from .utils import wei_to_ether
88-
from .utils import is_valid_hash
89-
from .utils import is_valid_address
90-
from .utils import is_valid_eth_address
87+
from .utils import (
88+
from_base_unit,
89+
satoshis_to_btc,
90+
wei_to_ether,
91+
is_valid_hash,
92+
is_valid_address,
93+
is_valid_eth_address,
94+
)
95+
96+
97+
__all__ = [
98+
"get_token_info",
99+
"get_address_details",
100+
"get_addresses_details",
101+
"get_address_overview",
102+
"get_address_full",
103+
"get_transaction_details",
104+
"get_transactions_details",
105+
"get_block_overview",
106+
"get_blocks_overview",
107+
"get_block_details",
108+
"get_blockchain_overview",
109+
"get_blockchain_fee_estimates",
110+
"get_blockchain_high_fee",
111+
"get_blockchain_medium_fee",
112+
"get_blockchain_low_fee",
113+
"get_latest_block_height",
114+
"get_latest_block_hash",
115+
"get_total_balance",
116+
"get_unconfirmed_balance",
117+
"get_confirmed_balance",
118+
"get_num_confirmed_transactions",
119+
"get_num_unconfirmed_transactions",
120+
"get_total_num_transactions",
121+
"generate_new_address",
122+
"derive_hd_address",
123+
"get_num_confirmations",
124+
"get_confidence",
125+
"get_miner_preference",
126+
"get_receive_count",
127+
"get_satoshis_transacted",
128+
"get_satoshis_in_fees",
129+
"get_merkle_root",
130+
"get_bits",
131+
"get_nonce",
132+
"get_prev_block_hash",
133+
"get_block_hash",
134+
"get_block_height",
135+
"get_broadcast_transactions",
136+
"get_broadcast_transaction_hashes",
137+
"subscribe_to_address_webhook",
138+
"subscribe_to_wallet_webhook",
139+
"list_webhooks",
140+
"get_webhook_info",
141+
"unsubscribe_from_webhook",
142+
"pushtx",
143+
"decodetx",
144+
"get_forwarding_address",
145+
"create_forwarding_address",
146+
"create_forwarding_address_with_details",
147+
"get_forwarding_address_details",
148+
"list_forwarding_addresses",
149+
"delete_forwarding_address",
150+
"send_faucet_coins",
151+
"list_wallet_names",
152+
"create_wallet_from_address",
153+
"create_hd_wallet",
154+
"get_wallet_addresses",
155+
"get_wallet_balance",
156+
"get_wallet_transactions",
157+
"get_latest_paths_from_hd_wallet_addresses",
158+
"add_address_to_wallet",
159+
"remove_address_from_wallet",
160+
"delete_wallet",
161+
"generate_multisig_address",
162+
"create_unsigned_tx",
163+
"verify_unsigned_tx",
164+
"get_input_addresses",
165+
"make_tx_signatures",
166+
"broadcast_signed_transaction",
167+
"simple_spend",
168+
"simple_spend_p2sh",
169+
"embed_data",
170+
"get_metadata",
171+
"put_metadata",
172+
"delete_metadata",
173+
"from_base_unit",
174+
"satoshis_to_btc",
175+
"wei_to_ether",
176+
"is_valid_hash",
177+
"is_valid_address",
178+
"is_valid_eth_address",
179+
]

blockcypher/api.py

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
1-
import os
2-
3-
from bitcoin import ecdsa_raw_sign
4-
from bitcoin import ecdsa_raw_verify
5-
from bitcoin import der_decode_sig
6-
from bitcoin import compress
7-
from bitcoin import privkey_to_pubkey
8-
from bitcoin import pubkey_to_address
9-
from bitcoin import der_encode_sig
10-
11-
from .utils import is_valid_hash
12-
from .utils import is_valid_block_representation
13-
from .utils import is_valid_coin_symbol
14-
from .utils import is_valid_wallet_name
15-
from .utils import is_valid_address_for_coinsymbol
16-
from .utils import coin_symbol_from_mkey
17-
from .utils import double_sha256
18-
from .utils import compress_txn_outputs
19-
from .utils import get_txn_outputs_dict
20-
from .utils import uses_only_hash_chars
21-
from .utils import delegate_task
1+
from cryptos import (
2+
ecdsa_raw_sign,
3+
ecdsa_raw_verify,
4+
der_decode_sig,
5+
compress,
6+
privkey_to_pubkey,
7+
pubkey_to_address,
8+
der_encode_sig,
9+
)
10+
11+
from .utils import (
12+
is_valid_hash,
13+
is_valid_block_representation,
14+
is_valid_coin_symbol,
15+
is_valid_wallet_name,
16+
is_valid_address_for_coinsymbol,
17+
coin_symbol_from_mkey,
18+
double_sha256,
19+
compress_txn_outputs,
20+
get_txn_outputs_dict,
21+
uses_only_hash_chars,
22+
)
2223

2324
from .constants import COIN_SYMBOL_MAPPINGS
2425

blockcypher/crypto.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
from bitcoin import encode, changebase, binascii, bin_to_b58check
1+
import binascii
2+
3+
from cryptos import bin_to_b58check
24

35
import re
46

blockcypher/utils.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import re
22
from concurrent.futures.thread import ThreadPoolExecutor
3-
from functools import partial
4-
from typing import Callable, Sequence, Tuple, List
3+
from typing import Callable, Tuple, List
54

65
from .constants import SHA_COINS, SCRYPT_COINS, ETHASH_COINS, COIN_SYMBOL_SET, COIN_SYMBOL_MAPPINGS, FIRST4_MKEY_CS_MAPPINGS_UPPER, UNIT_CHOICES, UNIT_MAPPINGS
76
from .crypto import script_to_address
87

9-
from bitcoin import safe_from_hex, deserialize
8+
from cryptos import safe_from_hex, deserialize
109

1110
from collections import OrderedDict
1211
from hashlib import sha256

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414
setup(name='blockcypher',
1515
long_description=long_description,
1616
long_description_content_type='text/markdown',
17-
version='1.0.93',
17+
version='1.0.94',
1818
description='BlockCypher Python Library',
1919
author='Michael Flaxman',
2020
author_email='mflaxman+blockcypher@gmail.com',
2121
url='https://github.com/blockcypher/blockcypher-python/',
2222
install_requires=[
2323
'requests<3.0.0',
2424
'python-dateutil<3.0.0',
25-
'bitcoin==1.1.39',
25+
'cryptos<3.0.0'
2626
],
2727
packages=['blockcypher'],
2828
include_package_data=True,

0 commit comments

Comments
 (0)