network stats

This commit is contained in:
Ben Wilson
2023-08-03 22:41:50 -04:00
parent b32b2ef3ab
commit d8241362e6
11 changed files with 101 additions and 24 deletions
+1 -1
View File
@@ -4,9 +4,9 @@
"scripts": {
"ng": "ng",
"start": "ng serve --proxy-config proxy.config.local.json ",
"start:prod": "ng serve --proxy-config proxy.config.prod.json ",
"build": "ng build --configuration=production && gzipper compress --gzip --brotli ./dist/public-pool-ui/",
"build:github": "ng build --configuration=production --base-href https://benjamin-wilson.github.io/public-pool-ui/",
"start:prod": "ng serve --proxy-config proxy.config.prod.json ",
"watch": "ng build --watch --configuration development",
"test": "ng test",
"bundle-report": "ng build --configuration=production --source-map=true --named-chunks=true --stats-json && webpack-bundle-analyzer dist/public-pool-ui/stats.json"
@@ -1,10 +1,13 @@
<ng-container *ngIf="clientInfo$ | async as clientInfo">
<div class="grid">
<div class="col-12 lg:col-6 xl:col-3">
<div class="card mb-4">
<div class="flex justify-content-between mb-3">
<div>
<span class="block text-500 font-medium mb-3">Best Difficulty (All-Time)</span>
<span class="block text-500 font-medium mb-3">Your Best Difficulty <i
class="pi pi-question-circle ml-2"
pTooltip="If you find a solution with a difficulty higher than the network difficulty, you've found a block."></i></span>
<div class="text-900 font-medium text-xl">{{clientInfo.bestDifficulty | numberSuffix}}
</div>
</div>
@@ -15,7 +18,60 @@
</div>
<span class="text-green-500 font-medium">{{clientInfo.bestDifficulty | number}}</span>
</div>
</div>
<ng-container *ngIf="networkInfo$ | async as networkInfo">
<div class="col-12 lg:col-6 xl:col-3">
<div class="card mb-4">
<div class="flex justify-content-between mb-3">
<div>
<span class="block text-500 font-medium mb-3">Network Difficulty</span>
<div class="text-900 font-medium text-xl">{{networkInfo.difficulty | numberSuffix}}
</div>
</div>
<!-- <div class="flex align-items-center justify-content-center bg-orange-100 border-round"
[ngStyle]="{width: '2.5rem', height: '2.5rem'}">
<i class="pi pi-star text-orange-500 text-xl"></i>
</div> -->
</div>
<span class="text-green-500 font-medium">{{networkInfo.difficulty | number}}</span>
</div>
</div>
<div class="col-12 lg:col-6 xl:col-3">
<div class="card mb-4">
<div class="flex justify-content-between mb-3">
<div>
<span class="block text-500 font-medium mb-3">Network Hash Rate </span>
<div class="text-900 font-medium text-xl">{{networkInfo.networkhashps | hashSuffix}}
</div>
</div>
<!-- <div class="flex align-items-center justify-content-center bg-orange-100 border-round"
[ngStyle]="{width: '2.5rem', height: '2.5rem'}">
<i class="pi pi-star text-orange-500 text-xl"></i>
</div> -->
</div>
<span class="text-green-500 font-medium">&nbsp;</span>
</div>
</div>
<div class="col-12 lg:col-6 xl:col-3">
<div class="card mb-4">
<div class="flex justify-content-between mb-3">
<div>
<span class="block text-500 font-medium mb-3">Block Hight </span>
<div class="text-900 font-medium text-xl">{{networkInfo.blocks}}
</div>
</div>
<!-- <div class="flex align-items-center justify-content-center bg-orange-100 border-round"
[ngStyle]="{width: '2.5rem', height: '2.5rem'}">
<i class="pi pi-star text-orange-500 text-xl"></i>
</div> -->
</div>
<span class="text-green-500 font-medium">Weight: {{networkInfo.currentblockweight | number}}</span>
</div>
</div>
</ng-container>
</div>
<div class="card">
@@ -29,7 +85,7 @@
<th>Name</th>
<th>Session ID</th>
<th>Hash Rate</th>
<th>Best Difficulty (Session)</th>
<th>Session Best Difficulty</th>
<th>Uptime</th>
</tr>
</ng-template>
@@ -3,6 +3,7 @@ import { ActivatedRoute } from '@angular/router';
import { map, Observable, shareReplay } from 'rxjs';
import { HashSuffixPipe } from '../../pipes/hash-suffix.pipe';
import { AppService } from '../../services/app.service';
import { ClientService } from '../../services/client.service';
@Component({
@@ -19,9 +20,17 @@ export class DashboardComponent {
public chartOptions: any;
public networkInfo$: Observable<any>;
constructor(
private clientService: ClientService,
private route: ActivatedRoute,
private appService: AppService
) {
this.networkInfo$ = this.appService.getNetworkInfo();
constructor(private clientService: ClientService, private route: ActivatedRoute) {
this.address = this.route.snapshot.params['address'];
this.clientInfo$ = this.clientService.getClientInfo(this.address).pipe(
shareReplay({ refCount: true, bufferSize: 1 })
+15 -11
View File
@@ -14,28 +14,30 @@
<h1 class="text-900 font-normal">Public Pool</h1>
</div>
<div class="mb-4">
<a class="mr-4" href="https://github.com/benjamin-wilson/public-pool" target="_blank">
<i class="pi pi-github" style="font-size: 30pt; color: white;"></i>
<a class="ml-4 mr-4" href="https://twitter.com/Public_Pool_BTC" target="_blank">
<i class="pi pi-twitter" style="font-size: 30pt; color: white;"></i>
</a>
<a href="https://discord.gg/pF9smpe3yE" target="_blank">
<a class="ml-4 mr-4" href="https://discord.gg/pF9smpe3yE" target="_blank">
<i class="pi pi-discord" style="font-size: 30pt; color: white;"></i>
</a>
<a class="ml-4 mr-4" href="https://github.com/benjamin-wilson/public-pool" target="_blank">
<i class="pi pi-github" style="font-size: 30pt; color: white;"></i>
</a>
</div>
<div>
<code>Fully Open Source Solo Bitcoin Mining Pool</code>
<br>
<br>
<div class="info">
<div class="info mb-2 p-4 border-dashed border-1 border-round">
<code>stratum+tcp://public-pool.airdns.org:21496</code>
<br>
<code>username: &lt;your BTC address&gt;.&lt;worker name&gt;, password: x</code>
<br>
<br>
</div>
<code>Pleb mining (under 50TH/s miners) mine with <b>NO FEES*</b></code>
<code>Pleb mining (under 50TH/s miners) mine with <b>NO FEES</b></code>
<br>
<code>Miners with > 50TH/s will incur a 1.5% fee, a portion of which will go back into <a href="https://discord.gg/pF9smpe3yE" target="_blank">open source Bitcoin mining</a>*</code>
<code>Miners with > 50TH/s will incur a 1.5% fee, a portion of which will go back into <a href="https://discord.gg/pF9smpe3yE" target="_blank">open source Bitcoin mining</a></code>
<br>
<br>
<code>No second best.</code>
@@ -48,8 +50,6 @@
<button [disabled]="address.invalid" class="ml-3 mt-3" pButton label="My Workers"
[routerLink]="['app',address.value]"></button>
</div>
<code><small>* Based on a machine-by-machine basis</small></code>
</div>
</div>
@@ -67,18 +67,22 @@
<div class="col-12" *ngIf="userAgents$ | async as userAgents">
<div class="card">
<h4 style="text-align: center;">Devices</h4>
<h4 style="text-align: center;">Online Devices</h4>
<p-table [value]="userAgents">
<ng-template pTemplate="header">
<tr>
<th>Device</th>
<th>Currently Working</th>
<th>Best Difficulty <i class="pi pi-question-circle ml-2"
pTooltip="If you find a solution with a difficulty higher than the network difficulty, you've found a block."></i>
</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-userAgent>
<tr>
<td>{{ userAgent.userAgent | userAgent }}</td>
<td>{{ userAgent.count }}</td>
<td>{{ userAgent.bestDifficulty | numberSuffix}}</td>
</tr>
</ng-template>
</p-table>
@@ -8,6 +8,7 @@
.info {
font-weight: bold;
font-size: x-large;
}
.card {
@@ -21,10 +21,15 @@ export class SplashComponent {
public chartOptions: any;
constructor(private appService: AppService) {
const info$ = this.appService.getInfo().pipe(shareReplay({ refCount: true, bufferSize: 1 }));
this.blockData$ = info$.pipe(map(info => info.blockData));
this.userAgents$ = info$.pipe(map(info => info.userAgents));
+4 -4
View File
@@ -13,9 +13,9 @@
<i class="pi pi-ellipsis-v"></i>
</button>
<div #topbarmenu class="layout-topbar-menu"
<!-- <div #topbarmenu class="layout-topbar-menu"
[ngClass]="{'layout-topbar-menu-mobile-active': layoutService.state.profileSidebarVisible}">
<!-- <button class="p-link layout-topbar-button">
<button class="p-link layout-topbar-button">
<i class="pi pi-calendar"></i>
<span>Calendar</span>
</button>
@@ -26,6 +26,6 @@
<button class="p-link layout-topbar-button" [routerLink]="'/documentation'">
<i class="pi pi-cog"></i>
<span>Settings</span>
</button> -->
</div>
</button>
</div> -->
</div>
+3
View File
@@ -16,6 +16,9 @@ export class AppService {
public getInfo() {
return this.httpClient.get(`${environment.API_URL}/api/info`) as Observable<any>;
}
public getNetworkInfo() {
return this.httpClient.get(`${environment.API_URL}/api/network`) as Observable<any>;
}
public getInfoChart() {
return this.httpClient.get(`${environment.API_URL}/api/info/chart`) as Observable<any>;
}
+1 -1
View File
@@ -1,4 +1,4 @@
export const environment = {
production: true,
API_URL: 'https://public-pool.airdns.org:40557',
API_URL: 'http://public-pool.airdns.org:40557',
};
+1 -1
View File
@@ -1,4 +1,4 @@
export const environment = {
production: false,
API_URL: 'https://localhost:3334'
API_URL: 'http://localhost:3334'
};
+2 -3
View File
@@ -4,8 +4,7 @@ import { ButtonModule } from 'primeng/button';
import { ChartModule } from 'primeng/chart';
import { InputSwitchModule } from 'primeng/inputswitch';
import { TableModule } from 'primeng/table';
import { TooltipModule } from 'primeng/tooltip';
export const primeNgServices = [
MessageService,
@@ -17,7 +16,7 @@ const primeNgModules = [
ChartModule,
InputSwitchModule,
ButtonModule,
TooltipModule
// DropdownModule,
// ToastModule,
// CheckboxModule,