Skip to content

Commit

Permalink
Merge pull request #18 from marctheshark3/dev-plot
Browse files Browse the repository at this point in the history
Dev plot
  • Loading branch information
marctheshark3 authored May 9, 2024
2 parents 487f400 + c6bca10 commit e95f457
Show file tree
Hide file tree
Showing 10 changed files with 329 additions and 181 deletions.
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
# Sigmanauts Mining Pool

## Telegram Group
[Join our Telegram group!](https://t.me/sig_mining)


## UI Configuration
Enter you Wallet Address in the input tab when you start up the dashboard

## UI Operation
```
docker compose build # builds the latest docker image
# USING LATEST DOCKER IMAGE FROM GIT
docker compose pull # pulls the latest docker image
docker compose up -d # Runs the UI
docker compose down # Stops the UI
# ALTERNATIVELY YOU CAN BUILD IT YOURSELF
git pull # ensure you have latest files from git
docker compose up --build
```

In a web browser you can navigate to: http://localhost:8050/
Expand Down
1 change: 1 addition & 0 deletions conf/conf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ default_values:
url: 'https://api.ergo.aap.cornell.edu/api/v1/boxes/unspent/byAddress/'
token_ls: 'https://api.ergo.aap.cornell.edu/api/v1/tokens'
base_api: 'http://15.204.211.130:4000/api/pools/ErgoSigmanauts'
db_name: 'db'
stats_cols: [
'fee NUMERIC', # Numeric type for precision
'paid NUMERIC', # Numeric type for decimal values
Expand Down
36 changes: 0 additions & 36 deletions docker-compose-Copy1.yaml

This file was deleted.

29 changes: 0 additions & 29 deletions docker-compose-diy.yaml

This file was deleted.

3 changes: 2 additions & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ services:
- "5431:5432"

app:
image: ghcr.io/marctheshark3/sigmanaut-mining-pool-ui:main
build:
context: .
dockerfile: Dockerfile # Make sure this is the name of your Dockerfile
dockerfile: Dockerfile
volumes:
- ./:/app
ports:
Expand Down
9 changes: 9 additions & 0 deletions layouts/front_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,10 +378,19 @@ def get_layout(reader):

html.H1('CONNECTING TO THE POOL',
style={'color': 'white', 'textAlign': 'center', 'padding': '10px',}),
dcc.Link('Join our Telegram Group!', href='https://t.me/sig_mining',
style={'font-family': 'Times New Roman, Times, serif',
'font-weight': 'bold',
'color': 'white', 'padding': '10px',
'font-size': '30px', "display": "flex",
"justifyContent": "center" }),

# Column for the markdown
html.Div(children=[


dcc.Markdown('''
## Choose A Port
Based on your hashrate and TLS specificity choose the port that is right for you.
Expand Down
127 changes: 94 additions & 33 deletions layouts/mining_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,8 @@ def update_front_row(n, pathname):
total_df = worker_df[worker_df.worker == 'totals']
my_worker_df = total_df[total_df.miner == miner]
latest_worker = my_worker_df[my_worker_df.created == max(my_worker_df.created)]
# try:

my_total_hash = latest_worker.hashrate.item()
# except ValueError:
# timenow = pd.Timestamp.now()
# db_sync.update_miner_data(timenow=timenow, payment=False, live_data=True, performance=False)
# worker_df = db_sync.db.fetch_data('live_worker')
# total_df = worker_df[worker_df.worker == 'totals']
# my_worker_df = total_df[total_df.miner == miner]
# my_total_hash = my_worker_df.hashrate.item()

my_effort = latest_worker.effort.item()
my_ttf = latest_worker.ttf.item()
Expand Down Expand Up @@ -165,33 +158,70 @@ def update_outside(n, pathname):

return [payment_children]

@app.callback([Output('chart', 'figure'),],
[Input('mp-interval-2', 'n_intervals')],
@app.callback([Output('chart', 'figure'),Output('chart-title', 'children'),],
[Input('mp-interval-2', 'n_intervals'),
Input('chart-dropdown', 'value')],
[State('url', 'pathname')])

def update_charts(n_intervals, pathname):
def update_charts(n_intervals, chart, pathname):
wallet = unquote(pathname.lstrip('/'))
df = db_sync.db.fetch_data('performance')
my_worker_performance = df[df.miner == wallet]
my_worker_performance= my_worker_performance.sort_values('created')

miner_performance_chart = px.line(my_worker_performance,
x='created',
y='hashrate',
color='worker',
labels={'hashrate': 'Hashrate', 'created': 'Time'},
markers=True)

miner_performance_chart.update_layout(
paper_bgcolor='rgba(0,0,0,0)',
plot_bgcolor='rgba(0,0,0,0)',
legend_title_text='Miner',
legend=dict(font=dict(color='#FFFFFF')),
titlefont=dict(color='#FFFFFF'),
xaxis=dict(title='Time', color='#FFFFFF',showgrid=False, showline=False, zeroline=False),
yaxis=dict(title='Hashrate', color='#FFFFFF')
)
return [miner_performance_chart]

if chart == 'workers':
df = db_sync.db.fetch_data('performance')
my_worker_performance = df[df.miner == wallet]
my_worker_performance= my_worker_performance.sort_values('created')

miner_performance_chart = px.line(my_worker_performance,
x='created',
y='hashrate',
color='worker',
labels={'hashrate': 'Hashrate', 'created': 'Time'},
markers=True)

miner_performance_chart.update_layout(
paper_bgcolor='rgba(0,0,0,0)',
plot_bgcolor='rgba(0,0,0,0)',
legend_title_text='Miner',
legend=dict(font=dict(color='#FFFFFF')),
titlefont=dict(color='#FFFFFF'),
xaxis=dict(title='Time', color='#FFFFFF',showgrid=False, showline=False, zeroline=False),
yaxis=dict(title='Hashrate', color='#FFFFFF')
)
return [miner_performance_chart, 'WORKER HASHRATE OVER TIME']

elif chart == 'payments':
df = db_sync.db.fetch_data('payment')
df = df[df.miner == wallet]
dates = df.lastpayment.unique() # get all of the payment dates

ls = []
for date in dates:
temp = df[df.lastpayment == date]
temp = temp[temp.created_at == max(temp.created_at)] # filter by the latest payment stamp
ls.append(temp)

df = pd.concat(ls)

df = df.sort_values('lastpayment')

payment_chart = px.line(df,
x='lastpayment',
y='todaypaid',
# color='todaypaid',
labels={'todaypaid': 'Paid [ERG]', 'lastpayment': 'Date'},
markers=True)

payment_chart.update_layout(
paper_bgcolor='rgba(0,0,0,0)',
plot_bgcolor='rgba(0,0,0,0)',
# legend_title_text='Miner',
legend=dict(font=dict(color='#FFFFFF')),
titlefont=dict(color='#FFFFFF'),
xaxis=dict(title='Date', color='#FFFFFF',showgrid=False, showline=False, zeroline=False),
yaxis=dict(title='Paid [ERG]', color='#FFFFFF')
)
return [payment_chart, 'PAYMENT OVER TIME']




Expand Down Expand Up @@ -255,7 +285,38 @@ def get_layout(reader):
dbc.Col(md=md, style={'padding': '7px'}, children=[dbc.Card(style=bottom_row_style, id='s3')],)]),


html.H2('Worker Hashrate Over Time', style={'color': 'white', 'textAlign': 'center',}),
# html.H2('Worker Hashrate Over Time', style={'color': 'white', 'textAlign': 'center',}),

html.Div(
[
html.Div(
html.H1(
id='chart-title',
children='Please select an option',
style={'fontSize': '24px'}
),
style={'flex': '1'}
),
html.Div(
dcc.Dropdown(
id='chart-dropdown',
options=[
{'label': 'Worker Hashrate Over Time', 'value': 'workers'},
{'label': 'Payment Over Time', 'value': 'payments'}
],
value='workers', # Default value
style={'width': '300px', 'color': 'black'}
),
style={'flex': '1'}
)
],
style={
'display': 'flex',
'justifyContent': 'space-between',
'alignItems': 'center',
'padding': '10px'
}
),
dcc.Graph(id='chart', style={'backgroundColor': card_color, 'padding': '20px'}),

html.Div(
Expand Down
Loading

0 comments on commit e95f457

Please sign in to comment.