Skip to content

Commit d3fe29a

Browse files
web3 URL option in the .ini file
1 parent 231a6be commit d3fe29a

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

ethminer/MinerAux.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ class MinerCLI
123123
node.stratumPort = ProgOpt::Get("Node2", "StratumPort");
124124
node.stratumPwd = ProgOpt::Get("Node2", "StratumPwd");
125125
m_nodes.push_back(node);
126+
127+
m_web3Url = ProgOpt::Get("General", "Web3Url", "https://mainnet.infura.io/v3/7d1d166f63d84fc0865e5e410f583564");
126128
}
127129

128130
/*-----------------------------------------------------------------------------------
@@ -851,6 +853,9 @@ class MinerCLI
851853

852854
LogS << "Connecting to " << _nodeURL + ":" + _rpcPort << " ...";
853855

856+
// workRPC is used to get work and submit solutions
857+
// nodeRPC is used to retrieve current ETH block number and query token balance
858+
854859
// if solo mining, both workRPC and nodeRPC point to the mainNet node (whatever the user specifies)
855860
// if pool mining, workRPC points to the mining pool, and nodeRPC points to Infura
856861

@@ -861,7 +866,7 @@ class MinerCLI
861866
FarmClient* nodeRPC = &workRPC;
862867
if (m_opMode == OperationMode::Pool)
863868
{
864-
nodeClient = new jsonrpc::HttpClient("https://mainnet.infura.io/J9KBwsJ0q1LMIQvzDlGC:8545");
869+
nodeClient = new jsonrpc::HttpClient(m_web3Url);
865870
nodeRPC = new FarmClient(*nodeClient, OperationMode::Solo, m_userAcct);
866871
}
867872
else
@@ -1090,7 +1095,7 @@ class MinerCLI
10901095
int maxRetries = failOverAvailable() ? m_maxFarmRetries : 0;
10911096
EthStratumClient* client = new EthStratumClient(_nodeURL, _stratumPort, maxRetries, m_worktimeout, m_userAcct);
10921097

1093-
jsonrpc::HttpClient rpcClient("https://mainnet.infura.io/J9KBwsJ0q1LMIQvzDlGC:8545");
1098+
jsonrpc::HttpClient rpcClient(m_web3Url);
10941099
FarmClient nodeRPC(rpcClient, OperationMode::Solo, m_userAcct);
10951100

10961101
int tokenBalance = nodeRPC.tokenBalance();
@@ -1227,5 +1232,6 @@ class MinerCLI
12271232
bool m_shutdown = false;
12281233

12291234
string m_userAcct;
1235+
string m_web3Url;
12301236

12311237
};

tokenminer.ini

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11

22
[General]
33

4+
; uncomment this to specify your own web3 endpoint, otherwise the miner
5+
; will use it's own internal infura endpoint
6+
7+
; Web3Url=https://mainnet.infura.io/v3/0000000000000000000000000000000
8+
49
;--------------------------------------------------------
510
[Node]
611

0 commit comments

Comments
 (0)