diff --git a/code-ch05/tx.py b/code-ch05/tx.py index 5d7a7eb3..276e866c 100644 --- a/code-ch05/tx.py +++ b/code-ch05/tx.py @@ -21,14 +21,14 @@ class TxFetcher: @classmethod def get_url(cls, testnet=False): if testnet: - return 'http://testnet.programmingbitcoin.com' + return 'https://blockstream.info/testnet/api/' else: - return 'http://mainnet.programmingbitcoin.com' + return 'https://blockstream.info/api/' @classmethod def fetch(cls, tx_id, testnet=False, fresh=False): if fresh or (tx_id not in cls.cache): - url = '{}/tx/{}.hex'.format(cls.get_url(testnet), tx_id) + url = '{}/tx/{}/hex'.format(cls.get_url(testnet), tx_id) response = requests.get(url) try: raw = bytes.fromhex(response.text.strip()) diff --git a/code-ch06/tx.py b/code-ch06/tx.py index f96054ad..6ad8bf63 100644 --- a/code-ch06/tx.py +++ b/code-ch06/tx.py @@ -20,14 +20,14 @@ class TxFetcher: @classmethod def get_url(cls, testnet=False): if testnet: - return 'http://testnet.programmingbitcoin.com' + return 'https://blockstream.info/testnet/api' else: - return 'http://mainnet.programmingbitcoin.com' + return 'https://blockstream.info/api' @classmethod def fetch(cls, tx_id, testnet=False, fresh=False): if fresh or (tx_id not in cls.cache): - url = '{}/tx/{}.hex'.format(cls.get_url(testnet), tx_id) + url = '{}/tx/{}/hex'.format(cls.get_url(testnet), tx_id) response = requests.get(url) try: raw = bytes.fromhex(response.text.strip()) diff --git a/code-ch07/tx.py b/code-ch07/tx.py index 7a5dc69e..d3beba9c 100644 --- a/code-ch07/tx.py +++ b/code-ch07/tx.py @@ -22,14 +22,14 @@ class TxFetcher: @classmethod def get_url(cls, testnet=False): if testnet: - return 'http://testnet.programmingbitcoin.com' + return 'https://blockstream.info/testnet/api' else: - return 'http://mainnet.programmingbitcoin.com' + return 'https://blockstream.info/api' @classmethod def fetch(cls, tx_id, testnet=False, fresh=False): if fresh or (tx_id not in cls.cache): - url = '{}/tx/{}.hex'.format(cls.get_url(testnet), tx_id) + url = '{}/tx/{}/hex'.format(cls.get_url(testnet), tx_id) response = requests.get(url) try: raw = bytes.fromhex(response.text.strip()) diff --git a/code-ch08/tx.py b/code-ch08/tx.py index 412b63ed..500bea16 100644 --- a/code-ch08/tx.py +++ b/code-ch08/tx.py @@ -22,9 +22,9 @@ class TxFetcher: @classmethod def get_url(cls, testnet=False): if testnet: - return 'http://testnet.programmingbitcoin.com' + return 'https://blockstream.info/testnet/api' else: - return 'http://mainnet.programmingbitcoin.com' + return 'https://blockstream.info/api' @classmethod def fetch(cls, tx_id, testnet=False, fresh=False): diff --git a/code-ch09/tx.py b/code-ch09/tx.py index 7b3b4080..99ba94a2 100644 --- a/code-ch09/tx.py +++ b/code-ch09/tx.py @@ -22,14 +22,14 @@ class TxFetcher: @classmethod def get_url(cls, testnet=False): if testnet: - return 'http://testnet.programmingbitcoin.com' + return 'https://blockstream.info/testnet/api' else: - return 'http://mainnet.programmingbitcoin.com' + return 'https://blockstream.info/api' @classmethod def fetch(cls, tx_id, testnet=False, fresh=False): if fresh or (tx_id not in cls.cache): - url = '{}/tx/{}.hex'.format(cls.get_url(testnet), tx_id) + url = '{}/tx/{}/hex'.format(cls.get_url(testnet), tx_id) response = requests.get(url) try: raw = bytes.fromhex(response.text.strip()) diff --git a/code-ch10/tx.py b/code-ch10/tx.py index f2e8008f..a5e658ef 100644 --- a/code-ch10/tx.py +++ b/code-ch10/tx.py @@ -22,9 +22,9 @@ class TxFetcher: @classmethod def get_url(cls, testnet=False): if testnet: - return 'http://testnet.programmingbitcoin.com' + return 'https://blockstream.info/testnet/api' else: - return 'http://mainnet.programmingbitcoin.com' + return 'https://blockstream.info/api' @classmethod def fetch(cls, tx_id, testnet=False, fresh=False): diff --git a/code-ch11/tx.py b/code-ch11/tx.py index f2e8008f..674d69ea 100644 --- a/code-ch11/tx.py +++ b/code-ch11/tx.py @@ -22,14 +22,14 @@ class TxFetcher: @classmethod def get_url(cls, testnet=False): if testnet: - return 'http://testnet.programmingbitcoin.com' + return 'https://blockstream.info/testnet/api/' else: - return 'http://mainnet.programmingbitcoin.com' + return 'https://blockstream.info/api/' @classmethod def fetch(cls, tx_id, testnet=False, fresh=False): if fresh or (tx_id not in cls.cache): - url = '{}/tx/{}.hex'.format(cls.get_url(testnet), tx_id) + url = '{}/tx/{}/hex'.format(cls.get_url(testnet), tx_id) response = requests.get(url) try: raw = bytes.fromhex(response.text.strip()) diff --git a/code-ch12/tx.py b/code-ch12/tx.py index 168e1cb7..396be463 100644 --- a/code-ch12/tx.py +++ b/code-ch12/tx.py @@ -22,14 +22,14 @@ class TxFetcher: @classmethod def get_url(cls, testnet=False): if testnet: - return 'http://testnet.programmingbitcoin.com' + return 'https://blockstream.info/testnet/api' else: - return 'http://mainnet.programmingbitcoin.com' + return 'https://blockstream.info/api' @classmethod def fetch(cls, tx_id, testnet=False, fresh=False): if fresh or (tx_id not in cls.cache): - url = '{}/tx/{}.hex'.format(cls.get_url(testnet), tx_id) + url = '{}/tx/{}/hex'.format(cls.get_url(testnet), tx_id) response = requests.get(url) try: raw = bytes.fromhex(response.text.strip()) diff --git a/code-ch13/tx.py b/code-ch13/tx.py index f6ab094b..6c1b6312 100644 --- a/code-ch13/tx.py +++ b/code-ch13/tx.py @@ -18,18 +18,18 @@ class TxFetcher: cache = {} - + @classmethod def get_url(cls, testnet=False): if testnet: - return 'http://testnet.programmingbitcoin.com' + return 'https://blockstream.info/testnet/api' else: - return 'http://mainnet.programmingbitcoin.com' + return 'https://blockstream.info/api' @classmethod def fetch(cls, tx_id, testnet=False, fresh=False): if fresh or (tx_id not in cls.cache): - url = '{}/tx/{}.hex'.format(cls.get_url(testnet), tx_id) + url = '{}/tx/{}/hex'.format(cls.get_url(testnet), tx_id) response = requests.get(url) try: raw = bytes.fromhex(response.text.strip())