Skip to content

Commit

Permalink
include wss in coins table
Browse files Browse the repository at this point in the history
  • Loading branch information
smk762 committed Feb 25, 2024
1 parent 40d6f14 commit 35bc640
Show file tree
Hide file tree
Showing 31 changed files with 335 additions and 117 deletions.
30 changes: 18 additions & 12 deletions api_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,14 @@ You can use this endpoint for:
| Name | Type | Description |
| --------------------------- | --------- | ---------------------------------------------------------------------------------- |
| count | (integer) | Number of coins matching the filter |
| results | (json) | A json dictionary of coin information |
| results | (json) | A json dictionary of coin information |
| results.coin | (json) | the name of the coin (as a key) |
| results.coin.coins_info | (json) | information about the coin as listed in https://github.com/KomodoPlatform/coins |
| results.coin.dpow | (json) | information about the coin as listed in https://github.com/KomodoPlatform/dPoW/ |
| results.coin.explorers | (list) | list of block explorers for the coin from https://github.com/KomodoPlatform/coins |
| results.coin.electrums | (list) | list of electrum servers for the coin from https://github.com/KomodoPlatform/coins |
| results.coin.electrums_ssl | (list) | list of SSL electrum servers for the coin |
| results.coin.electrums_wss | (list) | list of WSS electrum servers for the coin |
| results.coin.mm2_compatible | (integer) | 0 = not mm2 compatible; 1 = mm2 compatible |
| results.coin.dpow_active | (integer) | 0 = not being notarised by dPoW; 1 = being notarised by dPoW |

Expand All @@ -187,7 +188,7 @@ You can use this endpoint for:
URL:

```bash
http://notary.earth:8762/info/coins/?chain=RICK&mm2_compatible=1&dpow_active=1
http://notary.earth:8762/info/coins/?chain=DOC&mm2_compatible=1&dpow_active=1
```

<collapse-text hidden title="Response">
Expand All @@ -197,12 +198,12 @@ http://notary.earth:8762/info/coins/?chain=RICK&mm2_compatible=1&dpow_active=1
"count": 1,
"results": [
{
"RICK": {
"DOC": {
"coins_info": {
"mm2": 1,
"coin": "RICK",
"asset": "RICK",
"fname": "RICK (TESTCOIN)",
"coin": "DOC",
"asset": "DOC",
"fname": "DOC (TESTCOIN)",
"rpcport": 25435,
"txversion": 4,
"overwintered": 1
Expand All @@ -211,10 +212,10 @@ http://notary.earth:8762/info/coins/?chain=RICK&mm2_compatible=1&dpow_active=1
"src": "https://github.com/komodoplatform/komodo",
"server": "dPoW-mainnet",
"version": "0.5.2",
"launch_params": " -ac_name=RICK -ac_supply=90000000000 -ac_reward=100000000 -ac_cc=3 -ac_staked=10 -addnode=138.201.136.145 -addnode=95.217.44.58"
"launch_params": " -ac_name=DOC -ac_supply=90000000000 -ac_reward=100000000 -ac_cc=3 -ac_staked=10 -addnode=138.201.136.145 -addnode=95.217.44.58"
},
"explorers": [
"https://rick.kmd.dev/tx/"
"https://doc.kmd.dev/tx/"
],
"electrums": [
"electrum1.cipig.net:10017",
Expand All @@ -226,6 +227,11 @@ http://notary.earth:8762/info/coins/?chain=RICK&mm2_compatible=1&dpow_active=1
"electrum2.cipig.net:20017",
"electrum3.cipig.net:20017"
],
"electrums_wss": [
"electrum1.cipig.net:30017",
"electrum2.cipig.net:30017",
"electrum3.cipig.net:30017"
],
"mm2_compatible": 1,
"dpow_active": 1
}
Expand Down Expand Up @@ -683,7 +689,7 @@ http://notary.earth:8762/notary_stats/daily/?notarised_date=2020-04-20&notary=co
"count": 43,
"percentage": 48.31
},
"RICK": {
"DOC": {
"count": 37,
"percentage": 30.08
},
Expand All @@ -703,7 +709,7 @@ http://notary.earth:8762/notary_stats/daily/?notarised_date=2020-04-20&notary=co
"count": 56,
"percentage": 53.85
},
"MORTY": {
"MARTY": {
"count": 43,
"percentage": 33.08
},
Expand Down Expand Up @@ -1120,7 +1126,7 @@ http://notary.earth:8762/notary_stats/season/?notary=alien_AR&season=Season_3
"count": 7539,
"percentage": 27.16
},
"RICK": {
"DOC": {
"count": 13602,
"percentage": 34.52
},
Expand Down Expand Up @@ -1148,7 +1154,7 @@ http://notary.earth:8762/notary_stats/season/?notary=alien_AR&season=Season_3
"count": 12203,
"percentage": 43.86
},
"MORTY": {
"MARTY": {
"count": 14091,
"percentage": 35.42
},
Expand Down
2 changes: 1 addition & 1 deletion code/cache/navigation.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"Notarisations Last 24hrs": {
"icon": "fa-solid fa-gavel",
"url": "/notarised_24hrs/?coin=RICK"
"url": "/notarised_24hrs/?coin=DOC"
},
"Coin dPoW Tenure": {
"icon": "fa-solid fa-coins",
Expand Down
55 changes: 44 additions & 11 deletions code/docs/swagger_api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,9 @@ paths:
value: "{\"count\": 29, \"filters\": [\"season\", \"server\", \"\
epoch\", \"timestamp\"], \"results\": [\"AXO\", \"BET\", \"BOTS\"\
, \"BTCH\", \"CCL\", \"COQUICASH\", \"CRYPTO\", \"DEX\", \"HODL\"\
, \"ILN\", \"JUMBLR\", \"KOIN\", \"MESH\", \"MGW\", \"MORTY\"\
, \"ILN\", \"JUMBLR\", \"KOIN\", \"MESH\", \"MGW\", \"MARTY\"\
, \"MSHARK\", \"NINJA\", \"OOT\", \"PANGEA\", \"PGT\", \"PIRATE\"\
, \"REVS\", \"RFOX\", \"RICK\", \"STBL\", \"SUPERNET\", \"THC\"\
, \"REVS\", \"RFOX\", \"DOC\", \"STBL\", \"SUPERNET\", \"THC\"\
, \"WLC21\", \"ZILLA\"]}"
servers:
- url: http://stats.kmd.io
Expand Down Expand Up @@ -304,20 +304,49 @@ paths:
example: BET
responses:
"200":
description: SSL enabled electrums serverl URLs for coin(s)
description: SSL enabled electrums server URLs for coin(s)
content:
application/json:
schema:
$ref: '#/components/schemas/inline_response_200_6'
examples:
"0":
value: "{\"count\": 1, \"filters\": [\"chain\"], \"results\": {\"\
MORTY\": [\"electrum1.cipig.net:20018\", \"electrum2.cipig.net:20018\"\
MARTY\": [\"electrum1.cipig.net:20018\", \"electrum2.cipig.net:20018\"\
, \"electrum3.cipig.net:20018\"]}}"
servers:
- url: http://stats.kmd.io
servers:
- url: http://stats.kmd.io
/api/info/electrums_wss/:
get:
description: WSS enabled electrums for coin(s)
parameters:
- name: chain
in: query
description: Chain Ticker of dPoW active coin
required: false
style: form
explode: true
schema:
type: string
example: BET
responses:
"200":
description: WSS enabled electrums server URLs for coin(s)
content:
application/json:
schema:
$ref: '#/components/schemas/inline_response_200_6'
examples:
"0":
value: "{\"count\": 1, \"filters\": [\"chain\"], \"results\": {\"\
MARTY\": [\"electrum1.cipig.net:30018\", \"electrum2.cipig.net:30018\"\
, \"electrum3.cipig.net:30018\"]}}"
servers:
- url: http://stats.kmd.io
servers:
- url: http://stats.kmd.io
/api/info/explorers/:
get:
description: Block Explorer URLs for coins
Expand All @@ -341,7 +370,7 @@ paths:
examples:
"0":
value: "{\"count\": 1, \"filters\": [\"chain\"], \"results\": {\"\
RICK\": [\"https://rick.explorer.dexstats.info/\"]}}"
DOC\": [\"https://doc.explorer.dexstats.info/\"]}}"
servers:
- url: http://stats.kmd.io
servers:
Expand Down Expand Up @@ -424,10 +453,10 @@ paths:
BTC\": 95, \"BTCH\": 4, \"CCL\": 74, \"CHIPS\": 16, \"COQUICASH\"\
: 129, \"CRYPTO\": 118, \"DEX\": 61, \"EMC2\": 107, \"GLEEC\"\
: 70, \"HODL\": 120, \"ILN\": 139, \"JUMBLR\": 118, \"KOIN\":\
\ 101, \"MCL\": 141, \"MESH\": 81, \"MGW\": 123, \"MORTY\": 89,\
\ 101, \"MCL\": 141, \"MESH\": 81, \"MGW\": 123, \"MARTY\": 89,\
\ \"MSHARK\": 121, \"NINJA\": 2, \"OOT\": 134, \"PANGEA\": 115,\
\ \"PBC\": 140, \"PGT\": 77, \"PIRATE\": 121, \"REVS\": 128, \"\
RICK\": 106, \"STBL\": 3, \"SUPERNET\": 155, \"THC\": 160, \"\
DOC\": 106, \"STBL\": 3, \"SUPERNET\": 155, \"THC\": 160, \"\
VRSC\": 121, \"WLC21\": 145, \"ZILLA\": 79}}}"
servers:
- url: http://stats.kmd.io
Expand Down Expand Up @@ -901,6 +930,10 @@ components:
type: integer
dpow_tenure:
$ref: '#/components/schemas/inline_response_200_2_results_KMD_dpow_tenure'
electrums_wss:
type: array
items:
type: string
electrums_ssl:
type: array
items:
Expand Down Expand Up @@ -939,14 +972,14 @@ components:
inline_response_200_6_results:
type: object
properties:
MORTY:
MARTY:
type: array
items:
type: string
inline_response_200_7_results:
type: object
properties:
RICK:
DOC:
type: array
items:
type: string
Expand Down Expand Up @@ -988,7 +1021,7 @@ components:
type: integer
EMC2:
type: integer
MORTY:
MARTY:
type: integer
WLC21:
type: integer
Expand Down Expand Up @@ -1020,7 +1053,7 @@ components:
type: integer
AXO:
type: integer
RICK:
DOC:
type: integer
PANGEA:
type: integer
Expand Down
4 changes: 2 additions & 2 deletions code/kmd_ntx_api/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,6 @@

SMARTCHAINS = ["BET", "BOTS", "CCL", "CHIPS", "CLC", "CRYPTO", "DEX",
"DP", "GLEEC", "HODL", "ILN", "JUMBLR", "KMD", "KOIN",
"LABS", "MCL", "MESH", "MGW", "MORTY", "MSHARK", "NINJA",
"PANGEA", "PIRATE", "REVS", "RICK", "SOULJA", "SPACE",
"LABS", "MCL", "MESH", "MGW", "MARTY", "MSHARK", "NINJA",
"PANGEA", "PIRATE", "REVS", "DOC", "SOULJA", "SPACE",
"SUPERNET", "THC", "TOKEL", "VRSC", "WSB", "ZILLA"]
17 changes: 17 additions & 0 deletions code/kmd_ntx_api/electrum.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,17 @@ def get_electrums_ssl(request):
resp.update({item['coin']: electrums_ssl})
return resp

def get_electrums_wss(request):
coin = get_or_none(request, "coin")
data = get_coins_data(coin)
data = data.order_by('coin').values('coin', 'electrums_wss')
resp = {}
for item in data:
electrums_wss = item['electrums_wss']
if len(electrums_wss) > 0:
resp.update({item['coin']: electrums_wss})
return resp


def get_coin_electrums(coin):
data = get_coins_data(coin)
Expand All @@ -47,6 +58,12 @@ def get_coin_electrums_ssl(coin):
return data.values('electrums_ssl')[0]['electrums_ssl']


def get_coin_electrums_wss(coin):
data = get_coins_data(coin)
if data.count() == 1:
return data.values('electrums_wss')[0]['electrums_wss']


def get_from_electrum(url, port, method, params=[]):
params = [params] if not isinstance(params, list) else params
with socket.create_connection((url, port)) as sock:
Expand Down
1 change: 1 addition & 0 deletions code/kmd_ntx_api/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ def get_coins(request, coin=None):
"explorers": item["explorers"],
"electrums": item["electrums"],
"electrums_ssl": item["electrums_ssl"],
"electrums_wss": item["electrums_wss"],
"lightwallets": item["lightwallets"],
"mm2_compatible": item["mm2_compatible"],
"dpow_active": item["dpow_active"]
Expand Down
8 changes: 7 additions & 1 deletion code/kmd_ntx_api/info_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
get_notarised_servers, get_notarisation_txid_list, get_notarised_txid, \
get_notary_ltc_transactions, get_notary_ltc_txid, get_notary_nodes_info
from kmd_ntx_api.explorers import get_explorers
from kmd_ntx_api.electrum import get_electrums, get_electrums_ssl
from kmd_ntx_api.electrum import get_electrums, get_electrums_ssl, get_electrums_wss
from kmd_ntx_api.helper import json_resp


Expand Down Expand Up @@ -84,6 +84,12 @@ def coin_electrums_ssl(request):
return json_resp(resp, filters)


def coin_electrums_wss(request):
resp = get_electrums_wss(request)
filters = ['coin']
return json_resp(resp, filters)


def coin_launch_params(request):
resp = get_launch_params(request)
filters = ['coin']
Expand Down
1 change: 1 addition & 0 deletions code/kmd_ntx_api/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class coins(models.Model):
coins_info = JSONField(default=dict)
electrums = JSONField(default=dict)
electrums_ssl = JSONField(default=dict)
electrums_wss = JSONField(default=dict)
lightwallets = JSONField(default=dict)
explorers = JSONField(default=dict)
dpow = JSONField(default=dict)
Expand Down
2 changes: 1 addition & 1 deletion code/kmd_ntx_api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Meta:
class coinsSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = coins
fields = ['coin', 'coins_info', 'electrums', 'electrums_ssl',
fields = ['coin', 'coins_info', 'electrums', 'electrums_ssl', 'electrums_wss',
'explorers', 'lightwallets', 'dpow', 'dpow_tenure', 'dpow_active',
'mm2_compatible']

Expand Down
2 changes: 1 addition & 1 deletion code/kmd_ntx_api/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ def get_coin_notariser_ranks(season, coins_list=None):
region_notary_ranks = {
"TESTNET": {}
}
coins_list = ["RICK", "MORTY", "LTC"]
coins_list = ["DOC", "MARTY", "LTC"]

for notary in notary_list:
region_notary_ranks["TESTNET"].update({notary:{}})
Expand Down
6 changes: 3 additions & 3 deletions code/kmd_ntx_api/testnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def get_testnet_scoreboard(request):
ntx_data_24hr = get_notarised_date(
season).order_by('coin', '-block_height').values()

testnet_coins = ["RICK", "MORTY"]
testnet_coins = ["DOC", "MARTY"]
testnet_stats_dict = get_testnet_stats_dict(season, testnet_coins)

seednode_scores = get_seednode_version_score_total(request, "VOTE2022_Testnet", 1653091199, 1653436800)
Expand All @@ -71,7 +71,7 @@ def get_testnet_scoreboard(request):
ntx_dict.update({coin: []})
ntx_dict_24hr.update({coin: []})

if coin in ["RICK", "MORTY"] and item["block_height"] >= seasons_info[season]["start_block"]:
if coin in ["DOC", "MARTY"] and item["block_height"] >= seasons_info[season]["start_block"]:
ntx_dict[coin].append(item)

elif coin in ["KMD"] and item["block_height"] >= seasons_info[season]["start_block"]:
Expand All @@ -80,7 +80,7 @@ def get_testnet_scoreboard(request):
for item in ntx_data_24hr:
coin = item['coin']

if coin in ["RICK", "MORTY"] and item["block_height"] >= seasons_info[season]["start_block"]:
if coin in ["DOC", "MARTY"] and item["block_height"] >= seasons_info[season]["start_block"]:
ntx_dict_24hr[coin].append(item)

elif coin in ["KMD"] and item["block_height"] >= seasons_info[season]["start_block"]:
Expand Down
2 changes: 1 addition & 1 deletion code/kmd_ntx_api/tools_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ def faucet_view(request):
"status": item[6]
})

coins_list = ["RICK", "MORTY", "DOC", "MARTY", "ZOMBIE"]
coins_list = ["DOC", "MARTY", "DOC", "MARTY", "ZOMBIE"]
context = get_base_context(request)
context.update({
"page_title":"Testcoin Faucet",
Expand Down
4 changes: 4 additions & 0 deletions code/kmd_ntx_stats/urls_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@
path('api/info/electrums_ssl/',
info_api.coin_electrums_ssl,
name='coin_electrums_ssl'),

path('api/info/electrums_wss/',
info_api.coin_electrums_wss,
name='coin_electrums_wss'),

path('api/info/explorers/',
info_api.coin_explorers,
Expand Down
2 changes: 1 addition & 1 deletion code/scripts/collect_seednode_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
},
'dragonhound_DEV': {
'IP': 'dev.smk.dog',
'PeerID': '12D3KooWNGGBfPWQbubupECdkYhj1VomMLUUAYpsR2Bo3R4NzHju'
'PeerID': '12D3KooWEnrvbqvtTowYMR8FnBeKtryTj9RcXGx8EPpFZHou2ruP'
},
'dragonhound_EU': {
'IP': 's7eu.smk.dog',
Expand Down
Loading

0 comments on commit 35bc640

Please sign in to comment.