Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions server/src/config-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const __dirname = dirname(fileURLToPath(import.meta.url));
interface PortsConfig {
TRANSLATOR_PORT: number;
JDC_PORT: number;
JDC_AUTHORITY_PUBLIC_KEY: string;
}

function loadPorts(): PortsConfig {
Expand All @@ -35,6 +36,7 @@ function loadPorts(): PortsConfig {
const ports = loadPorts();
export const TRANSLATOR_PORT = ports.TRANSLATOR_PORT;
export const JDC_PORT = ports.JDC_PORT;
export const JDC_AUTHORITY_PUBLIC_KEY = ports.JDC_AUTHORITY_PUBLIC_KEY;

/**
* Generate Translator Proxy config (tproxy-config.toml)
Expand All @@ -54,7 +56,7 @@ export function generateTranslatorConfig(data: SetupData): string {
// When connecting to local JDC, we don't need authority key (using hardcoded keys)
// When connecting to external pool, we need the pool's authority key
const authorityPubkey = mode === 'jd'
? '9auqWEzQDVyd2oe1JVGFLMLHZtCo2FFqZwtKA5gd9xbuEu7PH72'
? JDC_AUTHORITY_PUBLIC_KEY
: pool.authority_public_key;

// Min hashrate from user config (default 100 TH/s if not set)
Expand Down Expand Up @@ -131,7 +133,7 @@ max_supported_version = 2
min_supported_version = 2

# Auth keys for downstream connections
authority_public_key = "9auqWEzQDVyd2oe1JVGFLMLHZtCo2FFqZwtKA5gd9xbuEu7PH72"
authority_public_key = "${JDC_AUTHORITY_PUBLIC_KEY}"
authority_secret_key = "mkDLTBBRxdBv998612qipDYoTK3YUrqLe8uWw7gu3iXbSrn2n"
cert_validity_sec = 3600

Expand Down
3 changes: 2 additions & 1 deletion shared/ports.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"TRANSLATOR_PORT": 34255,
"JDC_PORT": 34265
"JDC_PORT": 34265,
"JDC_AUTHORITY_PUBLIC_KEY": "9auqWEzQDVyd2oe1JVGFLMLHZtCo2FFqZwtKA5gd9xbuEu7PH72"
}
4 changes: 2 additions & 2 deletions src/components/setup/MinerConnectionInfo.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useState } from 'react';
import { Copy, Check } from 'lucide-react';
import { TRANSLATOR_PORT, JDC_PORT } from '@/lib/ports';
import { TRANSLATOR_PORT, JDC_PORT, JDC_AUTHORITY_PUBLIC_KEY } from '@/lib/ports';

function CopyableAddress({ address }: { address: string }) {
const [copied, setCopied] = useState(false);
Expand Down Expand Up @@ -32,7 +32,7 @@ interface MinerConnectionInfoProps {

export function MinerConnectionInfo({ isJdMode, centered = false }: MinerConnectionInfoProps) {
const translatorUrl = `stratum+tcp://<your-machine-ip>:${TRANSLATOR_PORT}`;
const jdcUrl = `stratum+tcp://<your-machine-ip>:${JDC_PORT}`;
const jdcUrl = `stratum2+tcp://<your-machine-ip>:${JDC_PORT}/${JDC_AUTHORITY_PUBLIC_KEY}`;

const hint = (
<p className="text-xs text-muted-foreground">
Expand Down
3 changes: 2 additions & 1 deletion src/lib/ports.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
/**
* SV2 stack port configuration.
* SV2 stack configuration constants.
* Single source of truth: shared/ports.json
*/

import ports from '../../shared/ports.json';

export const TRANSLATOR_PORT = ports.TRANSLATOR_PORT;
export const JDC_PORT = ports.JDC_PORT;
export const JDC_AUTHORITY_PUBLIC_KEY = ports.JDC_AUTHORITY_PUBLIC_KEY;
Loading