Skip to content

Commit

Permalink
CoinMarketCap, Explorer, Electrum srvs set for BTCP
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Layton committed Mar 2, 2018
1 parent 956d515 commit 2978b39
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 19 deletions.
3 changes: 2 additions & 1 deletion lib/bitcoin.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ def set_mainnet(cls):
cls.CHECKPOINTS = read_json('checkpoints.json', [])
cls.EQUIHASH_N = 200
cls.EQUIHASH_K = 9
#cls.HEADERS_URL = "http://headers.zcl-electrum.com/blockchain_headers"

cls.HEADERS_URL = "https://headers.btcprivate.org/blockchain_headers"

cls.CHUNK_SIZE = 200

Expand Down
2 changes: 1 addition & 1 deletion lib/currencies.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"CryptoCompare": [
"CoinMarketCap": [
"USD",
"EUR",
"CNY"
Expand Down
13 changes: 6 additions & 7 deletions lib/exchange_rate.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,11 @@ def get_currencies(self):
return sorted([str(a) for (a, b) in rates.items() if b is not None and len(a) in [3,4]])


class CryptoCompare(ExchangeBase):
class CoinMarketCap(ExchangeBase):
def get_rates(self, ccy):
json = self.get_json('min-api.cryptocompare.com',
"/data/pricehistorical?fsym=BTCP&tsyms=USD")
return {'USD': Decimal(json['BTCP']['USD'])}

json = self.get_json('api.coinmarketcap.com',
"/v1/ticker/btcprivate?convert=%s")
return {'USD': Decimal(json[0]['price_usd'])}


def dictinvert(d):
Expand Down Expand Up @@ -199,7 +198,7 @@ def get_currency(self):
return self.config.get('currency', 'USD')

def config_exchange(self):
return self.config.get('use_exchange', 'CryptoCompare')
return self.config.get('use_exchange', 'CoinMarketCap')

def show_history(self):
return self.is_enabled() and self.get_history_config() and self.ccy in self.exchange.history_ccys()
Expand All @@ -211,7 +210,7 @@ def set_currency(self, ccy):
self.on_quotes()

def set_exchange(self, name):
class_ = globals().get(name, CryptoCompare)
class_ = globals().get(name, CoinMarketCap)
self.print_error("using exchange", name)
if self.config_exchange() != name:
self.config.set_key('use_exchange', name, True)
Expand Down
2 changes: 1 addition & 1 deletion lib/servers.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"35.231.30.135": {"s":"50002"}
"electrum.btcprivate.org": {"s":"5222"}
}

13 changes: 4 additions & 9 deletions lib/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,20 +432,15 @@ def time_difference(distance_in_time, include_seconds):

# For raw json, append /insight-api-zcash
mainnet_block_explorers = {
'ZclassicExplorer.com': ('http://zclassicexplorer.com',
{'tx': 'tx', 'addr': 'address'}),
'ZCLMine.pro': ('http://explorer.zclmine.pro',
{'tx': 'tx', 'addr': 'address'}),
'MyZCL.com': ('http://myzcl.com',
'explorer.btcprivate.org': ('https://explorer.btcprivate.org',
{'tx': 'tx', 'addr': 'address'}),
'system default': ('blockchain:',
{'tx': 'tx', 'addr': 'address'})
}

# TODO btcp testnet block explorer
testnet_block_explorers = {
#'Blocktrail.com': ('https://www.blocktrail.com/tBTC',
#{'tx': 'tx', 'addr': 'address'}),
#'testnet.btcprivate.org': ('https://testnet.btcprivate.org',
# {'tx': 'tx', 'addr': 'address'}),
'system default': ('blockchain:',
{'tx': 'tx', 'addr': 'address'})
}
Expand All @@ -455,7 +450,7 @@ def block_explorer_info():
return testnet_block_explorers if bitcoin.NetworkConstants.TESTNET else mainnet_block_explorers

def block_explorer(config):
return config.get('block_explorer', 'explorer.zclassic.org/insight/')
return config.get('block_explorer', 'explorer.btcprivate.org')

def block_explorer_tuple(config):
return block_explorer_info().get(block_explorer(config))
Expand Down

0 comments on commit 2978b39

Please sign in to comment.