Skip to content

Instantly share code, notes, and snippets.

@decryp2kanon
Forked from lrhel/Solo-Mining.md
Created January 26, 2021 19:58
Show Gist options
  • Save decryp2kanon/e3dd1b9cae0f197be5a358fab1300a4e to your computer and use it in GitHub Desktop.
Save decryp2kanon/e3dd1b9cae0f197be5a358fab1300a4e to your computer and use it in GitHub Desktop.
Solo-mining Sugarchain with multiple computer

First of all, make sure you have a full node running and fully synced All machines need to be connected to the same local network (e.g same wi-fi)

Node configuration

On the computer with the full node, find the local IP address: On MacOS/Linux you can use

ifconfig

And should return something like

en1: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
	ether e4:ce:8f:0e:33:c4 
	inet6 fe80::404:8467:3244:a799%en1 prefixlen 64 secured scopeid 0x7 
	inet 192.168.178.107 netmask 0xffffff00 broadcast 192.168.178.255
	inet6 2001:7e8:c8de:2000:c40:7f55:b1ca:4fbe prefixlen 64 autoconf secured 
	inet6 2001:7e8:c8de:2000:bc3c:2b79:8478:693b prefixlen 64 autoconf temporary 
	nd6 options=201<PERFORMNUD,DAD>
	media: autoselect
	status: active

What we need is our IP address as well as the CIDR notation of it

The important part is the line with inet

inet 192.168.178.107 netmask 0xffffff00 broadcast 192.168.178.255

With that, we will be able to calculate the CIDR address for the sugarchainf.conf So in my case, the IP of the full node is 192.168.178.107 The netmask is 0xffffff00 in https://www.subnetonline.com/pages/subnet-calculators/dec-to-hex-calculator.php enter your netmask Calculating the mask and copy the subnet mask, in my case it's 255.255.255.0

Now on https://www.subnet-calculator.com/cidr.php enter your IP and your mask Calculating the CIDR and copy the net CIDR notation, in my case it's 192.168.178.0/24

Now open your sugarchain.conf file and modify as follow

server=1
rpcbind=192.168.178.107
rpcuser=user
rpcpassword=pass
rpcallowip=127.0.0.1
rpcallowip=192.168.178.0/24

notice the rpcbind is the full node IP and the last rpcallowip is our IP in CIDR notation, this will allow anyone in our local network to connect to our node.

Miner

Now on any computer connected to the same network, just run the miner using the node IP For example with sugarmaker (don't forget to change the options accordingly to your own configuration)

 ./sugarmaker -o http://192.168.178.107:34229 -u user -p pass --coinbase-addr=sugar1q3hjg38ygedjz96e7vyvsju36q2muke439t3237 -t1

Happy mining :)

@sariose
Copy link

sariose commented Dec 30, 2022

Is it not possible with Windows?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment