Bitcoin Forum

Alternate cryptocurrencies => Mining (Altcoins) => Topic started by: BlackHatCoiner on August 22, 2020, 09:03:25 PM



Title: How exactly does a cpu miner work?
Post by: BlackHatCoiner on August 22, 2020, 09:03:25 PM
I have installed cpuminer on my ubuntu 18.04:

https://i.imgur.com/LroFNxD.png

The problem is that I don't know how does it work. By the --help command I can see that it needs a pool url. I don't want to pool mine. I want to solo mine. Not for bitcoin, but for my altcoin:

https://i.imgur.com/Rw7zFia.png

The source files are from litecoin. I just changed the blockchain.


Title: Re: How exactly does a cpu miner work?
Post by: ranochigo on August 23, 2020, 02:33:45 AM
I've never used CPUMiner before but I've done solomining on cgminer before with my USB ASICs. The process should be the same.

./minerd --algo=YOURALGORITHM --url=YOURRPCADDRESS -userpass=username:password --coinbase-addr=youraddress

You'll have to configure your client's configuration file to ensure that it is listening on it's RPC with the correct credentials.


Title: Re: How exactly does a cpu miner work?
Post by: nc50lc on August 23, 2020, 03:23:22 AM
If the node is in the same machine as the miner and the sample above doesn't work, try to use localhost and the port (your blockchain's), as the 'mining server'.
Code:
--url=http://localhost:port


Title: Re: How exactly does a cpu miner work?
Post by: CucakRowo on August 23, 2020, 08:35:04 AM
I hope you have a strong CPU when you want to do solo mining. If not, perhaps you can use this pool for your solo mining.
https://i.postimg.cc/15xfTmXD/458834373-1598171550-0-5137383.jpg
http://blockmasters.co/site/get-started
https://bitcointalk.org/index.php?topic=2362982.0



Title: Re: How exactly does a cpu miner work?
Post by: BlackHatCoiner on August 23, 2020, 08:50:05 AM
https://i.imgur.com/24oQQLS.png

It seems that I'm not connected to localhost:2333, how can I verify or just know what is my RPC?


Title: Re: How exactly does a cpu miner work?
Post by: CucakRowo on August 23, 2020, 09:04:54 AM
It seems that I'm not connected to localhost:2333, how can I verify or just know what is my RPC?
I think you must unlocked that tcp (local host connection) first.
Try these following steps (and for security purpose) as root :
Code:
ufw status
if result "inactive", then type :
Code:
ufw enable
then type "Y".
Then type :
Code:
ufw allow 2333/tcp

then try restart your cpuminer





Title: Re: How exactly does a cpu miner work?
Post by: BlackHatCoiner on August 23, 2020, 09:33:56 AM
It seems that I'm not connected to localhost:2333, how can I verify or just know what is my RPC?
I think you must unlocked that tcp (local host connection) first.
Try these following steps (and for security purpose) as root :
Code:
ufw status
if result "inactive", then type :
Code:
ufw enable
then type "Y".
Then type :
Code:
ufw allow 2333/tcp

then try restart your cpuminer

On ufw enable I get:
Code:
Firewall is active and enabled on system startup

On ufw allow 2333/tcp I get:
Code:
Skipping adding existing rule
Skipping adding existing rule (v6)

But still when I run the ./minerd command I get:
Code:
[2020-08-23 12:33:10] HTTP request failed: Failed to connect to localhost port 2333: Connection refused
[2020-08-23 12:33:10] json_rpc_call failed, retry after 30 seconds


Title: Re: How exactly does a cpu miner work?
Post by: labe1971 on August 23, 2020, 09:47:32 AM
https://i.imgur.com/24oQQLS.png

It seems that I'm not connected to localhost:2333, how can I verify or just know what is my RPC?

Hello in config file:

rpcuser=yourusername
rpcpassword=yourpassword
rpcallowip=127.0.0.1
server=1
rcpport=47950

Restart your wallet

mining.bat

minerd.exe -a algo -o http://127.0.0.1:47950 -u <rpcuser> -p <rpcpassword>


Title: Re: How exactly does a cpu miner work?
Post by: BlackHatCoiner on August 23, 2020, 09:49:48 AM
But I am on ...  linux. Not windows.

(Except if there's a config file on cpuminer folder.)


Title: Re: How exactly does a cpu miner work?
Post by: ranochigo on August 23, 2020, 10:28:39 AM
Um, I don't think the posters above actually read the topic.  :P You don't have to open your firewall because the communication is done within your LAN.

Anyways, you need to add your RPC username and password. You have to configure your client's config file, the bitcoin.conf equivalent. That's the reason for the connection being refused.


Title: Re: How exactly does a cpu miner work?
Post by: BlackHatCoiner on August 23, 2020, 10:29:44 AM
Um, I don't think the posters above actually read the topic.  :P You don't have to open your firewall because the communication is done within your LAN.

Anyways, you need to add your RPC username and password. You have to configure your client's config file, the bitcoin.conf equivalent. That's the reason for the connection being refused.

What username:password? Do i choose them?

Edit: If you mean the ubuntu's username and password then the answer is that nothing happens:

My command:
Code:
./minerd --algo=sha256d --url=http://localhost:2333 --userpass=angelo:MYPASSWORD --coinbase-addr=TDuGXYumssr2Xw2utvXyEYNCdFtTj5XguV

Output:
Code:
[2020-08-23 13:54:27] 2 miner threads started, using 'sha256d' algorithm.
[2020-08-23 13:54:27] Binding thread 0 to cpu 0
[2020-08-23 13:54:27] Binding thread 1 to cpu 1
[2020-08-23 13:54:27] HTTP request failed: Failed to connect to localhost port 2333: Connection refused


Title: Re: How exactly does a cpu miner work?
Post by: nc50lc on August 23, 2020, 11:01:48 AM
It seems that I'm not connected to localhost:2333, how can I verify or just know what is my RPC?
Is your node running?
If no, you need to run it together with the mining software.

What are you using, the GUI or CLI?
If it's the GUI, you might need to add server=1 to your config file to enable RPC outside of the GUI's console.
(that's based from Bitcoin Core's behavior)


Title: Re: How exactly does a cpu miner work?
Post by: BlackHatCoiner on August 23, 2020, 11:07:36 AM
How to know if it's running?

https://i.imgur.com/EE8VwcR.png


Title: Re: How exactly does a cpu miner work?
Post by: minerja on August 25, 2020, 09:36:42 AM
How to know if it's running?

https://i.imgur.com/EE8VwcR.png

Your wallet is connecting to any nodes, so thats your first problem.

Once you have a node / seednode i can help you.

you need a .conf file, i'm guessing you know where that goes?
it needs to contain
rpcuser=user (any username)
rpcpassword=password (any password)
server=1
daemon=1
listen=1
rpcallowip=127.0.0.1
rpcport=5555 (any port, but best to goto wallet, HELP, SHOW commands, and the default rpc port will be listed)

Then you need to start the wallet with ./mycoin - server

If it can't find the correct .conf, in the correct location, it usually shows you what it should be called, and where it expects to find it....

./minerd --algo=scrypt --url=http://127.0.0.1t:5555 -u user -p password --coinbase-addr=TDuGXYumssr2Xw2utvXyEYNCdFtTj5XguV -t 4

I have used "scrypt" because you said it was based on"litecoin", you need to use tha wallet to create a new receive address....give it a name of solo, then if you eventually make a pool, you can see what comes from where.
technically you can just use the first address, but i always find that creating a new one works...no idea why.

If that fails, drop me a DM, i can try your wallet on my PC and see if i can get you going.

J


Title: Re: How exactly does a cpu miner work?
Post by: BlackHatCoiner on August 25, 2020, 12:59:47 PM
No I don't have a config file, but I just created one. (mitcoin.conf)

The problem is that I can't see the port you're saying:

https://i.imgur.com/a0OV6Uw.png

Edit: Is it one of these?

Code:
Options:
  -?                     This help message
  -conf=<file>           Specify configuration file (default: mitcoin.conf)
  -pid=<file>            Specify pid file (default: mitcoind.pid)
  -gen                   Generate coins (default: 0)
  -datadir=<dir>         Specify data directory
  -dbcache=<n>           Set database cache size in megabytes (default: 25)
  -timeout=<n>           Specify connection timeout in milliseconds (default: 5000)
  -proxy=<ip:port>       Connect through socks proxy
  -socks=<n>             Select the version of socks proxy to use (4-5, default: 5)
  -tor=<ip:port>         Use proxy to reach tor hidden services (default: same as -proxy)
  -dns                   Allow DNS lookups for -addnode, -seednode and -connect
  -port=<port>           Listen for connections on <port> (default: 2333 or testnet: 12333)
  -maxconnections=<n>    Maintain at most <n> connections to peers (default: 125)
  -addnode=<ip>          Add a node to connect to and attempt to keep the connection open
  -connect=<ip>          Connect only to the specified node(s)
  -seednode=<ip>         Connect to a node to retrieve peer addresses, and disconnect
  -externalip=<ip>       Specify your own public address
  -onlynet=<net>         Only connect to nodes in network <net> (IPv4, IPv6 or Tor)
  -discover              Discover own IP address (default: 1 when listening and no -externalip)
  -checkpoints           Only accept block chain matching built-in checkpoints (default: 1)
  -listen                Accept connections from outside (default: 1 if no -proxy or -connect)
  -bind=<addr>           Bind to given address and always listen on it. Use [host]:port notation for IPv6
  -dnsseed               Find peers using DNS lookup (default: 1 unless -connect)
  -banscore=<n>          Threshold for disconnecting misbehaving peers (default: 100)
  -bantime=<n>           Number of seconds to keep misbehaving peers from reconnecting (default: 86400)
  -maxreceivebuffer=<n>  Maximum per-connection receive buffer, <n>*1000 bytes (default: 5000)
  -maxsendbuffer=<n>     Maximum per-connection send buffer, <n>*1000 bytes (default: 1000)
  -bloomfilters          Allow peers to set bloom filters (default: 1)
  -upnp                  Use UPnP to map the listening port (default: 1 when listening)
  -paytxfee=<amt>        Fee per KB to add to transactions you send
  -mininput=<amt>        When creating transactions, ignore inputs with value less than this (default: 0.0001)
  -server                Accept command line and JSON-RPC commands
  -testnet               Use the test network
  -debug                 Output extra debugging information. Implies all other -debug* options
  -debugnet              Output extra network debugging information
  -logtimestamps         Prepend debug output with timestamp (default: 1)
  -shrinkdebugfile       Shrink debug.log file on client startup (default: 1 when no -debug)
  -printtoconsole        Send trace/debug info to console instead of debug.log file
  -rpcuser=<user>        Username for JSON-RPC connections
  -rpcpassword=<pw>      Password for JSON-RPC connections
  -rpcport=<port>        Listen for JSON-RPC connections on <port> (default: 2332 or testnet: 12332)
  -rpcallowip=<ip>       Allow JSON-RPC connections from specified IP address
  -rpcthreads=<n>        Set the number of threads to service RPC calls (default: 4)
  -blocknotify=<cmd>     Execute command when the best block changes (%s in cmd is replaced by block hash)
  -walletnotify=<cmd>    Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)
  -spendzeroconfchange   Spend unconfirmed change when sending transactions (default: 1)
  -alertnotify=<cmd>     Execute command when a relevant alert is received (%s in cmd is replaced by message)
  -upgradewallet         Upgrade wallet to latest format
  -keypool=<n>           Set key pool size to <n> (default: 100)
  -rescan                Rescan the block chain for missing wallet transactions
  -salvagewallet         Attempt to recover private keys from a corrupt wallet.dat
  -checkblocks=<n>       How many blocks to check at startup (default: 288, 0 = all)
  -checklevel=<n>        How thorough the block verification is (0-4, default: 3)
  -txindex               Maintain a full transaction index (default: 0)
  -loadblock=<file>      Imports blocks from external blk000??.dat file
  -maxorphantx=<n>       Keep at most <n> unconnectable transactions in memory (default: 25)
  -reindex               Rebuild block chain index from current blk000??.dat files
  -par=<n>               Set the number of script verification threads (up to 16, 0 = auto, <0 = leave that many cores free, default: 0)

Block creation options:
  -blockminsize=<n>      Set minimum block size in bytes (default: 0)
  -blockmaxsize=<n>      Set maximum block size in bytes (default: 250000)
  -blockprioritysize=<n> Set maximum size of high-priority/low-fee transactions in bytes (default: 27000)

SSL options: (see the Mitcoin Wiki for SSL setup instructions)
  -rpcssl                                  Use OpenSSL (https) for JSON-RPC connections
  -rpcsslcertificatechainfile=<file.cert>  Server certificate file (default: server.cert)
  -rpcsslprivatekeyfile=<file.pem>         Server private key (default: server.pem)
  -rpcsslciphers=<ciphers>                 Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)

UI options:
  -lang=<lang>           Set language, for example "de_DE" (default: system locale)
  -min                   Start minimized
  -splash                Show splash screen on startup (default: 1)

2nd Edit: Okay, I set port=2332. This is my mitcoin.conf:
Code:
rpcuser=user
rpcpassword=password
server=1
daemon=1
listen=1
rpcallowip=127.0.0.1
rpcport=2332

3rd Edit: Shouldn't this be something else?
https://i.imgur.com/OOJacV9.png

Output of cpuminer:
https://i.imgur.com/Gabt1nU.png



Title: Re: How exactly does a cpu miner work?
Post by: minerja on August 25, 2020, 03:03:28 PM
No I don't have a config file, but I just created one. (mitcoin.conf)

The problem is that I can't see the port you're saying:

https://i.imgur.com/a0OV6Uw.png

Edit: Is it one of these?

Code:
Options:
  -?                     This help message
  -conf=<file>           Specify configuration file (default: mitcoin.conf)
  -pid=<file>            Specify pid file (default: mitcoind.pid)
  -gen                   Generate coins (default: 0)
  -datadir=<dir>         Specify data directory
  -dbcache=<n>           Set database cache size in megabytes (default: 25)
  -timeout=<n>           Specify connection timeout in milliseconds (default: 5000)
  -proxy=<ip:port>       Connect through socks proxy
  -socks=<n>             Select the version of socks proxy to use (4-5, default: 5)
  -tor=<ip:port>         Use proxy to reach tor hidden services (default: same as -proxy)
  -dns                   Allow DNS lookups for -addnode, -seednode and -connect
  -port=<port>           Listen for connections on <port> (default: 2333 or testnet: 12333)
  -maxconnections=<n>    Maintain at most <n> connections to peers (default: 125)
  -addnode=<ip>          Add a node to connect to and attempt to keep the connection open
  -connect=<ip>          Connect only to the specified node(s)
  -seednode=<ip>         Connect to a node to retrieve peer addresses, and disconnect
  -externalip=<ip>       Specify your own public address
  -onlynet=<net>         Only connect to nodes in network <net> (IPv4, IPv6 or Tor)
  -discover              Discover own IP address (default: 1 when listening and no -externalip)
  -checkpoints           Only accept block chain matching built-in checkpoints (default: 1)
  -listen                Accept connections from outside (default: 1 if no -proxy or -connect)
  -bind=<addr>           Bind to given address and always listen on it. Use [host]:port notation for IPv6
  -dnsseed               Find peers using DNS lookup (default: 1 unless -connect)
  -banscore=<n>          Threshold for disconnecting misbehaving peers (default: 100)
  -bantime=<n>           Number of seconds to keep misbehaving peers from reconnecting (default: 86400)
  -maxreceivebuffer=<n>  Maximum per-connection receive buffer, <n>*1000 bytes (default: 5000)
  -maxsendbuffer=<n>     Maximum per-connection send buffer, <n>*1000 bytes (default: 1000)
  -bloomfilters          Allow peers to set bloom filters (default: 1)
  -upnp                  Use UPnP to map the listening port (default: 1 when listening)
  -paytxfee=<amt>        Fee per KB to add to transactions you send
  -mininput=<amt>        When creating transactions, ignore inputs with value less than this (default: 0.0001)
  -server                Accept command line and JSON-RPC commands
  -testnet               Use the test network
  -debug                 Output extra debugging information. Implies all other -debug* options
  -debugnet              Output extra network debugging information
  -logtimestamps         Prepend debug output with timestamp (default: 1)
  -shrinkdebugfile       Shrink debug.log file on client startup (default: 1 when no -debug)
  -printtoconsole        Send trace/debug info to console instead of debug.log file
  -rpcuser=<user>        Username for JSON-RPC connections
  -rpcpassword=<pw>      Password for JSON-RPC connections
  -rpcport=<port>        Listen for JSON-RPC connections on <port> (default: 2332 or testnet: 12332)
  -rpcallowip=<ip>       Allow JSON-RPC connections from specified IP address
  -rpcthreads=<n>        Set the number of threads to service RPC calls (default: 4)
  -blocknotify=<cmd>     Execute command when the best block changes (%s in cmd is replaced by block hash)
  -walletnotify=<cmd>    Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)
  -spendzeroconfchange   Spend unconfirmed change when sending transactions (default: 1)
  -alertnotify=<cmd>     Execute command when a relevant alert is received (%s in cmd is replaced by message)
  -upgradewallet         Upgrade wallet to latest format
  -keypool=<n>           Set key pool size to <n> (default: 100)
  -rescan                Rescan the block chain for missing wallet transactions
  -salvagewallet         Attempt to recover private keys from a corrupt wallet.dat
  -checkblocks=<n>       How many blocks to check at startup (default: 288, 0 = all)
  -checklevel=<n>        How thorough the block verification is (0-4, default: 3)
  -txindex               Maintain a full transaction index (default: 0)
  -loadblock=<file>      Imports blocks from external blk000??.dat file
  -maxorphantx=<n>       Keep at most <n> unconnectable transactions in memory (default: 25)
  -reindex               Rebuild block chain index from current blk000??.dat files
  -par=<n>               Set the number of script verification threads (up to 16, 0 = auto, <0 = leave that many cores free, default: 0)

Block creation options:
  -blockminsize=<n>      Set minimum block size in bytes (default: 0)
  -blockmaxsize=<n>      Set maximum block size in bytes (default: 250000)
  -blockprioritysize=<n> Set maximum size of high-priority/low-fee transactions in bytes (default: 27000)

SSL options: (see the Mitcoin Wiki for SSL setup instructions)
  -rpcssl                                  Use OpenSSL (https) for JSON-RPC connections
  -rpcsslcertificatechainfile=<file.cert>  Server certificate file (default: server.cert)
  -rpcsslprivatekeyfile=<file.pem>         Server private key (default: server.pem)
  -rpcsslciphers=<ciphers>                 Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)

UI options:
  -lang=<lang>           Set language, for example "de_DE" (default: system locale)
  -min                   Start minimized
  -splash                Show splash screen on startup (default: 1)

2nd Edit: Okay, I set port=2332. This is my mitcoin.conf:
Code:
rpcuser=user
rpcpassword=password
server=1
daemon=1
listen=1
rpcallowip=127.0.0.1
rpcport=2332

3rd Edit: Shouldn't this be something else?
https://i.imgur.com/OOJacV9.png

Output of cpuminer:
https://i.imgur.com/Gabt1nU.png



Hi,
Okay,
Everything looks perfect... should work
Would you mind sending me the wallet, and your .conf, i will try it on my system
Just drop it somewhere like here please (https://gofile.io/welcome)

Oh, did just spot something....you still have no connections.
You cannot mine , even solomine with zero connections.
I don't know much about wallets, but they do need a connection to a seednode, or at the very least 1 other wallet.



Title: Re: How exactly does a cpu miner work?
Post by: BlackHatCoiner on August 25, 2020, 03:20:08 PM
It seems that I successfully mined 2 blocks. The problem is that I don't know the addresses. I've never seen them, but the coinbase reward went to them.

https://i.imgur.com/zeSTn64.png

https://i.imgur.com/LysDAkB.png

^ I only have that one address.


Title: Re: How exactly does a cpu miner work?
Post by: minerja on August 25, 2020, 03:27:19 PM
It seems that I successfully mined 2 blocks. The problem is that I don't know the addresses. I've never seen them, but the coinbase reward went to them.

https://i.imgur.com/zeSTn64.png

https://i.imgur.com/LysDAkB.png

^ I only have that one address.

You're missing the point.
If the wallet has ZERO connections, the blocks don't count. There is no chain. They can never validate.
Like i say, you need a seednode or at least 1 other wallet.

Is this your brandnew coin, or an old one you have found?


Title: Re: How exactly does a cpu miner work?
Post by: BlackHatCoiner on August 25, 2020, 03:37:58 PM
This is my brand new coin. I've never created one. It's my first one. So if I send you the files what exactly will you do? Will you open port 2332 and send me your IP address to connect?

If I want to be a seednode, do I need a port forward on port 2332?

And also what files? Those on .mitcoin or the mitcoin folder on desktop? I'll upload you both.

dotmitcoin.zip: https://mega.nz/file/9VokjaxB#rZyySNnfE4sYNPx1nU9JR7HXoDhIwzh3mxSAsRsR1nE
mitcoin.zip: https://mega.nz/file/hBgADC4J#f9N5CpJ9nb9VSgwdvy9sxiS7a96B0UxCDCKtLwKeQiE


Title: Re: How exactly does a cpu miner work?
Post by: minerja on August 26, 2020, 03:05:37 PM
This is my brand new coin. I've never created one. It's my first one. So if I send you the files what exactly will you do? Will you open port 2332 and send me your IP address to connect?

If I want to be a seednode, do I need a port forward on port 2332?

And also what files? Those on .mitcoin or the mitcoin folder on desktop? I'll upload you both.

dotmitcoin.zip: https://mega.nz/file/9VokjaxB#rZyySNnfE4sYNPx1nU9JR7HXoDhIwzh3mxSAsRsR1nE
mitcoin.zip: https://mega.nz/file/hBgADC4J#f9N5CpJ9nb9VSgwdvy9sxiS7a96B0UxCDCKtLwKeQiE


Sorry i have taken so long, i could get it to run on Ubuntu 16.
Then tried Ubu18, and had to do a load of messing around (lib4.8, etc etc)
So finally got it working, but need your ip address, and you to leave the wallet open please


Title: Re: How exactly does a cpu miner work?
Post by: BlackHatCoiner on August 26, 2020, 03:24:08 PM
Okay, I sent you a private message.


Title: Re: How exactly does a cpu miner work?
Post by: BlackHatCoiner on September 01, 2020, 10:04:28 PM
I can't believe I'm still working on this.

Has anyone any idea why I have zero connections? Or how I can make 1 connection pointing on myself?

This is my debug.log: https://pastebin.com/raw/kEF2kRqj

This is my mitcoin.conf:
Code:
rpcuser=user
rpcpassword=password
server=1
daemon=1
listen=1
rpcallowip=127.0.0.1
rpcport=2332